• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » How to Use Android Smartphone as IoT Device (Termux, Node-RED)

By Abhishek Ghosh September 28, 2019 6:56 am Updated on September 28, 2019

How to Use Android Smartphone as IoT Device (Termux, Node-RED)

Advertisement

We can use any modern Android Smartphone something like a Raspberry Pi with a camera, all the sensors & send the collection to any IoT platform. Although it will sound like a complex work it is easy because of a lot of development by many hundreds of developers. There are ready to use Android applications which does the similar job from GUI and connect with IoT platform like IBM Watson IoT but, in this guide we will show the way from command line and Node-RED. We have used Samsung A50s for testing purpose.

 

Required Applications to Install on Android Smartphone

 

Install Termux application and Termux API application from Google Play. It is practical to use some physical mouse-keyboard via USB OTG. Also, you can share the smartphone screen to some screen which is bigger (like laptop, Smart TV).

Launch Termux. Run these commands :

Advertisement

---

Vim
1
2
3
4
5
6
7
8
9
10
apt update
apt upgrade
apt install termux-api
apt install coreutils nano nodejs
npm install -g --unsafe-perm node-red
cd ~/.node-red
ls -al
npm install node-red-dashboard
npm install node-red-contrib-ibm-watson-iot
npm install node-red-contrib-collector

The volume-down key and c on touchscreen keyboard works as ctrl+c to exit any application on Termux. Now, you can start node-red :

Vim
1
2
3
#
node-red
#

Node-RED will now run on localhost (127.0.0.1) on the Android phone. It will show the IP address and port (1880) it is running on in Termux. You can point a browser to 127.0.0.1:1880 and it will open up Node-RED flows editor.

How to Use Android Smartphone as IoT Device

 

How to Get the Sensor Data on Termux

 

You can open a new session in Termux by swiping the left drawer and clicking the new session option. This command will list all the sensors of your phone :

Vim
1
2
3
#
termux-sensor -l
#

The names on the list will vary on the handset model. For Samsung A50s, there are a lot of sensors which starts with the name “Samsung”. There is an extensive official documentation on how to use the commands related to Termux-API. We can grab data of one sensor by this kind of command :

Vim
1
2
3
4
5
#
 
termux-sensor -s "TCS3701 Light"
 
#

It gave me a continuously updated value :

Vim
1
2
3
4
5
6
7
{
"TCS3701 Light": {
"Values": {
118
   }
}
}

The light sensor is near the selfie camera. You can block the light falling on it with palm to get near-zero value to test the thing.

We can use Node-RED’s exec node to run the above command and get the sensor data into Node-RED’s flow editor. We need to convert that data into JSON. The final step is to push it to the IoT platform of your choice, like IBM Watson IoT. This was a generic guide to grab the data, we are not going into the details of how you will send the data. Your logical flow on Node-RED will be :

[timestamp node] –> [exec node] –> [json node] –> [function node to extract the number] –> [function node to format for your favourite IoT platform] –> [http request node] –> [msg payload node]

If we think IBM Watson IoT as the IoT platform then that platform will identify your device in the same manner as it does with Raspberry Pi.

Essentially, on IBM Watson IoT, you have to follow the same steps like we did with ESP32. So, the total procedure is easy.

Tagged With node red android sensors , termux iot , termux read camra data in mobile , node-red-contrib-keyboard-mouse-triggers termux , termux sensors , use mobile phone as iot , node red termux , node red Android send gyroscope data , iot with termux arduino , how to smart pfone function using iot

This Article Has Been Shared 233 Times!

Facebook Twitter Pinterest
Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Orthopaedic Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to How to Use Android Smartphone as IoT Device (Termux, Node-RED)

  • Android Watch : Technical Details

    Here is Technical Details of Android Watch. It is Definitely Practical to Remain Updated About These Android Watches. From Cheap China Companies to Top Notch Watch Companies Are Manufacturing Them.

  • How to Develop Android App for Arduino

    You Can Develop Small Android Apps and to Control Arduino Projects for DIY Home, Car etc Automation. Here is How to Develop Android App for Arduino.

  • Android Mobile Development Boards : Practical to Consider Now

    Android Mobile Development Boards are Practical to Consider Now as Commonly We Are Developing Both Hardware & Software Pointing Towards IoT. Arduino is best for ordinary electronics.

  • What Are AMOLED Display and Gorilla Glass of Smartphones?

    AMOLED Display and Gorilla Glass Has Been Popular Out of Marketing by the Companies. What Are AMOLED Display and Gorilla Glass of Smartphones?

  • Android Smartphone Qualcomm DAC Sound Quality Hack : Part 1

    We Need to Hack to Enable All the Hardware Features of Qualcomm 420 and Above. Here is Part 1 of Android Smartphone Qualcomm DAC Sound Quality Hack.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

You can subscribe to our Free Once a Day, Regular Newsletter by clicking the subscribe button below.

Click To Subscribe

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (21K Followers)
  • Twitter (5.3k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • What You Need to Know About the Microservices March 4, 2021
  • Fix Missing/Bad FileProvider for Freshchat (Android error code 354) March 3, 2021
  • Basics of Data Protection on the Internet March 2, 2021
  • What is Standard Software February 28, 2021
  • WordPress Link to text Fragment February 27, 2021

 

About This Article

Cite this article as: Abhishek Ghosh, "How to Use Android Smartphone as IoT Device (Termux, Node-RED)," in The Customize Windows, September 28, 2019, March 4, 2021, https://thecustomizewindows.com/2019/09/how-to-use-android-smartphone-as-iot-device-termux-node-red/.

Source:The Customize Windows, JiMA.in

 

This website uses cookies. If you do not want to allow us to use cookies and/or non-personalized Ads, kindly clear browser cookies after closing this webpage.

Read Cookie Policy.

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2021 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy