Solar Panel Voltage Measure project using Arduino

Hey techies, welcome back to Techatronic. In this article, we are going to learn how you can display the output voltage of a Solar panel on a 16×2 LCD using Arduino in this Arduino solar project. For this project, we are using an Arduino UNO microcontroller board. Also, check out our E-book on Arduino which has 10+ projects with well-labeled diagrams and theory. A 16×2 LCD is capable of displaying 16 alphanumeric characters in one row and it has a total of two rows. The I2C module that we use is just for reducing the connecting pins with Arduino. View more projects on Arduino.

How Does it Work?

When the Solar panel is exposed to a light source it produces some output voltage which we can see on the 16×2 LCD. The Arduino read the output voltage produce by it and display the voltage on the LCD in volts. The LED connected with the Solar panel glows when voltage is produced. We are using an I2C module for interfacing with 16×2 LCD, it depends on you whether to use the I2C module or not in this Arduino solar project. We are provided you with both of the configurations. You can also check the output voltage values generated by the solar panel on the serial monitor. Use the image given below to locate the serial monitor. The final project looks like this. we have more solar projects like dual-axis solar trackers.

Arduino solar project

Components Required

  • Arduino UNO
  • Solar panel
  • 16×2 LCD
  • I2C module
  • Jumper wires
  • Breadboard
  • USB cable for uploading the code
  • an LED and a 220-ohm resistor

Circuit Diagram for the Project

  • Using an I2C module

solar panel voltage

  • Without using an I2C module

solar panel voltage

Circuit diagrams for both of the configurations are given. You can make any one of your choices. Connect the positive wire of the Solar panel with the analog-0 pin of the Arduino solar project and also with the positive wire of the LED. Join the negative wire of the Solar panel with the GND pin of the Arduino. Attach the negative wire of the LED with the GND pin of the Arduino through a 220-ohm resistor. If you are using an I2C module then connect the VCC and GND pins of the module with the 5-volts and GND pins of the Arduino. Attach the SCA and SCL pins of the module to the analog-4 and analog-5 pins of the Arduino. Use a breadboard for making common connections. Check the interfacing of an I2C module with a 16×2 LCD. If you are not using an I2C module then make the connections between Arduino digital pins and 16×2 LCD as shown in the diagram. You can check the interfacing of a 16×2 LCD with Arduino.

Code for the Project

Note: Please upload the given code to the Arduino. Make sure that you upload the code according to the circuit you have made. You need to install <LiquidCrystal.h>, <Wire.h>, <LiquidCrystal_I2C.h> libraries before uploading the code. Check how to add zip libraries to the Arduino IDE software.

  • Using an I2C module
 // TECHATRONIC.COM  
 // I2C LIBRARY  
 //https://github.com/fdebrabander/Arduino-LiquidCrystal-I2C-library  
 #include <Wire.h>           
 #include <LiquidCrystal_I2C.h>    
 LiquidCrystal_I2C lcd(0x27,16,2);   
 void setup()  
 {  
  Serial.begin(9600); // sensor buart rate  
  lcd.init();      
  lcd.backlight();  
 }  
 void loop()  
 {  
  int sensorValue = analogRead(A0); // Solar Panel Positive PIN connect to A0  
  float voltage = sensorValue * (5.0 / 1023.0);  
   Serial.print("voltage  ");  
   Serial.println(voltage);  
   lcd.setCursor(0,0);  
   lcd.print("VOLTAGE OF SOLAR");  
   lcd.setCursor(0,1);  
   lcd.print(voltage);   
   lcd.setCursor(6,1);  
   lcd.print("VOLT");  
   delay(500);   
 }  
  • Without using an I2C module
 // TECHATRONIC.COM  
 #include "LiquidCrystal.h"  
 LiquidCrystal lcd(9,8,7,6,5,4); // LCD Pin  
 void setup()  
 {  
  Serial.begin(9600); // sensor buart rate  
  lcd.begin(16,2);  // 16*2 LCD  
 }  
 void loop()  
 {  
  int sensorValue = analogRead(A0); // Solar Panel Positive PIN connect to A0  
  float voltage = sensorValue * (5.0 / 1023.0);  
   Serial.print("voltage  ");  
   Serial.println(voltage);  
   lcd.setCursor(0,0);  
   lcd.print("VOLTAGE OF SOLAR");  
   lcd.setCursor(0,1);  
   lcd.print(voltage);   
   lcd.setCursor(6,1);  
   lcd.print("VOLT");  
   delay(500);   
 }  

We hope that you learn this project well and must try to make it on your own. You can check some more tutorials on Arduino and Raspberry Pi made by us. If you are facing any problems do let us know in the comments section below.

HAPPY LEARNING!

Leave a Comment