How to Install and Run Node-RED on Android

Run Node-RED on Android
Run Node-RED on Android

Introduction

You don’t need a Raspberry Pi or a PC to set up Node-RED. All you need is your Android phone—and I’ll show you how to install and Run Node-RED on Android. In this guide, we’ll walk through the step-by-step process of installing Node-RED on an Android device using Termux. Plus, we’ll build a simple “Hello World” project to see it in action. You’ll have a fully functional Node-RED server running on your phone.


What is Node-RED?

Node-RED is a flow-based development tool allowing you to create automation and IoT solutions easily. It’s widely used to connect devices, APIs, and online services with minimal coding. Traditionally, Node-RED is run on devices like PCs, Raspberry Pis, or servers, but with this guide, you can run it on your Android phone.

Flow in Node-RED
Flow in Node-RED

Video Tutorial

Step 1: Prepare Your Android Device

Before we get started, make sure your device is ready:

  1. Update Your Android Device
    • Go to Settings > About Phone > Software Update and ensure your phone is running the latest version of Android.
  2. Install Termux
    • Download and install Termux from the Google Play Store or F-Droid.
    • Termux is a terminal emulator that lets you run Linux commands on your phone.

Step 2: Install Node.js

Node-RED requires Node.js to run. Let’s install it using Termux:

Open Termux

Launch Termux from your app drawer.

Update Packages

pkg update && pkg upgrade

This ensures all Termux packages are up to date.

Install Node.js

pkg install nodejs

Verify Installation

node -v

This will display the installed Node.js version. If successful, you’re ready for the next step.


Step 3: Install Node-RED

With Node.js installed, we can now install Node-RED:

Install Node-RED Globally

npm install -g --unsafe-perm node-red

Wait for Installation to Complete

The process may take a few minutes. Once done, Node-RED is ready to use.


Step 4: Start the Node-RED Server

Now, let’s start the Node-RED server and access the dashboard:

Run Node-RED

node-red

Find the Local URL

Once the server starts, it will display a URL like this: http://127.0.0.1:1880

This is the Node-RED dashboard URL.

Access Node-RED in a Browser

Open your Android’s browser and type the displayed URL (e.g., http://127.0.0.1:1880).

You should see the Node-RED interface.


Step 5: Create a Simple “Hello World” Project

Let’s build a quick project to see Node-RED in action:

  1. Add Nodes to the Workspace
    • Drag an Inject node from the left-hand palette onto the workspace. This node will trigger our flow.
    • Drag a Debug node onto the workspace. This node will display the output.
  2. Connect the Nodes
    • Connect the Inject node’s output to the Debug node’s input by dragging a line between them.
  3. Configure the Inject Node
    • Double-click the Inject node.
    • Set the Payload type to String and type Hello World in the text box.
    • Click Done to save.
  4. Deploy the Flow
    • Click the Deploy button in the top right corner to activate your flow.
  5. Test the Flow
    • Click the small button on the left side of the Inject node to trigger the flow.
    • Check the Debug panel on the right to see the message Hello World appear.
Node-RED Hello World
Node-RED Hello World

Step 6: Access Node-RED from Other Devices

If you want to access your Node-RED server from other devices on the same network, follow these steps:

Find Your Android’s IP Address

In Termux, run the following command to find your device’s IP address:

ifconfig

Look for the inet address under wlan0. For example, it might look like 192.168.1.100.

Access Node-RED from Another Device

On a device connected to the same Wi-Fi network, open a browser.

Type your Android’s IP address followed by :1880. For example:http://192.168.1.100:1880

This will open the Node-RED interface hosted on your Android phone.

How to Keep Node-RED Running in the Background

By default, Node-RED will stop when Termux is closed. To keep it running, follow one of these methods:

Option 1: Use tmux

tmux allows you to keep processes running even after Termux is closed.

Install tmux

pkg install tmux

Start a tmux Session

tmux new -s nodered

Run Node-RED

node-red

Detach the Session

Press Ctrl+B, then D to detach.

Reattach the Session

tmux attach -t nodered

Option 2: Use pm2

pm2 is a process manager for Node.js applications.

Install pm2

npm install -g pm2

Start Node-RED with pm2

pm2 start $(which node-red)

Save the Process for Auto-Start

pm2 save pm2 startup

Option 3: Run as a Background Process

Start Node-RED in the Background

node-red &

Check Running Jobs

jobs

Bring Node-RED Back to the Foreground

fg

Conclusion

Congratulations! You’ve successfully installed and run Node-RED on your Android device. Not only have you set up the server, but you’ve also created a simple “Hello World” project to test it out. With your Android phone now acting as a Node-RED server, the possibilities for automation and IoT projects are endless. Next, you can build dashboards in Node-RED using the MQTT protocol.

If you found this guide helpful, share it and tell others how easy it is to start with Node-RED on Android. Happy automating!

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.