IoT/ESP32 B.Tech/Diploma Beginner

Access Node-RED Dashboard from Anywhere using Digital Ocean

Install Node-RED software on a Linux Ubuntu Virtual Machine using Digital Ocean. Running Node-RED in the cloud allows you to access your Node-RED from anywhere.

  • Suitable forB.Tech/Diploma IoT/ESP32 students
  • Build time1-2 weeks
  • LevelBeginner
  • Available atAjvika Labs, Kakinada

About this project

This guide explains how to install Node-RED software on a Linux Ubuntu VM (Virtual Machine) using Digital Ocean. Running Node-RED in the cloud allows you to access your Node-RED Dashboard from anywhere.
You can also
install the MQTT Mosquitto Broker
in your VM to connect several ESP32/ESP8266 boards and other IoT devices from anywhere using different networks with an Internet connection.
Introducing Node-RED
Node-RED is a powerful tool for building Internet of Things (IoT) applications using visual programming: connect code blocks (nodes) together to perform a task. Node-RED provides a dashboard (
Node-RED dashboard
) that can be used as an Home Automation platform to interact with IoT devices to control outputs and monitor sensors.
You can easily establish a communication with Node-RED and your ESP32/ESP8266 boards using
HTTP requests
or
MQTT
, for example.
What’s the advantage of installing Node-RED on the cloud (Digital Ocean hosting service) and how it works? Here’s an example.
You have Node-RED software and Node-RED dashboard installed on Digital Ocean.
The ESP32 can communicate with Node-RED as long as it is connected to a router with access to the internet.
The ESP32 can send sensor readings to Node-RED and/or you can control its outputs by accessing the dashboard.
You can access Node-RED dashboard using your computer or your smartphone from anywhere in the world.
This allows you to control and monitor one or multiple
ESP32
/
ESP8266
boards from anywhere.
Hosting Service – Digital Ocean
To run your Cloud MQTT Mosquitto Broker, you need to use a hosting service that allows you to have access to the command line and install any software that you need. I recommend using
Digital Ocean
that offers an Ubuntu server that you can manage through a command line.
I’ve been using it since 2015 and I personally recommend it, but you can use any other hosting service. Any hosting service that offers a Linux Ubuntu VM with full console access should work.
If you don’t have a hosting account, I recommend
signing up for Digital Ocean
. When you sign up for Digital Ocean, you can try it for 60 days (they give you free credits to test the platform).
Note:
you can also
run Node-RED in your local network using a Raspberry Pi board
. However, the purpose of this tutorial is to run Node-RED in the cloud to communicate with boards (or other IoT devices) across different networks.
Creating Digital Ocean Account
To create a Digital Ocean Account, go to
Digital Ocean
and press the “
” button.
Create your account
, and you’ll receive a $100 credit that you can use for 60 days to test the platform. You might need to enter a valid credit card, but you can cancel your account anytime if you’re no longer interested in using the service after the free 60 days trial.
Complete the account creation using your preferred method (I always use the Email option).
Confirm your account and login, you should see a similar Dashboard.
Create a Droplet (Linux Ubuntu VM)
To create a new VM, press the “
Create
” button on the top right corner and select the “
Droplets
” option. Digital Ocean calls
Droplets
to its VMs.
Important:
if you’re already running a
Droplet with MQTT Mosquitto Broker
, you can skip these next steps (creating a Droplet). You can run both Node-RED and Mosquitto MQTT broker in the same server.
For this guide I’ll be using Ubuntu 20.04 (LTS) x64, and I recommend choosing the same option. You can also use the “
Basic
” starter plan.
In the VM resources menu, you can choose the cheapest plan for $5/month. Even with the lowest plan, it will run the MQTT Broker and Node-RED smoothly .
Choose the Virtual Machine datacenter location closer to you, in my case I’ve used “
London
” region.
Create the root password that allows you to access your Droplet (save this password, because you’ll need it to access your server).
Finally, choose a
hostname
to easily identify which Virtual Machine you are working with. I’ve named my Droplet as “mqtt-cloud-server”. That’s it, you just need to press the big green button “Create Droplet” to finish the process.
Wait a few minutes and when the progress bar ends, your Droplet is ready.
Accessing Your Linux Ubuntu VM Console
When your Droplet is prepared, open your newly created server (in my case, it’s called “
mqtt-cloud-server
“).
Select the “
Access
” menu and press the “
Launch Console
” button.
A new browser window opens up in your computer.
Type your login (root) and the password defined earlier, press Enter key to access your server.
There’s an
optional
step, but it goes beyond the scope of this tutorial. It’s
not
required to make this project work: prepare your server with non-root, sudo-enabled user and basic firewall with this
Initial Server Setup with Ubuntu 20.04
Installing Node-RED
Let’s install Node-RED software.
Before installing the software, update and upgrade your server (this will take a few minutes to complete).
sudo apt update && sudo apt upgrade -y
To install Node-RED, you’ll need npm:
sudo apt install npm -y
This next command installs Node-RED as a global module along with all its dependencies.
sudo npm install -g --unsafe-perm node-red
When the installation process is completed, you should see a similar message:
Open up a port on your server firewall. Node-RED defaults to using port 1880, so run this next command:
sudo ufw allow 1880
You can confirm it has succeeded if the end of the command output looks similar to:
node-red start
Wait a few seconds while everything loads, if you go to your Digital Ocean Droplet IP address followed by the port number 1880:
http://YOUR-Digital-Ocean-IP-Address:1880
For example:
http://178.62.83.231:1880
Node-RED software should load, here’s how it should look like:
In your console window, press the Ctrl+C key to stop Node-RED.
Autostart Node-RED on Boot
To make Node-RED autostart when you boot or restart your Virtual Machine, you need to create a new
systemd
file for the
nodered.service
:
sudo nano /etc/systemd/system/nodered.service
Then, add the following (if you’re using root, you can leave the file as it is – otherwise comment the root and configure the non-root user option):
[Unit]
Description=Node-RED
After=syslog.target network.target

[Service]
ExecStart=/usr/local/bin/node-red --max-old-space-size=128 -v
Restart=on-failure
KillSignal=SIGINT

# log output to syslog as 'node-red'
SyslogIdentifier=node-red
StandardOutput=syslog

# non-root user to run as
#WorkingDirectory=/home/rui/
#User=rui
#Group=rui

# if using a root user
WorkingDirectory=/root/
User=root
Group=root

[Install]
WantedBy=multi-user.target
Your file should look like this, save it and exit (Ctrl+X, Y, Enter key).
To enable the Node-RED service and run this file on boot, enter the command:
sudo systemctl enable nodered.service
Restart your Virtual Machine to test if Node-RED is automatically starting on boot:
sudo reboot
Wait approximately 2 to 3 minutes for your server to fully restart, when you open your server IP address Node-RED software should load automatically:
http://YOUR-Digital-Ocean-IP-Address:1880
That’s it! Your Node-RED software is prepared.
Securing Node-RED Software with Username and Password
Install node-red-admin package to make it available globally:
npm install -g --unsafe-perm node-red-admin
Run the next command to create a password hash:
node-red-admin hash-pw
You will be prompted for a password. Type your desired password, press Enter key, and a hash will be printed on screen.
Copy the hash string to your clipboard and open the Node-RED settings file. In my case the hash is:
$2b$08$bQvFgdNi6as2.JwtDENbP.w/JROldMUhY9o9hXExyjQzw1iFRvC9liF
Open the
settings.js
file:
sudo nano ~/.node-red/settings.js
Scroll down and uncomment the adminAuth block (by removing the

Technologies used

ESP32ESP8266Raspberry PiMQTTBLE

Hardware components

  • ESP32
  • ESP8266
  • Raspberry Pi

Software & tools

  • Node-RED
  • MQTT

What you get

  • Working project / hardware kit, tested before delivery
  • Complete source code with explanation
  • Project demo and guidance for your viva
  • Project report, PPT and IEEE paper support (on request)
Delivery & Payment
Delivery takes a minimum of two weeks from the date your inquiry is confirmed. Payment is in two parts: • 50% advance to start the project • Remaining 50% before delivery Note: • Documentation and PPT are not included by default • If you need documentation/PPT, it can be arranged for extra time and cost We'll confirm the exact timeline and cost with you after reviewing your requirements.