ESP8266IOT Projects

Nodemcu ESP8266 IOT Power Lines Mains frequency monitoring 50Hz

Mains Frequency Monitoring Project 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.

allpcb circuit

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 the 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



Amazon Purchase Links:

12v Adaptor:

Arduino Uno

Arduino Nano

Nodemcu ESP8266 WiFi Module:

LM7805 Voltage Regulator:

470uf capacitor:

330-ohm resistor:

DC Female Power Jack:

Female Headers:

Male Headers:

5×7 cm Vero board:

EL817 Optocoupler:

Bridge Rectifier:

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

DISCLAIMER:

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!

 

IoT Mains Frequency Monitoring System Circuit Diagram:

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.

Mains Frequency Monitoring 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.



Mains frequency Monitoring Nodemcu Programming:

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



Watch Video Tutorial:

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...

Related Articles

One Comment

  1. Can this detect deviation to the hundreths of a Hertz? I’d like to monitor Hertz to the hundredths and voltage to the nearest volt. I’d like the controller to enable different contactors (there are three) in consecutive order if the frequency or voltage is too high or too low. I have a microgrid that I need something to dump excess electricity into a battery charger, heater element one, or heater element two.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button