Arduino Load Control

LPhillippiLPhillippi Registered Users Posts: 4
I created an Arduino project to control loads attached to my 12v off-grid solar system. Project source code is at the following url for anybody that is interested:

My objective was to control the inverter that has an air conditioner attached to it to keep my RV cool while I'm not there. Turn on the AC when the batteries are fully charged (13.6v) and turn it off when the batteries are somewhere below resting voltage(12.6v). I'm turning the inverter off below 12.3v which gives it plenty of time to charge up to 12.6v at the end of the day.

A Low Voltage Disconnect device wouldn’t work to control this type of behavior because the Xantrex inverter doesn't start back up when power is re-applied to disconnect circuit. The inverter is turned on by pressing and holding a button until it powers up. This is the behavior I’m emulating with the Arduino. I soldered wires to the remote start button and connected them to an Arduino relay board. The inverter has a USB power output which I used to detect when it responds to the emulated button press. The relay returns to NC when the USB voltage change is detected.

Additional relays are programmed to control a swamp cooler pump and a fan that is used to cool the charge controller and inverter.

The project uses a 3.2" TFT LCD screen that isn't required for core functionality. It displays current voltages, load states, temp and humidity values. It can also be used to adjust voltage, temp and humidity settings.

Arduino information and the IDE is here:


  • jonrjonr Solar Expert Posts: 1,386 ✭✭✭✭
    Re: Arduino Load Control

    I like it and need to do something similar myself.

    I understand that the state of charge of a lead acid battery is hard to determine. Ie, measuring the voltage while under load and after a long rest (the usual assumption) leads to different results. For example, with a brief, heavy load, the voltage of a fully charged battery might drop to 12.0V, but this doesn't mean that that battery needs charging. Are there good solutions to this? Ie, how can one separate low charge from low voltage created by load?

    I am available for custom hardware/firmware development

  • zonebluezoneblue Solar Expert Posts: 1,218 ✭✭✭✭
    Re: Arduino Load Control

    SOC is best measured using a ah counting based algo, which means having a shunt and associated intregration logic. There are some factors that influence ah capacity and efficiency such as temperature, current, soc etc, and there doenst seem to be much open info about modelling those around.

    The beauty of a uP project like this is than you can also measure things like potential solar harvest, so determining *how much* spare power there is.
    1.8kWp CSUN, 10kWh AGM, Midnite Classic 150, Outback VFX3024E,

  • BB.BB. Super Moderators, Administrators Posts: 32,319 admin
    Re: Arduino Load Control

    Here is a generic set of drawings of what a battery voltage looks like across currents (charging/discharging) vs state of charge--You can also throw temperature in there too--if you want a bit more confusion.
    New poster "leaf" has a really nice set of charts that compare battery voltage against different rates of discharging and charging (as well as resting voltage readings).
    leaf wrote: »
    Am trying to upload the charts I am using...

    Attachment not found.Attachment not found.



    [note charts are from: I believe those charts are from Home Power #36, August- September 1993. Lead-Acid Battery State of Charge vs. Voltage ©1993 Richard Perez.
    Here is a link:


    I don't quite a agree with the resting voltage line (I think the voltage is a bit low)--But it shows how to estimate a battery's state of charge while operating.

    Note, where the charts "flatten out"--the room for error estimating state of charge is pretty high.


    Near San Francisco California: 3.5kWatt Grid Tied Solar power system+small backup genset
  • jonrjonr Solar Expert Posts: 1,386 ✭✭✭✭
    Re: Arduino Load Control

    Thanks. Looking into it more, I'm tempted to use Lithium batteries. Especially with the high temperatures my situation has.

    I am available for custom hardware/firmware development

  • RandomJoeRandomJoe Solar Expert Posts: 472 ✭✭✭
    Re: Arduino Load Control

    What kind of charge controller are you using? You may be able to get a "charged" indicator from it in some way.

    For the fancy ones (such as my Outback FM-80) you could program an auxiliary relay to come on when it hits absorb or float, or perhaps even communicate with it.

    My Morningstar MPPT controller has three LEDs for charge state, could wait for the "full" LED to be on.

    Even some simpler controllers may give a usable output - I have a couple small Morningstar controllers that only have a single LED. Off at night, steady-on for "bulk", flashing for absorb/float. Since it doesn't distinguish between absorb and float, you'd have to time it - perhaps start a timer when it begins flashing and switch on loads after an hour or two.

    If you have enough solar panels to run the inverter AC directly, it may be desirable to add a DC current sensor to monitor amps in/out of the battery. (Or pull that info from the CC or BMS if you can communicate to it.) You'll know roughly what your AC draws, and can make sure you don't draw down the battery too much.

    I do this - though all my kit is communicating / networked together - with a mini-split in the back room. Once the system drops to float the mini-split is powered and it controls to its own thermostat. If the sky clouds up (amps-in drops below amps-out) I let it run for 15 minutes in case it's temporary, then shut off the AC. In my case it's an old-style compressor so about 1500W running. That's right at the limit of my solar array, with the other usual household loads, so any reduction in power (overcast, blowing dust, dirty panels) starts using battery power. I'd love to get an inverter AC unit that I could control to run higher/lower to match available surplus power, but can't justify the expense since the current unit works well enough.
  • jonrjonr Solar Expert Posts: 1,386 ✭✭✭✭
    Re: Arduino Load Control
    RandomJoe wrote: »
    it may be desirable to add a DC current sensor to monitor amps in/out of the battery.

    Is there an off-the-shelf or easy to implement (say Arduino + source code) SOC monitor that will turn my inverter off when state of charge gets too low? I don't mind opening the inverter and wiring a relay to the on/off switch.

    I am available for custom hardware/firmware development

  • jonrjonr Solar Expert Posts: 1,386 ✭✭✭✭
    Re: Arduino Load Control

    I finally got around to implementing such a controller. To recap, my problems were a) the inverter would allow battery voltage/SOC to drop too far before shutting down (bad for the batteries) and b) once it turned off, it would never come back on. So now an arduino monitors battery voltage and turns the inverter off at the right voltage and then back on when it rises.

    The application is dehumidification of a shipping container.

    I am available for custom hardware/firmware development

Sign In or Register to comment.