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