Hacking SMPS to work as a programmable car battery charger - Page 1
Forum section: electronics / projects

author: miceuz
author_rank: Frequent Contributor
timestamp: June 29, 2014, 05:56:16 pm
content: I have several 40A 12V chinese SMPS that are based on UC3525 controller. My idea is this: if I replace existing feedback to UC3525 with a DAC, add a micro to measure output voltage/current and controll the DAC implementing a proper lead acid battery charging algorithm - will Bob be my uncle?Has anybody tried to do something like this - taking over existing SMPS controller with a micro? What could go wrong?

author: theatrus
author_rank: Frequent Contributor
timestamp: June 29, 2014, 06:17:03 pm
content: If you are feeding a fixed voltage into the feedback pin you have by definition removed all feedback.You want to change the ratio at the feedback pin. An opamp could be used.

author: miceuz
author_rank: Frequent Contributor
timestamp: June 29, 2014, 06:36:09 pm
content: Quote from: theatrus on June 29, 2014, 06:17:03 pmI would not feed a fixed voltage, I'd have the microcontroller to servo this feedback voltage to achieve desited voltage or current on the output.

author: NiHaoMike
author_rank: Super Contributor
timestamp: June 30, 2014, 01:46:44 am
content: Just tweak the output voltage up to 13.8V or 14.4V (depending on whether you want a float charger or quick charger) and lower the current limit.

author: Psi
author_rank: Super Contributor
timestamp: June 30, 2014, 01:56:00 am
content: If you want a charger with programmable current limit you cant beat the hobbyking/turnigy RC chargers for like $25

author: johansen
author_rank: Super Contributor
timestamp: June 30, 2014, 02:44:14 am
content: the problem is the 2.5 volt referance is internal to the chip, if i recall correctly. read the datasheet.you might have to use a variable resistor, or some kind of variable gain opamp.

author: Richard Head
author_rank: Frequent Contributor
timestamp: June 30, 2014, 06:11:44 am
content: Leave the feedback loop intact and replace the existing reference with the DAC output.In that way you don't upset the feedback compensation at all.

author: AlanR
author_rank: Regular Contributor
timestamp: June 30, 2014, 07:08:14 am
content: About 90% of the switch mode power supplies I have seen, use the jelly bean TL431 voltage reference as an error amplifier for correct output voltage. Look for the resistor divider that is connected to the ref pin of the TL431 to play around with that to make the output voltage different. Another idea you can try is just remove all the components that are associated with the TL431 and interface directly to the optocoupler with a DAC output of your Uc and then use an ADC input of the Uc to read output voltage. If you want bulk charging also, then insert a small resistor as a current sense element interfaced to a differential amplifier that you send the output of into another ADC input of the Uc or you can use a fully integrated hall effect sensor such as the 77X series from Allegro Microsystems that you can interface directly to the Uc if you pick one that has a good mV/amp ratio. I like to use the 80mv/amp version which is the ACS770. Finally, you will need to know the minimum current transfer ratio of the optocoupler, which is usually the jelly bean PC817 optocoupler that is made by Sharp Electronics.My only issue is, can you program in a "software filter" algorithm that mimics active filters and also mimics an integrator? Because they usually wire up the TL431 as a type 2 compensator that acts as an integrator at low frequencies and low pass filter at high frequencies.

author: miceuz
author_rank: Frequent Contributor
timestamp: June 30, 2014, 09:32:10 am
content: UC3525 has internal 5.1V reference and an error amplifier with both inputs accessible. I didn't have an opportunity to trace the schematics of my SMPSU yet, but I like the idea of patching into reference line instead of the feedback.I'm comfortable with writing digital filters and PID controllers and the battery presents a slow well behaved load, so in the worst case I expect to just slow the loop down to crawl.

author: Richard Head
author_rank: Frequent Contributor
timestamp: June 30, 2014, 12:01:42 pm
content: With a micro and DAC you can incorporate many very nice functions such as a voltage boost function (with timer) for deeply discharged batteries.Also, float voltage temperature compensation can be easily incorporated if you want to get fancy.Dick

author: AlanR
author_rank: Regular Contributor
timestamp: June 30, 2014, 12:27:03 pm
content: Quote from: Richard Head on June 30, 2014, 12:01:42 pmIf the charger is going to be a 2 or 3 stage design, then voltage boost (maybe for voltage compliance of the current source mode) is not necessary because bulk charging stage is always a current source until some voltage point is reached, and then the charger switches to constant voltage mode for absorption phase until current tapers, which it will then either shut off off for two stage or switch to trickle charge for 3-stage design.

author: dannyf
author_rank: Super Contributor
timestamp: June 30, 2014, 12:35:30 pm
content: Usually the error amplier in those things is a tl431 plus led.either way, it's doable but you need to trace out the board to see how it works.

author: peter.mitchell
author_rank: Super Contributor
timestamp: June 30, 2014, 01:14:51 pm
content: Quote from: Psi on June 30, 2014, 01:56:00 amAnd they're capable of running as a buck or boost converter, so you can quick charge a battery from 12v or from 18v. Good value for money.

author: miceuz
author_rank: Frequent Contributor
timestamp: June 30, 2014, 02:07:51 pm
content: As far as I know, for deeply discharged batteries you want to be gentle at first until at least ~11V is reached and only then hit it with bulk charge current. At least that's what the batteryuniversity says.

author: Richard Head
author_rank: Frequent Contributor
timestamp: July 01, 2014, 05:27:56 am
content: The boost (also known as equalise) phase is to balance all cells (or blocks) of a series string. After several charge/discharge cycles some cells state-of-charge start to differ from others. The equalise charge (boost) simply ensures that all cells are all fully charged. Also, flooded cells require slightly different treatment to AGM/VRLA designs.

author: ConKbot
author_rank: Super Contributor
timestamp: July 01, 2014, 12:41:15 pm
content: I wouldnt put an ADC/micro/DAC *in* your feedback path for the SMPS ic, definitely asking for trouble, as your bandwidth will be pretty limited. Yes there are lots of microcontroller based battery chargers, since your load isnt changing rapidly, but if you can make your output voltage nice and stable because youre using an SMPS ic, why throw that awayWhat you can do is use the DAC and and a resistor network to pull the feedback up or down to lower or raise your output voltage. That way your control loop which pulls the voltage up and down can be quite slow compared to the SMPS feedback. One way to do it would be to replace the GND leg of the feedback divider with a divided down and buffered output from your DAC.

author: miceuz
author_rank: Frequent Contributor
timestamp: September 15, 2014, 08:21:22 am
content: I have finally got around to try this. The PSU had a pot designed to fine-tune the output voltage. After tracing out the schematics I've understood that all I have to do is to inject voltage instead of this pot. Had to alter the output voltage divider to get a bit more range. All in all, for now I can controll output voltage from a microcontroller via two stage PWM+RC DAC.

author: Richard Head
author_rank: Frequent Contributor
timestamp: September 15, 2014, 09:11:45 am
content: That's what I said in my post.Leave the feedback loop intact and replace the existing reference with the DAC output.

author: miceuz
author_rank: Frequent Contributor
timestamp: September 15, 2014, 11:30:46 am
content: yeah, don't get me wrong, I value your input, but I'm not touching the feedback loop at all (except for a slight resistor R29 change) - I'm feeding my input into R22 by replacing the potentiometer.Why chinese engineers have used a separate LM358 instead of and internal error amp of UC3525 is beyond me.

author: Richard Head
author_rank: Frequent Contributor
timestamp: September 15, 2014, 01:02:39 pm
content: miceuzTheir circuit is *&$# up I think. At DC the total gain is the sum of the two op-amp gains (106dB+106dB = 212dB!)I have no explanation as to why they have two op-amps other than they don't really know what they are doing. The loop compensation for voltage mode control can be easily acccomplished with the internal op-amp. But the fact that they are still using voltage mode control in this day-and-age is probably indicative that the circuit has been adapted for use from another ancient design.