Introduction: Solar Power Data Logger
Ever wanted to know how much solar power you could yield by putting PV cells in a specific place on or around your house?
This Instructable shows you how to build a data logger based on an Arduino (or Genuino) Uno with data-logger-shield and a PV cell recording the electric power yielded during a sunny day or even longer.
The data (date, time, voltage,...) are recorded on an SD-card and can be edited with a spreadsheet software like MS-Excel.
1.1 PV Cell
1 Offgridtec 12V/5W Poly Solarpanel
1 Diamond plate aluminium sheet 200x600x1,5mm
2 Aluminium sheet 26x15x1,5mm (for screw lock)
2 Bolts M8x20mm
2 Nuts M8
2 Wingnuts M8
1.3 Data logger
1 Enclosure 115x90x55mm
1 Mini Breadboard
1 Resistor 18 Ohm / 2W
1 Resistor 47 Ohm / 5W
1 feeder clip
1 Arduino or Genuino Uno R3
1 Adafruit data-logger-shield for Arduino
1 USB Cable
1 USB Battery Pack 5V/1A (without smart charging technology)
1 Piece of Plywood
0,5m Cable 2x0,75mm2
4 wire end sleeves 0,75mm2
Stacking headers for Arduino, wires for breadboarding, screws, bushings
2.1 Stand and casing
electric drill and drillers 2mm, 3mm, 8,5mm and 12mm
2.2 Data logger
soldering iron and solder
computer with Arduino IDE
Step 1: Preparing the Stand and the Solar Panel
The stand is made out of an aluminium sheet of 1,5mm, bent in U-shape according to the size of the solar panel. The inclination of the panel can be adapted and locked with the two wing nuts and a screw locks inside the panel frame.
1. Draw the shape of the stand on the sheet.
2. Cut off the corners and bend it.
3. Drill the holes for the M8 bolts.
4. Prepare the screw locks.
5. Drill two holes of 8,5mm in the frame of the panel.
6. Assemble stand and solar panel.
Step 2: Preparing the Voltage Divider and the Housing
The enclosure contains the electronic parts, Arduino Uno, data-logger-shield and the mini breadboard with the voltage divider.
The electronic parts are connected to the power supply of the Arduino, an USB battery pack and the solar panel.
1. Cut a piece of plywood according to the size of your casing. Make a cutoff for the mini breadboard.
2. Secure the Arduino on the plywood using three screws. (Mind to leave enough space for the SD card!).
3. Drill some aeration holes on both sides of the casing.
4. Drill two holes for the cables with diameter according to your bushes.
5. Put the resistors and the jumper wire on the mini breadboard.
The voltage divider (load) is calculated to provide 5V to the Arduino analog pin A0 when the solar panel reaches it´s maximum power point (MPP) under standard light intensity (0,28A and 17,6V under 1000W/m2). In practice, the 45 Ohm resistor has 47 Ohm and both resistors have tolerances (between 3 and 10%!). So, the operating point of the circuit does not meet exactly the MPP (see Voltage-current graph).
Anyway, the values of the resistors you want to use have to be checked in order to avoid voltages higher than 5V on the Arduino input.
Furthermore, modern PV modules work with so-called MPP-Trackers, inserted between solar panel and load, in order to ensure optimum operation under variable circumstances (temperature, light intensity). Our load stays constant which means that the amount of energy yielded with our data-logger will be slightly less compared to a complete PV module system.
Find more interesting information about the electrical characteristics of solar modules and MPP-trackers under
Step 3: Preparing the Data-logger-shield and Wiring
The Adafruit data-logger-shield lets you record data with date and time information. The data are stored on an SD card in a *.CSV-file, editable with a spreadsheet software. A backup battery keeps the clock working without external power supply.
Find a good documentation of the shield under
1. Solder the stacking headers on the shield.
2. Connect the two LEDs (solder pads "L1"L and "L2") on the data-logger-shield to the digital pins 2 and 3 (L1 to pin 2 and L2 to pin 3).
3. Connect the 2x0,75mm2 cable to the panel and the voltage divider.
4. Assemble the Arduino board and the shield.
5. Connect the voltage divider to the Arduino board (GND [blue wire] and Analog Pin A0 [orange wire]).
Step 4: Start-up
In order to use the sketch for the data logger, download and install the SD Library and the RTC Library.
Refer to the Adafruit download section under
1. Test and set up the Real Time Clock using the sketch described under
2. To avoid problems with the SD card, take a look under
3. Put the SD card in the card holder and open the sketch for the data-logger. Find more details about the sketch in the code walkthrough under
4. Connect the power source to your Arduino.
A couple of words about the power supply. I tried out different power sources. The Arduino with the shield, connected over the USB cable to the computer works perfectly. Using an external power supply, you have to connect at least 6,3V otherwise the data record will not work at all or you will get strange datetimes (like 185:185:185 …).
Instead of AA batteries, I use a USB battery pack to provide 5V to the Arduino. At 5V, the Arduino draws permanently a current of 35mA with short peaks during the writing to card process. My battery pack has a capacity of 2600mAh, thus the data-logger will work for about 74 hours.
If you want to use a USB battery pack too, don’t take one with a smart charging system which cuts the power off when the charging current falls under a certain value.
5. Make your settings in the sketch (ECHO_TO_SERIAL --> 1 ; WAIT_TO_START --> 1) and load it on your Arduino.
5. Open the serial monitor and start the recording.
Step 5: Editing Data With EXCEL
To calculate the amount of electric energy yielded with the solar panel, I use EXCEL to edit the *.csv file.
Depending the duration of the record you will get a huge table. One hour data record takes about 176kB on the SD card.
To use all the features of EXCEL, save the *.csv file as EXCEL Worksheet *.xls or *.xlsx. Depending your settings, mind to change the format of the decimal numbers (comma to point).
1. Add 4 columns for Voltage, Current, Power and Energy.
2. Add 2 columns for the values R1 and R2 (resistors of the voltage divider).
3. Fill in the values of the resistors you use for the voltage divider.
4. Copy the formulas for Voltage, Current, Power and Energy down to the last record in your worksheet.
5. In cell H2 you see the amount of energy yielded. It is the sum of the values in column H. As we have a data-set every second, a trapezoidal integration will give as a result with a good accuracy.
Find more about numerical integration under
6. Finally, you can use EXCEL to show the recorded values in a graphical way.
And now, after all, why just don´t take a break and sing with the Beatles "Good Day Sunshine ..." :-)
Second Prize in the
Sensors Contest 2016
Question 1 year ago on Step 5
this work for a 5 kW system?
3 years ago
Can you confirm that this instructable is not including the setup to charge the battery from the PV cell production ?
If not, is it possible ?
I have a powermokey solar panel / battery pack of 9000mAh of capacity that I'd like to reuse for this project which caracteristics are found here : https://www.futurama.co.za/powertraveller-powermonkey-extreme-charger-grey/
Can I use it to charge the battery and data log the production ?
Reply 3 years ago
The solar cell does not serve as an energy supply for the circuit (Arduino, Datalogger) but is consumed solely by the voltage divider. If you want to operate the electronics on the solar cell, the circuit complexity is considerably higher. A backup battery would still be needed, so that the circuit works well under less sunny conditions.I think your powermonkey pack could power the electronics.
4 years ago
Hi, I'm using 20 Wp solar panel with max. current 1.14 Amp. What resistor should I use?
can i use the solar panel to power load when it's connected to the logger?
5 years ago
This is great!
I have installed a solar panel (180W) into an MPPT Charge Controller into my battery bank of 2x140Wh AMG 12 V batteries.
I have two questions I am trying to figure out.
1) how much power am I generating at any given time
2) how much power do I have left (ideally in terms of Watt Hours)
Can this solution be increased to have a display which calculates that?
Reply 5 years ago
Hi Mark and thanks for your comment. My Data Logger is not the best solution to monitor the energy harvested with a PV installation because it creates relatively high energy losses. To have accurate values and low self-consumption use a current sensor according to the maximum power levels of your installation and a voltage divider.
I have never worked with displays but it should not be a problem to add it to the circuit and modify the Arduino code. Take a look at the this Arduino Energy Meter www.instructables.com/id/ARDUINO-ENERGY-METER/. I think it can suit your needs after little modification.
Monitoring the state of charge (SOC) of your battery is not simple. There are many good articles on the web describing different methods, more or less accurate and sophisticated. If you want to protect your batteries against overcharge or deep discharge, the easiest way is to monitor the battery voltage.
Please share your work as instructable.
6 years ago
6 years ago
Tipp top ëmgesat. Gratulatioun zum Gewënn,
6 years ago
Hi Moschtertaart, thanks for your quick and kind feedback and also the link! Yes really interesting stuff - considering also how much others charge for that if you buy standard data logger.. Also we can tweak and do much more with this.
Was thinking about some more stuff e.g. how to integrate a WiFi router etc. to it.
Is it possible that we may have a short skype chat if that works with you? Would love to hear more about your experiences and had some questions :-)
Cool that you are experimenting on MPP tracker!!
6 years ago
Very cool stuff! Did you try or can give advice how to enable data logging if there's battery and especially microinverter connected to it? Did you have experiences with measuring battery capacity also with Arduino?
Reply 6 years ago
Thank you for commenting!
Yet I have not tried other applications for the data logger, but it will be easy to use it with other/more sensors. Just make sure not to overstep the Arduino analog input voltage of 5V.
It´s a quite interesting subject, isn´t it?
Right now I am working on an Arduino Buck converter with mpp tracker for my solar panel.
If you are interested in Arduino solar charger circuits using voltage and current sensors, take a look at the very good instructable from deba168
6 years ago
and thank you for your positive feedback. Using the device to compare PV cells ? Why not ?
If you want to keep the voltage divider unchanged just consider two things:
The maximum current of the cell you want to test may not exceed 0,28A, otherwise the Arduino will be damaged (Maximum Voltage on the Analog input is 5V).
The circuit will not work in the Maximum Power Point of the cell unless it has the same characteristics as the one I used.
6 years ago
Wow looks really good. This would be a perfect cell tester for different types of cells, to see wich type off cells that put out most Power. So would this work let´s say just using a single cell that would have a much smaller output of maybe under a watt? or would you have to redesign the Circuit for this application?