Help designing/building a monitored PSU with backup 24v SLA battery supply

rs2845

Senior Member
Hello all,


I'm currently in the process of rebuilding an alarm panel originally built with Picaxe chips. The power supply is one major area that I want to improve/get right this time.


I am feeding the entire project from a 48v 5A DC power supply. The alarm system is broken down in to smaller sections, where each section probably draws between 0.8-2A of current, but in total i'm sure it's less than 4.5A.


The 48v power supply voltage is dropped down to suitable voltages for specific parts:
48v In -> LM2596HV -> 24v out
24v In -> MP1584 -> 12v out (relays etc)
24v In -> MP1584 -> 5v out (Picaxe and other 5v IC's)
24v In -> MP1584 -> 5v out (Nextion HMI only)
24v In -> MP1584 -> 3.3v out (for 3.3v IC's)


I am going to use a Picaxe 18M2+ to monitor the voltages via divider circuits and Analog pins. Currently calculating the resistor combinations. No problems here.


I am wanting to add 2x 12v 7aH/12aH sealed lead acid batteries as a backup for when the mains fails.


I'd really appreciate some guidance and perhaps help designing the cheapest yet suitable and safe battery backup and charger circuit (I don't want an alarm starting a fire!) to kick in when the mains supply fails, in order to maintain 24v input to the other regulators- keeping my system alive.


I've found numerous guides detailing (see here) the use of an LM317 to make an independent charger- but I don’t know how to make the battery supply take over from the mains PSU and serve as the 24v supply. I guess the charger end might be taken care of with the above link...?

Concern 1: The LM2596HV is currently adjusted to output 24v when 48v is provided- I can't just attach the battery to this due to the output voltage dropping below 24v- so I need to prevent the battery voltage going backwards through this module and my mains PSU.

Concern 2: With the above link- It doesn't show if I can use the battery supply whilst connected but not actually charging.

Question: Has anyone accomplished battery backup from a primary mains supply with an LM317 or equivalent?


Looking forward to your help




Some nice features I'm wanting to add:

  • 18M2 needs to know when the mains supply is lost, and that batteries are being used. Could do this if the LM2596HV output ADC value is 0 and the LED's from the LM317 charger circuit feeding Picaxe inputs.
  • Battery voltage needs to be maintained and monitored via ADC (not sure if I do this in the same way as a standard DC supply)
  • Fuse on the battery line to prevent surges (never selected or used them before)
  • Fuses on the 48v and 24v supply as above (self resetting ones? - again, never selected or used one before)


Things I know:

  • How to program Picaxe confidently and write code.
  • Ohms law
  • Voltage dividers and ADC
  • Connecting batteries in series= double voltage, same current
  • Connecting batteries in parallel= double current, same voltage
  • C/10 as the current to trickle charge
  • Too deep discharge cannot be recovered from (though I'm not sure how deep that actually is)
  • When a battery is fully charged, the voltage drops slightly. Detecting this can help me stop doing a fast charge, but instead a trickle.
  • Possibly some other things
 
Last edited:

fernando_g

Senior Member
I would suggest the following;

48v or 24v in LM2596HV -> 12v out
The rest of the regulator selections is ok. I would go switcher all the way, but understand the requirement for simplicity and lower cost.

With respect to the "or" part: it can be as simple as a pair of diodes. I would use a regular diode for the 48 volt input, a schottky for the 24 volt.
If you want to extract the whole juice from the battery, you can always parallel a P-chan Mosfet with the schottky.

And yes, you can use the 48 volts to power your circuit AND re-charge the battery (as long as it can provide the total required current).

With respect to the battery charger............you can make it as simple or as complicated as you want. I would use an additional 08M or 08M2 as the brain to control the LM317 into a two-stage charger/battery monitor.
With the microcontroller, you could even adjust the charging voltage for temperature changes....not something many people do, but it helps get the extra mile from the battery both from the total capacity and lifetime.
Heck, you could even add battery-low alarms and cutoffs.
 
Last edited:

Jeremy Harris

Senior Member
I run all our household "always on" network stuff (ADSL router, switches, low power 12V DC file server, wireless router) on a 12V battery supply.

I've just done it very simply, with a constant voltage charger (set to 13.5V) that charges the battery from the mains during the day (it's on a time switch, and we have enough solar panels to be reasonably confident that we're generating power during the day). The battery feeds some efficient switched mode power supplies for the 5V supplies needed, and feeds the 12V DC server directly (it uses a "car computer" power supply). In total I draw around 1.5 A from the 100 Ah 12 V battery overnight, so use perhaps 18 to 20% of its capacity during the night (probably a lot less, as the server will be doing virtually nothing at night and the wireless router is turned off over night on another timer). There are no diodes, relays, power switches etc, As when the power is off the 10A, 13.5V switched mode supply I use as a charger doesn't draw any appreciable current.

For monitoring, I just have a LCD voltmeter on the box that houses the charger and power supplies, and that shows the battery voltage. It would be extremely easy to replace that with a Picaxe that monitored the battery voltage and gave a warning, or switched to an alternative power supply. In my case I've not bothered, as the aim was to be able to run the "vampire loads" of the server, router etc mainly from solar power, and also to have a way to maintain network connectivity during a power cut. I can run for around 36 hours on battery power alone without harming the battery, perhaps 48 hours or so if I keep the server load low.
 

fernando_g

Senior Member
A battery charger/monitor can be as simple or as complicated as one wants to do it. It all depends on performance/cost decisions.

Since we are in a Picaxe forum, I've always wanted to build a Picaxe-based smart battery charger/monitor. Or assist someone to do it.

There is a very good writeup on lead-acid battery charging algorithms. Those should be relatively straightforward to implement with a Picaxe, and some external power components to perform the heavy lifting.
http://batteryuniversity.com/learn/article/charging_the_lead_acid_battery
 

rs2845

Senior Member
Hi., thanks for your replies so far. Appreciate the help!

48v or 24v in LM2596HV -> 12v out
I do need a 24v supply (for as long as possible on battery) for the conventional sounder circuits. I’d like around 10-15 mins alarm mode on battery power and as long as possible when not in alarm (really happy with 24 hours).

With respect to the "or" part: it can be as simple as a pair of diodes. I would use a regular diode for the 48 volt input, a schottky for the 24 volt.

The “OR” part being the switchover from mains to battery and vice versa?
What would you consider a regular diode? 1N400x? What about the shottky?

What would such a switching circuit look like?

I run all our household "always on" network stuff (ADSL router, switches, low power 12V DC file server, wireless router) on a 12V battery supply.
Jeremy I am really intrigued to learn how you designed this, please could you provide some further info because I would want to replace the LCD screen with a Picaxe. I also feel I wouldn’t use much battery capacity when the alarm system is in normal operating mode. I’d be using much smaller batteries however (12v 7Ah or 12Ah).

A battery charger/monitor can be as simple or as complicated as one wants to do it. It all depends on performance/cost decisions.

...I've always wanted to build a Picaxe-based smart battery charger/monitor. Or assist someone to do it.

You’re more than welcome to help me, because I am keen to learn and understand how this would work and make the schematics available for all.


As a first version- I don't want to get overly ambitious as I am sure it's going to be a lot to learn. I really want the below provided that I can keep the BOM below £50- as a university student, money is in short supply!

• Voltage ADC reading for the 48v, 24v, 12v, 5v, 3v3 supplies
• Voltage and current reading for the batteries (individually or both batts together)
• Which supply mode is active- mains or batts?
• Ability to recharge the batteries whilst mains is active, where the charge voltage is controlled by the Picaxe (I have some Microchip MCP4261 I2C potentiometers, so could create a voltage divider adjusted via I2C?)
• Temperature logging and periodic EEPROM event logging will be implemented myself as I know how to do this
• Fuses on the batteries,
48v and 24v supply to protect the smaller regulators

In terms of components- I haven't got any LM317's or diodes other than the 1N4001's, so it'd take a few days to get the bits together.
 

rs2845

Senior Member
I also just found this Instructables project- a solar battery charger.

http://www.instructables.com/id/ARDUINO-SOLAR-CHARGE-CONTROLLER-Version-20/

My knowledge of and ability to design analogue circuitry is very little- so I wouldn't know how easy it is to replace the solar panel with my 48v DC supply and then adding in the other features like Picaxe control of the charger voltage. Most importantly- can this even work with 2x 12v batteries? The electrical characteristics mentions 10A max current and 12v max voltage..




Is it best to go with a barebones LM317 circuit, or use buck converters and mosfets like the Instructables guide?
 

rq3

Senior Member
Hello all,


I'm currently in the process of rebuilding an alarm panel originally built with Picaxe chips. The power supply is one major area that I want to improve/get right this time.


I am feeding the entire project from a 48v 5A DC power supply. The alarm system is broken down in to smaller sections, where each section probably draws between 0.8-2A of current, but in total i'm sure it's less than 4.5A.


The 48v power supply voltage is dropped down to suitable voltages for specific parts:
48v In -> LM2596HV -> 24v out
24v In -> MP1584 -> 12v out (relays etc)
24v In -> MP1584 -> 5v out (Picaxe and other 5v IC's)
24v In -> MP1584 -> 5v out (Nextion HMI only)
24v In -> MP1584 -> 3.3v out (for 3.3v IC's)


I am going to use a Picaxe 18M2+ to monitor the voltages via divider circuits and Analog pins. Currently calculating the resistor combinations. No problems here.


I am wanting to add 2x 12v 7aH/12aH sealed lead acid batteries as a backup for when the mains fails.


I'd really appreciate some guidance and perhaps help designing the cheapest yet suitable and safe battery backup and charger circuit (I don't want an alarm starting a fire!) to kick in when the mains supply fails, in order to maintain 24v input to the other regulators- keeping my system alive.


I've found numerous guides detailing (see here) the use of an LM317 to make an independent charger- but I don’t know how to make the battery supply take over from the mains PSU and serve as the 24v supply. I guess the charger end might be taken care of with the above link...?

Concern 1: The LM2596HV is currently adjusted to output 24v when 48v is provided- I can't just attach the battery to this due to the output voltage dropping below 24v- so I need to prevent the battery voltage going backwards through this module and my mains PSU.

Concern 2: With the above link- It doesn't show if I can use the battery supply whilst connected but not actually charging.

Question: Has anyone accomplished battery backup from a primary mains supply with an LM317 or equivalent?


Looking forward to your help




Some nice features I'm wanting to add:

  • 18M2 needs to know when the mains supply is lost, and that batteries are being used. Could do this if the LM2596HV output ADC value is 0 and the LED's from the LM317 charger circuit feeding Picaxe inputs.
  • Battery voltage needs to be maintained and monitored via ADC (not sure if I do this in the same way as a standard DC supply)
  • Fuse on the battery line to prevent surges (never selected or used them before)
  • Fuses on the 48v and 24v supply as above (self resetting ones? - again, never selected or used one before)


Things I know:

  • How to program Picaxe confidently and write code.
  • Ohms law
  • Voltage dividers and ADC
  • Connecting batteries in series= double voltage, same current
  • Connecting batteries in parallel= double current, same voltage
  • C/10 as the current to trickle charge
  • Too deep discharge cannot be recovered from (though I'm not sure how deep that actually is)
  • When a battery is fully charged, the voltage drops slightly. Detecting this can help me stop doing a fast charge, but instead a trickle.
  • Possibly some other things
It seems that you are grossly overthinking this. From what you say, nothing runs from, or really needs, the 48 volt or 24 volt supplies. They are strictly there for the purpose of stepdown to the voltages required for your circuits. Having said that, a lead-acid battery is very tolerant of charging voltage, and a simple high current diode from the 24 volt supply to two (2) twelve volt batteries in series would keep them nominally charged to about 85% capacity with no need to monitor the charging voltage, and zero chance of overcharging. They would simply float on the input 24 volts, and would be instantly available to provide back-up when the power fails. The diode would provide isolation to prevent the battery from reverse feeding the charging source when it fails.

There is so much head-room in voltage between your various supplies that it appears that trying to monitor each and every supply is pretty much pointless. Either they work, or they don't. Only the loss of the primary 48 volts can kill everything. Why would you need to know, or monitor, each and every stage of the voltage step-down process?

This looks like a job for one high current schottkey diode, feeding everything (including two 12 volt lead acid batteries in series) from your 24 volt supply. If you want to monitor that with a Picaxe ADC via a voltage divider, go ahead. Anything else is a waste of current. A well designed stepdown regulator (of any voltage), will far outlast the life span of your batteries on float charge at 24 volts, which will be decades.
 

Jeremy Harris

Senior Member
My system is really simple.

From the mains feed I have a battery-backed time switch (an immersion heater type) that switches an outlet on during the day and off at night. To that mains outlet I have a 10A, 12V switched mode power supply (from ebay) that is adjustable up to over 14V if need be (it has a +/-20% voltage adjustment, as almost all of these switched mode frame supplies do). I have it set for the sealed lead acid float voltage of 13.5 V, which never fully charges the battery, but also ensures that it never gets over-charged, which massively improves its service life.

The battery is a second-hand ex-computer server battery backup one, 12 V at 100 Ah, AGM, sealed lead acid. These are replaced every three or four years on big server farms, and have a ten year plus life if looked after, so there is still plenty of useful capacity in a three year old one that may well never have been cycled once, just held at float voltage. You can buy these from places that specialise in UPS stuff - I found a dealer around 20 miles away who had hundreds of them stored in a big warehouse, and was happy to sell some cheaply.

The supplies I need were +5 V to run the ADSL modem, two 8 port switches and a wireless router. The latter is switched off at night with a 12V DIN rail mount time switch, as we don't need wireless connectivity at night (the house is flood wired with ethernet cable, so almost all the connections are wired, except for a laptop and my wife's iPad). The file server is a small mini-ITX low power dual core Atom PC I built. It runs Linux, with a solid state drive for the operating system and a handful of hard drives for file storage and backup. It draws around 8 to 12 W when running hard, has no fans (so is silent) and can, at a push, be used as a desktop PC (it normally just runs as a server, though). It was built using "car computer" parts, so has an ATX power supply module that accepts 12 V from a battery and can cope with battery voltage fluctuations.

I discarded all the plug-in mains power supplies for the ethernet switches, ADSL modem, wireless router etc and made up new leads to power them from the small switched mode supplies in the charger.power supply box. These supplies are high efficiency ones, from China via Amazon or Ebay, but DEOK brand ones that I've found to be very good indeed. They are connected directly to the battery, so everything is always powered from the battery and all I switch (apart from the wireless router supply) is the charger on and off.

The charger can bring the battery back to "full" charge after around an hour two, following a 12 hour discharge overnight. I can manually over-ride the time switch if I wish, or switch all the loads off (as I have a switch between the battery and the load power supplies). For monitoring I just have an LCD voltmeter in the case, so I can see what the battery voltage is. In practice it drops to around 12.5V by early morning and is back to 13.5V within an hour or so of the charger kicking in.

If we get a power cut then everything keeps working (handy, as we can still use the laptop and iPad during power cuts) and as long as the power doesn't stay off for too long (more than a day or so) the system stays working as normal. Any longer than that and I would probably intervene and start switching things off when not in use to give us the ability to have connectivity when we need it.

I may well build a Picaxe to monitor the battery and provide a more intelligent display, and, perhaps, some non-essential load-shedding capability, at some point, as what I have was knocked together quickly really just to see if it would work. It does, so I've not had the incentive to change it.
 
Last edited:

rs2845

Senior Member
@rq3 - yes there's headroom. It's the only reliable mains PSU I have. I don't care if I'm not using all the voltage. I'll use what I need.

The fact I'm monitoring additional supplies is because I want to be alerted to issues with supplies BEFORE things shut down and cause havoc with the other system areas.

Not monitoring 24v = Sounders don't operate!!
Not monitoring 12v = critical switching to other systems not working!!
Not monitoring 5v = ALL 5v (Picaxe) processors shut down, the screen stops, flash memory stops.
Not monitoring 3v3 = most critical PIC32 chips stop!!

What you might think is "grossly overthinking" is smart thinking in my opinion. What sense is there to just hope for the best and blindly assume the smaller voltages are being supplied- just because the 48v is there?

Many other alarm systems I've looked at have very advanced diagnostics menus detailing even more voltages of specific system areas. I've cut down to what I need.
 

rq3

Senior Member
What you might think is "grossly overthinking" is smart thinking in my opinion. What sense is there to just hope for the best and blindly assume the smaller voltages are being supplied- just because the 48v is there?
So monitor them, and take appropriate action. My point was that a back-up lead acid charger is as simple as a diode from the 24 volts. Nothing more is needed. The more "stuff" you add, the lower the MTBF. You can have simple and reliable, or you can have complex and relatively unreliable. Pick one.
 

fernando_g

Senior Member
If your Picaxe has enough spare A/D ports that you are not using anywhere else, a pair of resistors on each will easily allow you to monitor higher voltages, whereas the lower voltages may be wired directly to the port....so why not?

Of course, 100 people will have 100 different answers to solve a particular problem. That is OK, diversity is part of the human condition. The key is to take different opinions, give them a little thought and decide which one you like and is within your budget.

I can sketch you a simple, two stage charger. No obligation.
If you want to use it, fine with me. If you would like to modify it, fine. If you find a better option, that is also fine with me.
 

rs2845

Senior Member
If your Picaxe has enough spare A/D ports that you are not using anywhere else, a pair of resistors on each will easily allow you to monitor higher voltages, whereas the lower voltages may be wired directly to the port....so why not?

Of course, 100 people will have 100 different answers to solve a particular problem. That is OK, diversity is part of the human condition. The key is to take different opinions, give them a little thought and decide which one you like and is within your budget.

I can sketch you a simple, two stage charger. No obligation.
If you want to use it, fine with me. If you would like to modify it, fine. If you find a better option, that is also fine with me.
Thank you, that would be really great, provided it's not too much trouble. It'd be a great place to start and build onto
 

fernando_g

Senior Member
As I mentioned previously, 100 poster will have 100 different ideas how to skin a cat. This is only one of them.
It is also only a sketch, a revision 0.1, it will for sure require further refinement.

Essentially I took the LM317 circuit you had previously posted, with the parameters you had originally requested, and included features which can be implemented with a Picaxe.
Please refer to the graph in the battery university web page I had attached earlier.

The Picaxe would have to perform the 3 stage charging algorithm:
1) Command the E-pot for minimum voltage. Measure the charging current. If the battery was completely discharged, the current might be above 1 amp. Do nothing. The LM317 is self limiting. This condition will remain this way for a few moments.
2) A little later, as the battery replenishes and the current drops below 1 amp, re-adjust the output voltage until the 1 amp charging current is reached again. Keep measuring and adjusting the voltage to maintain the current level. You are at stage 1, constant current charge.
3) There will be a point where the E-pot is completely maxed out (at 28 volts) and the current nevertheless starts to decrease. You are at stage 2, topping charge.
4) Eventually the current will drop to less than 100 mA. The battery is fully charged now, the voltage must be reduced to 26 volts. You are now at stage 3, float voltage.

Besides the charging algorithm, you may have the Picaxe to display the actual battery voltage and current.

There are a few things about this circuit which I don't like:
1) The power dissipation is humongous. At full load, there will be about 36 watts between the power resistor and the LM317. That is a lot of heat to be dissipated.
2) Because of the limited value selection for E-pots, and because the resistor between output and adjust has a maximum recommended value, the total adjustment range is quite limited, I would have liked to have twice as much.
3) The lowest range for the low cost AC712-series current sensors, is 5 amps. With 1 amp we are thus only employing 20% of the available resolution.

There may be other pitfalls that I'm sure the B&B here will spot immediately.

View attachment charger_20160829_0001.pdf
 
Top