IOT Projects

Solar Panel Monitoring System using ESP8266 Nodemcu

Solar panel monitoring system using esp8266:

Solar Panel Monitoring System using ESP8266 Nodemcu- I have been using Nodemcu ESP8266 WiFi module, Voltage sensor 0-25V, DHT11 Temperature and Humidity module, and Relay modules in different beginners, intermediate, and advanced level projects. In my previous 4 tutorials,

  1. 12v Battery Voltage Monitor using LEDs and LM339 comparator
  2. Wireless battery voltage monitor using Arduino and Bluetooth
  3. Wireless Battery Voltage Monitoring using Arduino, NRF24L01, & Bluetooth
  4. Esp8266 Iot battery monitor, battery voltage monitoring using nodemcu esp8266 wifi module

In all these 4 tutorials, I have explained how to monitor the battery voltage using different technologies. You might be thinking why am I talking about these 4 projects, well the answer is monitoring a battery or monitoring a solar panel are exactly the same. I will be using the same voltage sensor and the same Nodemcu ESP8266 for monitoring the Solar Panel. The only difference is that, this time I am doing it for the solar panel instead of 12V battery. I highly recommend you should read my previous articles to understand things in more depth. Anyways,

In this project we will monitor the solar panel using Blynk application through ESP8266 Nodemcu. The advantage of using the Nodemcu ESP8266 and Blynk application is, we can monitor the Solar Panel voltage and other parameters from anywhere in the world using our cell phone. So, this is basically an IoT based project. For this project we will require the following components:

  • DHT22 or DHT11 temperature sensor
  • NodeMCU
  • Voltage sensor
  • Relay module

Amazon Links:

Nodemcu ESP8266 WiFi Module:

DHT11 Temperature and Humidity Module:

Voltage sensor 0-25v:

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!

Getting Started with Nodemcu ESP8266:

Nodemcu ESP8266 is a 3.3V compatible controller board and it can programmed using the Arduino IDE. The time you install the Arduino IDE you won’t see the Nodemcu ESP8266 in the boards list. So, first you will need to install the board before you can use it with the Arduino IDE. I have a very detailed tutorial on “Nodemcu ESP8266 Arduino IDE Board Manager URL Link Installation and first project”. In this article I explained the Nodemcu ESP8266 Pinout, technical specs, and I also explained how to write your very first program to control an LED. In this article I also explained how to setup your Blynk library. I highly recommend to read this article, if you have not yet setup your Nodemcu ESP8266, this article will really help you in getting started. Once you have installed the Nodemcu ESP8266 board and the necessary libraries then you are all set. Now let’s take a look at the circuit diagram.

Solar Panel Monitoring System Circuit Diagram:

Now for circuit connections we will connect the positive terminal of the solar panel with the positive terminal of the voltage sensor and negative terminal of the solar panel with the negative terminal of the voltage sensor. The OUT pin of the voltage sensor will be connected with the A0 of the NodeMCU ESP8266 and connect the ground of the voltage sensor with the ground of the NodeMCU Module. This part is for measuring the voltage and now we will connect the temperature sensor in order to measure the temperature of the solar panel and then we will connect the relay module with which we can connect the inverter or battery. For measuring the temperature of the system we have connected temperature sensor DHT11. The VCC pin of the sensor will be connected with 3V of the NodeMCU, ground of the DHT11 will be connected with the ground of the NodeMCU and data pin will be connected with the D4. This is the complete circuit diagram.

Solar Panel Monitoring

DHT11 sensor module is not the ideal choice for this project as it doesn’t make physical contact with the solar panel, you can use the DS18B20 one-wire digital temperature sensor. Currently, I have this DHT11 sensor so that’s why I am using this sensor module. Anyways it’s a prototype model to help you get started with your project, you can change the temperature sensor and relay module as per your requirement. When you have completed all the connections, make sure there are no short circuits, the continuity is ok, and everything is connected as per the circuit diagram, then the next step is to design the Blynk application.

Blynk App for the solar Panel monitoring system:

Now we will design application in the Blynk in order to monitor the status of the solar panel in the mobile. If you do not have Blynk application, download it from the play store, and make account. During the registration enter a valid email id, because while making the Blynk application you will be emailed an Authentication token which you will have to use in the Nodemcu ESP8266 programming. So, after downloading and installing the Blynk Application, Open the Blynk application.

Click on the create new project

Solar Panel Monitoring

Then select ESP8266 and in hardware select NodeMCU and in connection type select Wi-Fi. Give the name to the project in our case the project name is solar panel monitor and click on create.

Solar Panel Monitoring

The Auth token will be sent to the email which will be used in coding. Now in the widget box select the gauge. Now we will give it name voltage and use it as virtual pin V0 and set the maximum value to 25.

Solar Panel Monitoring

Solar Panel Monitoring

Click on the PIN and select virtual pin V0.

Now insert labeled value and give it name as temperature and set the value between 18 to 100

Solar Panel Monitoring

Now insert another label and give it name humidity and assign it virtual pin 2

Solar Panel Monitoring

Now again in the wedge box we will insert a super chart and give it name as voltage and select the virtual pin V0 and give the minimum and maximum between 0 to 25.

Solar Panel Monitoring

Now click on the add data stream and we will make graph for both temperature and humidity. Our Blynk App for the Solar Panel Monitoring System is ready.

Blynk library for Arduino IDE:

To write code we will first installed the Blynk library. In order to install the Blynk library in the Arduino IDE click on the sketch and select the manage library.

Solar Panel Monitoring

Now in search, write Blynk and click on install

Solar Panel Monitoring

After the installation is finished, we will install temperature sensor library and now we will write DHT sensor in the search and click on the install.

Solar Panel Monitoring

Now after installing the temperature sensor library we will install the simple timer library. Click on the sketch and then click on the insert zip file and select the zip file library. Download the Simple timer library:

Solar Panel Monitoring

After installing all the three libraries, now you can start writing your code.

Solar Panel Monitoring System ESP8266 Code:

Solar Panel Monitoring System Code Explanation:

You will need to add the following three libraries.

Then we will write the command for the dht sensor that which type of sensor we are using in our case we are using DHT11 which is connected to the digital pin 2

Now we will set the voltage on which the inverter will be on and off. It can be set according to the requirements.

Then to update the frequency we will write the command

This pin is connected with the relay module will turn on and off the inverter.

Now to calibrate the voltage value we write the command

Now to make the voltage divider for the voltage sensor we are using R1 and R2

Now we will insert the authorization token which we will get from the email when we create the blynk application

Now in the setup function we will define that which pin will be used as input and which will be used as output.

Then we will write the commands to show the current temperature and voltage value on the serial monitor and on the Blynk application.

Now we will read the pin value multiple times and get the average to reduce the noise.

Now calculate the voltage using the voltage divider equation

Now send the calculated data to the blynk application

Now to check the voltage and the status of the inverter to turn on and off the inverter we will write the command.

After uploading the code to the Nodemcu ESP8266 when you run the Blynk application, make sure you are connected to the WiFi and you have internet package, you will get the humidity, voltage, and temperature of the solar panel and also get the live graph.

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

Back to top button
%d bloggers like this: