Solar Data Logger

Solar Data Logger

TITLE: Solar Data Logger

DATE: May 2015

CONTRIBUTERS: Hugo Goulart de Lucena

TOOLKITS:  Arduino, JeeLib library, Adafruit_TinyFlash library,  SPI library, Software Serial library

MATERIAL: Arduino Pro Mini 328 – 3.3V/8MHzi, Voltaic 2 Watt Solar PanelSparkFun USB Lipoly charge controller – single cell Lithium Ion Battery – 3.7v 1200mAhSpark Fun Current Sensor BreakoutSparkFun 5V Step-up BreakoutMByte SPI Flash EPROM

DESCRIPTION:  This Data Logger logs the efficiency of a solar panel in any specific location. This module is an easy to use low cost module that can be installed in any location. It has specifically been designed for City roof tops to determine cost and feasibility of installing a full scale solar power systems.

On average the total cost of solar installation can be between $15,000 to $29,000 for average sized systems sized between 4kW and 8kW. This module can give the consumer the confidence need to make the switch to using a full sized solar powered system for there home.

A properly functioning solar system for apartment building can significantly lower energy costs through everyday energy uses like powering appliances like microwaves, dishwashers, lights etc.


    – JeeLib library for Low power functions. Put Arduino & GSM to sleep when logging data is unnecessary.

    – Adafruit_TinyFlash that send the data from the Arduino to the EPROM while using the SPI library.

    – SPI libraryconnects with the Adafruit_TinyFlash library for logging data to the EPROM.

    – Software Serial library that defines RX TX pins and creates a serial port for talking to the GSM board.

Full schematic

The EPROM is used to save and store the data read from the solar panel.

Ever 10 min the board wakes up and reads the current and voltage from the solar panel and calculates the total Energy and stores that Data to the EPROM. After the EPROM reaches 200 BYTES the DATA is sent vis GSM to a Server that visualizes the total energy over that year.

Every-time the data is sent to the server the next set of stored data overwrites the old data.

The SPI and Adafruit_TinyFlash libraries use PIN 10 & 12 by default as the Address pins, the SCL PIN is 11 and SDA PIN is 13 (as seen in schematic).

When using the EPROM you have to set an address and an Index that specifies where to write the data in its memory. Then When you want to write over that data you use that reference to write over.

We send the data from the EPROM by specifying the location of the data using the address and the index to put each compiled byte into a string.

This component is used in order to determine the real time current of the solar panel. A voltage divider is used to make the voltage reference on the Arduino match the voltage rating on the solar panel. 

Because the voltage rating on the Arduino is 3.3 volts and the rating on the solar panel is 6 volts, a voltage divider was necessary so that we could accurately log the voltage coming out of the solar panel with the low power Arduino.

The voltage divider consist in two different resistors used in series so that the AnalogRead numbers at Arduino can always be proportional to its own internal voltage (3.3V). In this case, if the solar panel was generating 6V the Arduino would read it as 1v. This is accomplished by using resistance values of 1KΩ and 4.7KΩ. By doing this the voltage coming to Arduino will always be 1 / 5.7 the real time voltage from the solar panel. Doing the reverse math in the code will determine the voltage before the divider (SolarPannelVoltage = AnalogRead * 5.7). Its important to notice that the actual resistance of the resistor is not important if the ratio between them are the same as used here (1 to 4.7). If the ratio between the resistor changes the proportion between the AnalogRead in Arduino and the voltage on the solar panel will also change.

The position of the resistor on the setup is also very important as it determines the current flow in the system. The smaller resistance needs to be connected to ground so it will not make all the current run to Arduino (Path of least resistance). Also the current sensor need to be connected before the current divider so it will use the full voltage and current going to the battery for its reading. 

 Calculations for voltage divider.

Calculations for voltage divider.

The GSM shield sends our data over 4G network to our Server via GPRS. The GSM shield uses something called AT Commands that sends and receives the data. To send the data over the GSM we used GPRS GET commands to send over a 4G network. We used the Software Serial library to define new RX TX pins on the Arduino that connected to the GSM board. There is a class here at ITP called Towers of Power that concentrate on GSM networks that explores cellphone technologies and how to get projects communicating with a cell carriers that is taught by Benedetta Piantella here at ITP. I referenced a lot of what was taught in this class by consoling with Benedetta on how to use the GSM board. There are a series of AT Commands that need to be called in code to send the data. First you need established a connection and what channel is being used by calling AT+QIFGCNT=0, in our case we used channel 0. To establish the network provider, in our case we were on T-Mobile, we write: AT+QICSGP=1,”EPC.TMOBILE.COM”.  After establishing the provider we call the URL to our server by writing: AT+QHTTPURL=200,30, the first number is how many characters are in our URL (in our case we posted our data in the URL), there is a Maximum of 200 characters allowed in the URL, the second number is how many seconds to then input the URL. Our URL is, everything posted after the add/ is posted to our JSON file on our server. To finalize our connecting and post the data, we write an AT command called GET: AT+QHTTPGET=60, and this posts out data. 

A voltage amplifier was necessary to power the GSM board because it was drawing 5 volts and a maximum current draw of 0.11 amps for about 30 seconds while sending data via GPRS 4G network.