Nodemcu ESP8266 IOT Power Lines Mains frequency monitoring 50Hz

(Last Updated On: July 3, 2019)

Mains Frequency

Description:

This Tutorial is based on the IOT Mains Frequency Monitoring system, in this Tutorial, you will learn how to make 110/220vac mains frequency monitoring system using Arduino, a Zero Crossing detector based on the EL817 Optocoupler, Nodemcu esp8266 wifi module, and Blynk application.

This is the 3rd version of the Mains Frequency monitoring system. While in the first version of the mains frequency monitoring system I used 2n2222 NPN transistor to send the on/off pulses to the Arduino Uno board and displayed the mains frequency on a 16×2 LCD.

While in version2 of the mains frequency monitoring system I updated the circuit and replaced the 2n2222 NPN transistor with the EL871 Optocoupler to isolate the controller side from the ac voltage side. This way if anything happens on the transformer side will have no effect on the controller side.


This Tutorial is entirely based on version1 and version2, the zero crossing detector circuit connections will remain the same. So I highly recommend you should watch my previous two tutorials on mains frequency monitoring system, in which I explained everything in very detail. In this Tutorial, I will only talk discuss the modifications. So in this Tutorial, we will cover

  1. Modified circuit diagram explanation
  2. Interfacing
  3. Blynk application
  4. Arduino programming
  5. Nodemcu esp8266 wifi module programming
  6. testing



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
Potentiometer: https://amzn.to/2JSLbfg
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 / strip board: 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
wire cutter: https://amzn.to/2ucIq14
PCB small portable drill machine: https://amzn.to/2Nu62XF

Circuit Diagram of the IOT Mains Frequency Monitoring System :

Mains Frequency


This schematic is designed in cadsoft eagle 9.1.0 version. If you want to learn how to make a schematic and PCB then watch my tutorial given below.

 

 

The zero crossing detector circuit is already explained in version2. This time I added a 5v regulated power supply based on the lm7805 voltage regulator. This is a dc female power jack where you can connect a 12v adaptor or battery or a Solar Panel. Two 470uf capacitors are connected at the input and output sides of the voltage regulator. A 330 ohm resistor is connected in series with the led; this is a current limiting resistor. a wire from the output of the voltage regulator is connected with the Vin pin of the Nodemcu module and the ground of the Power Supply is connected with the Arduino’s Ground. The Arduino and Nodemcu side has no physical connection with the zero crossing detector side.  This power supply will be used to power the Nodemcu module. The Nodemcu TX and RX pins are connected the Arduino’s pin number 7 and 8.

Interfacing:

Mains Frequency

The zero crossing detector circuit connections are already explained in my previous tutorial, the only modification is the addition of the Nodemcu esp8266 wifi module and a 5v regulated power supply based on the lm7805 voltage regulator as explained in the circuit diagram. The Nodemcu module TX and RX pins are connected with the Arduino’s pin number 7 and 8. Make sure you connect the ground of the Nodemcu module with the Arduino’s ground. The 5v orange wire from the power supply is connected with the Nodemcu Vin pin and the grey wire which is the ground wire is connected with the Nodemcu ground pin. So this is the only modification on the hardware side. Now let’s setup the blynk application.


Blynk Application designing for IOT Mains Frequency Monitoring:

  • First of all open the blynk application.
  • Click on the new project and set the project name as mains frequency.
  • Click on the choose device and select Nodemcu, make sure you set the connection type to wifi and then click on the create button, an authentication token will be send on your email id, which will be then used in programming, simply copy and paste it in programming. This is already explained in the video Tutorial given at the end of this Article.
  • Click anywhere on the screen and search for the lcd widget and add it.
  • click on the LCD widget, change the input type to advanced then click on the pin and select virtual pin V2. you can also change the screen color and fonts color if you want you can select any other color.


Mains Frequency

  • Our Application is ready and now let’s discuss the programming….

Programming of the IOT Mains Frequency Monitoring System:

This project is based on two programs. One program is written for the Arduino while the other program is written for the Nodemcu esp8266 wifi module. First let’s start with the Arduino programming.

Arduino Programming:

This program is the modified version of the same program used in version1 and version 2 of the frequency monitoring system, this time I added the softwareSerial.h header file for creating a serial port on pin number 7 and pin number 8. So the Nodemcu module will be connected with the Arduino’s pin number 7 and pin number 8. Pin number 7 is the RX while pin number 8 is the TX. Then I defined a variable myString of the type String. This variable will be used to store the complete message consisting of the frequency value and the delimiter. The rest of the programming is exactly the same, finally added the frequency value and comma with the myString to make a complete message and then this message is send to the Nodemcu module. And make sure you empty the mystring variable for the new data.



Nodemcu Programming:

For the complete explanation watch Video Tutorial given at the end of this Article.



Watch Video Tutorial:

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