We're an IoT team, and we like to see how far we can push things. Node-RED is already light, so we wanted to know how it would do on really limited hardware. We've run it on Raspberry Pi 4s managing greenhouse sensors and on Android phones running full IoT flows inside Termux, and in both cases the automation worked well on modest hardware.
The latest example is the Alpha Block educational robotics platform. Its whole swarm command centre runs on a Raspberry Pi CM4, with Node-RED orchestrating three robot units over MQTT, on hardware that costs less than a nice dinner.
Below is what we learned from these experiments, with the code snippets and configuration tricks that made them work.
Setting up Node-RED on a Raspberry Pi 4 or CM4
The Raspberry Pi is our default for stationary IoT projects. Node-RED installs easily with NVM (Node Version Manager) to manage Node.js and PM2 to keep the process running, so your flows run 24/7 and come back after a reboot. We've used this setup for everything from greenhouse monitors to custom USB controllers.
Step 1: Install NVM and Node.js
Start by grabbing NVM:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
Then load it (or restart your terminal):
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
Install Node 20 and set it as default, plus global packages:
nvm install 20
nvm alias default 20
npm i -g pm2 node-red gtop
Step 2: Initialise Node-RED and set up PM2
Fire up Node-RED once to create its config folder (stop with Ctrl-C):
node-red
Make it autostart with PM2:
pm2 startup
# Follow the prompted command, e.g., sudo env PATH=$PATH:/home/...
pm2 start node-red
pm2 save
Step 3: Add packages and permissions
On our Pis we add Dashboard 2.0 for interactive UIs, an MQTT broker, GPIO nodes for hardware tinkering, and USB HID for devices like keyboards or custom controllers:
cd ~/.node-red
npm i @flowfuse/node-red-dashboard node-red-contrib-aedes node-red-node-pi-gpio @gdziuba/node-red-usbhid
For USB HID on Debian/Pi, install dependencies and set permissions:
sudo apt install libusb-1.0-0 libusb-1.0-0-dev libudev-dev -y
sudo mkdir -p /etc/udev/rules.d
sudo nano /etc/udev/rules.d/85-pure-data.rules
Paste this into the file:
SUBSYSTEM=="input", GROUP="input", MODE="0777"
SUBSYSTEM=="usb", MODE:="777", GROUP="input"
KERNEL=="hidraw0", MODE="0777", GROUP="input"
KERNEL=="hidraw1", MODE="0777", GROUP="input"
KERNEL=="hidraw2", MODE="0777", GROUP="input"
Then apply:
sudo groupadd -f input
sudo gpasswd -a $USER input
sudo udevadm control --reload-rules
Bonus: an MQTT server inside Node-RED
node-red-contrib-aedes gives you a built-in MQTT broker. Test connections from another machine:
sudo apt-get install mosquitto-clients
mosquitto_sub -h 192.168.0.X -p 1883 -u username -P password -t '#' -v --quiet -W 5
We've used this to connect sensors across devices for real-time data flows, and it's a lot of fun.
Running Node-RED on Android with Termux
This is the wild part. Termux gives you a full Linux environment on Android, and Node-RED runs inside it, which turns your phone into a portable IoT controller for fieldwork or quick prototypes. We've tested it on budget phones, and it handles flows surprisingly well within the phone's limits.
Install Termux, Termux:API and Termux:Tasker from F-Droid. The Play Store versions have compatibility problems.
Step 1: Disable the phantom process killer
Android kills background apps aggressively, so we turn that off over ADB (enable USB or wireless debugging first):
adb pair IP:PORT # e.g., adb pair 192.168.50.174:39663
# Enter pairing code
adb connect IP:DIFFERENT_PORT # e.g., adb connect 192.168.50.174:37593
adb shell "/system/bin/device_config set_sync_disabled_for_tests persistent"
adb shell "/system/bin/device_config put activity_manager max_phantom_processes 2147483647"
adb shell settings put global settings_enable_monitor_phantom_procs false
Step 2: Install packages in Termux
Update, then install the essentials:
pkg upgrade
pkg install root-repo x11-repo coreutils nano net-tools wireless-tools tigervnc which termux-api openssh nodejs-lts git
Step 3: Set up remote SSH access
This makes remote management easy:
mkdir ~/.ssh
nano authorized_keys # Paste your public key
Connect via: ssh u0_a13@IP -p 8022
Step 4: Install Node-RED and extras
pkg install nodejs
npm i -g --unsafe-perm node-red pm2 gtop
npm i -g --unsafe-perm @flowfuse/node-red-dashboard node-red-contrib-aedes image-tools node-red-contrib-termux-api
Step 5: Configure VNC for a desktop view
Install XFCE4:
pkg i xfce4
vncserver -geometry 1920x1080 -xstartup startxfce4
Autostart services in .bash_profile:
sshd
pm2 start node-red
pm2 save
vncserver -geometry 1920x1080 -xstartup startxfce4
Step 6: Start on boot
Run Termux in split screen with ZeroTier, lock both apps so Android doesn't close them, and adjust the battery settings. To benchmark the desktop, we ran glmark2.
Tricks for limited hardware
We pushed these setups hard to see how well Node-RED holds up. These snippets came out of those experiments.
1. Increase swap space
On low-RAM devices like older Pis or Android phones, we add swap so heavy flows (image processing, for example) don't crash:
sudo fallocate -l 2G /swapfile # Create 2GB swap file
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab # Make persistent
2. Give devices friendly hostnames
We set hostnames so devices are easier to find on the network:
sudo hostnamectl set-hostname my-iot-hub # On systemd systems like Pi
echo "my-iot-hub" > /etc/hostname # Fallback
sudo systemctl restart systemd-hostnamed
3. Use ZeroTier for fixed IPs on Android
ZeroTier gives you a virtual network with static IPs, which suits mobile setups. Install the app, join a network (for example x1234yz) and authorise the device. In Termux we scripted checks:
zerotier-cli join NETWORK_ID # If CLI available
zerotier-cli listnetworks # Verify connection
What we've built with it
Greenhouse monitoring
A Pi 4 running Node-RED runs a complete greenhouse automation system. Temperature and humidity sensors connect over GPIO, and a camera module watches the plants. MQTT sends remote alerts, Dashboard 2.0 shows the data in real time, and watering is automatic, based on soil moisture.
Field data collection on a phone
Node-RED on Android with Termux handles GPS tracking for agricultural surveys and photo capture with metadata tags. Data is stored offline and syncs when the phone has a connection, and ZeroTier keeps the transfer secure.
A custom USB controller interface
For specialised hardware, we use USB HID integration for custom input devices and process sensor data in real time. Web-based control panels work from any device, and MQTT bridges the data to cloud services.
Performance numbers
Memory:
- Raspberry Pi 4 (4GB): handles 50+ complex flows at once
- Android (6GB RAM): runs Node-RED, VNC and several apps without trouble
- Swap: essential for image processing and large data flows
Network:
- ZeroTier adds about 5-10ms of latency, which doesn't matter for IoT
- MQTT throughput: 1,000+ messages per second on a Pi 4
- Dashboard updates take under 100ms on the local network
Power:
- A Pi 4 running Node-RED averages about 3-5W, low enough for solar setups
- Termux on Android drains the battery about as fast as video streaming
- Tip: use PM2's cluster mode for CPU-heavy flows
Build your own
Good IoT automation doesn't need expensive hardware. We use the same Node-RED patterns in production client environments: the I.C.E. Battery monitoring system runs on the Raspberry Pi and Node-RED setup described here.
For the full hardware and networking setup behind all this, from hardware selection to ZeroTier networking to database strategy, see our HomeLab DIY series.