Ubidots IOT Platform Control and Monitoring using Nodemcu esp8266 wifi Module

(Last Updated On: April 12, 2021)


Ubidots IoT Platform, Description:

Ubidots IoT Platform- In this tutorial, you will learn how to monitor and control both at the same time using the Nodemcu esp8266 wifi module and the Ubidots IoT Platform. In this project, a variable resistor or potentiometer will be used as the sensor for the demonstration purposes. When the variable resistor value exceeds a predefined value the indicator lamp is turned on, which is a feedback system and is accomplished using the Ubidots events.

In this Tutorial, you will also learn how to control the electrical loads; these are basically 220Vac indicator lamps, which of course you can replace with any electrical loads. For higher loads, you can use large electromagnetic relays.

Amazon Links:

Nodemcu ESP8266 WiFi Module:

LM7805 Voltage Regulator:

470uf capacitor:

330-ohm resistor:

DC Female Power Jack:

Female Headers:

Male Headers:

12V SPDT Relay:

One-Channel Relay Module:

Other Tools and Components:

Top Arduino Sensors:

Super Starter kit for Beginners

Digital Oscilloscopes

Variable Supply

Digital Multimeter

Soldering iron kits

PCB small portable drill machines

*Please Note: These are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!

Nodemcu Power Supply and Relay Interfacing Circuit Diagram:


This is the 5v regulated power supply based on the lm7805 voltage regulator. This 5v power supply will be used to power up the Nodemcu esp8266 wifi module. Two 470uf capacitors are connected at the input and output sides of the 7805 voltage regulator. A 330-ohm resistor is connected in series with the led. This is a current limiting resistor.  J1 is the dc female power jack this is where we can connect a 12v adaptor or battery. A wire from the output of the voltage regulator is connected with the Vin pin of the Nodemcu module and makes sure the power supply ground is connected with the Nodemcu ground pin.

The middle leg of the Variable resistor or Potentiometer is connected with the Analog pin A0 of the Nodemcu module. while the leftmost and rightmost legs of the variable resistor are connected with the 3.3v and ground. It really doesn’t matter which pin you connect with the 3.3v and ground as the resistor has no polarity.

For controlling these relays we will need relay drivers, the relay drivers simply consist of the 2n2222 NPN transistors, 10k resistors, and diodes. As you can see a 10k resistor is connected with the base of the 2n2222 NPN transistor as it’s a bjt “bipolar junction transistor” a current-controlled device, that’s why we need a current limiting resistor. The emitter of the 2n2222 NPN transistor is connected with the ground while the collector is connected with one side of the relay coil, while the other side of the relay coil is connected with 12 volts. This relay can be energized and de-energized using this transistor.  As you can see this relay consists of 5 pins, two coil pins, common, normally closed and normally open. These three pins have no physical connection with the coil pins….

So this is a 3 channel relay module, you can also use a readymade relay module. these are 10k resistors connected with the base of 2n2222 NPN transistors, these are the 1n4007 diodes connected across the relay coil pins, these are 12v SPDT type relays and these are the terminal blocks. I have soldered some jumper wires so that this relay module can be easily interfaced with the Nodemcu module other circuits. This relay module consists of 3 relays but I will be using only 2 relays. These relay will be connected with D0 and D1 pins of the Nodemcu module as per the circuit diagram.

Nodemcu ESP8266 Programming:

Before you start the programming, first of all, make sure that you download the Ubidots espmqtt library from the GitHub. after you download the library then simply open the latest version of the Arduino ide and add this library.


After you add the Ubidots espmqtt library then also download the pubsubclient library and add it the same way as I did for the ubidosts espmqtt library.


Ubidots IoT platform setup:

For the Ubidots IoT platform setup watch video tutorial given below.

Watch Video Tutorial:


Another Ubidots IOT Platform based Project:

Ubidots Nodemcu Light Intensity monitoring using Gauges and Charts



Recommended For You

About the Author: Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

Leave a Reply

%d bloggers like this: