Ubidots IOT Platform Control and Monitoring using Nodemcu esp8266 wifi Module

(Last Updated On: July 17, 2019)

ubidots

Description:

In this tutorial, you will learn how to monitor and control both at the same time using the Nodemcu esp8266 wifi module and 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.


The components and tools used in this project can be purchased from Amazon, the components Purchase links are given below:

Arduino Uno: https://amzn.to/2tVz1vu
Mega 2560: https://amzn.to/2ze1kdu
Nodemcu esp8266 wifi module: Best price: https://amzn.to/2NAvmiB
lm7805 Voltage Regulator: https://amzn.to/2IZEl5x
330-ohm resistors pack: https://amzn.to/2NtlAeh
5v 2A adaptor: https://amzn.to/2GsNfcw
2n2222 NPN transistors: https://amzn.to/2EmXsIb
10k Resistor: https://amzn.to/2KTd6OW
lm7805 Voltage Regulator: https://amzn.to/2IZEl5x
330-ohm resistors pack: https://amzn.to/2NtlAeh
female DC power jack socket: https://amzn.to/2KEo1gt
470 UF capacitors: https://amzn.to/2xDCOzf
5×7 cm Vero board: https://amzn.to/2OHGbvn
female headers: https://amzn.to/2zqmtiJ
connection wires: https://amzn.to/2DpBuW7
Super Starter kit for Beginners: https://amzn.to/2KJvmKG
Jumper Wires: https://amzn.to/2KMoVXs
Bread Board: https://amzn.to/2MS4q8X
12v Adaptor: https://amzn.to/2Ntr6h1
PCB plate: https://amzn.to/2IUwpCt
Variable Supply: https://amzn.to/2MT4Qfj
Digital Multimeter: https://amzn.to/2Nvft9i
Vero Board / stripboard: https://amzn.to/2MTf9jD
Soldering iron kit: “best” You guys should definitely purchase this: https://amzn.to/2zfoNuJ
Solder wire: https://amzn.to/2ufUMWf
Wire Stripper: https://amzn.to/2KOqxfU
wirecutter: https://amzn.to/2ucIq14
PCB small portable drill machine: https://amzn.to/2Nu62X


Circuit Diagram:

ubidots

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 470 uf 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 make 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 consists of the 2n2222 NPN transistors, 10k resistors, and diodes. As you can see a 10k resistor is connected with the base of 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.

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.

Click to download: https://github.com/ubidots/ubidots-mqtt-esp

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.

Click to Download: https://github.com/knolleary/pubsubclient

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

Close