Saturday, November 6, 2010

Arduino Solar Battery Monitor

The primary battery in my Solar Powered Home is a series of 4, 6 volt 395 Amp-hrs deep-cycle lead acid batteries. The capacity of this 24 volt battery system is about 9.5 kwHr. This Arduino project measures the power into and out of the battery and the battery voltage and displays on a 2x16 LCD display the current charge state of the battery along with other useful information.

Setup of the sensors
The cables connected to this battery are large and the currents high (~60 amps max). As a current sensor I used a hall effect CSLA2CD made by Honeywell Control. I had to splice in a smaller Battery cable to go thru the sensor. The sensor output saturates at about +/- 70 amps and the output is about +/- 33mv/amp with zero amps being the mid point of the sensor power supply, in my setup 8 volts.

A small protoboard has all the sensor electronics and is located near the batteries and draws power from them.  The 24 volts is regulated down to 8 volts for the hall effect current sensor and the 24 volt input is divided by ~ 1/6 to be suited for an Arduino A/D input. The two sensor outputs and a ground are wired back the the Arduino board which is located in a more convenient place several metres distant.

----------Schematic-coming soon----------

Breadboard version
Arduino and LCD display
Without the Breadboard
The Arduino and LCD display are wired up the same as the Adafruit project here with the two sensor inputs on A/D 0 and 1. A0 for the current to and from the battery and A1 the battery voltage.  I have used two of the Arduino's PWM outputs for the LCD back light and contrast.

The LCD displays two pages of information alternating 3 seconds each.
Page 1: battery voltage, battery current, state of charge %, fully charged = 100%, battery mode: charging, discharging, absorb and equalize.
Page 2: Today's stats in minutes reset at dawn
 charge time, discharge time, absorb time, equalize time.

The current weather including solar irradiation on the solar panels and the panel temperature (Extra sensors) are here.

Arduino Software
All my code is messy. May contain commented out debug stuff. You can rewrite it much better!
View code 
download code


  1. Hi, im doing like this, but im controlling what goes inside the home solar/wind or grid..
    but im also controlling batt voltages, i now want to monitor current and this sensor you are using is what i would like but from what i see it uses 8v, right ?
    do you know if it can work with the arduino 5v?


  2. fc, The spec sheet indicates minV of 6. The CSLA2CD is an accurate DC/AC current sensor. The output is about 33mv/amp with 0 amps half way between the power supply of the sensor. I use the output of the sensor directly into an Arduino A/D input. In my case the voltage to the Arduino is about 3.95v = 0 amps. So I can measure about +30A and -70A. This is OK for me as my solar panels can only put out about 35A max into the battery but my power tools can easily cause -50A from the battery to the 240 inverter.

  3. fc, You can scale the CSLA2CD output voltage into a 0-5v range so that the Arduino A/D converter resolves its entire 0-1023 range and with software this can represent any current from -70A to +70A with 0amps where every you choose. Look at the spec sheet for the sensor. I will soon have several more of them is my system.

  4. i'm not worry about the the output.i'm mean suplly voltage from arduino 5v.
    i found this one that seams to fit my requirements of 5v supply
    this one:
    but expensive...


  5. Hi, this is just what i've been looking for. Do you know when the schematic will be available??


  6. Dichio, Survived cyclone Yasi and will get back to this blog. I'll post the schematic soon.. I had forgotten.

  7. Hello, I´d like to see the schematics also :)

  8. Add me as another who would like to see the schematic :)

  9. hi. i am about to carry out a project about solar monitoring system. need to monitor certain parameters such as voltage,current and power from the solar cell. can u teach me how to connect the panels to the current sensor circuit,voltage divider then to arduino n from arduino to usb port? im a beginer sorry.

  10. can i know when the schematic will be uploaded?

  11. hello, we would like to ask you sir, and ask for advice sir, we want to monitor voltage of a 24 V lead acid battery both 12Ah, what is the best way for this using arduino sir? is voltage divider safe sir? thank for the reply

  12. This is really an important blog with many helpful information. I have been searching for a long time for this types of content. Keep up posting more and thanks for your great staff.
    Battery Operated Ultrasonic Level Sensor