Data logging with open source hardware and software in the energy sector


This project explores how to monitor simple climatic conditions with the Arduino in the context of solar power generation. Specifically, it introduces basic temperature sensing with a TMP36 chip and light with a light-emitting diode (LED), and stores the information for later retrieval, then smoothes out selected results and display in a chart, using PHP as a data processor, MySQL® as storage, and Flotr as a charting library.

: Arduino, Ethernet Shield, Solar panel battery

<Sensors on panel>

photo of the light sensor taped to a wooden post

<Light Sensor>

Hardware setup

TMP36 sensors are attached to a solar rack and panel. On the right, under black electrical tape, is a sensor for ambient temperature taken from the metal pole. To the left is a second sensor attached to the back of a solar cell with duct tape. The duct tape retains adhesion a lot better than the consumer-grade electrical tape, at least in the short term.


Data reading

With the back end filling up with data, the next task is to make the data easily readable. There are a number of charting libraries available, each with its own strengths and weaknesses. Flotr (see Resources) is one example that uses JavaScript to display a chart in a browser window. The code shown in Listing 5 reads the data stored in the readings table and presents the temperature and light data in separate charts.
java code

The script is set up to treat X axis data as time values on the 24-hour clock for both charts and contains mouse instructions that allow you to hover over the produced line and display the related coordinates.
During the display phase, you might think about smoothing. This can be the use of a moving average or other weight-based scheme that moderates extreme values.





Please Login to comment
Notify of