Author Topic: Hacking SMPS to work as a programmable car battery charger  (Read 7729 times)

0 Members and 1 Guest are viewing this topic.

Offline miceuzTopic starter

  • Frequent Contributor
  • **
  • Posts: 387
  • Country: lt
    • chirp - a soil moisture meter / plant watering alarm
Hacking SMPS to work as a programmable car battery charger
« on: June 29, 2014, 05:56:16 pm »
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?

Offline theatrus

  • Frequent Contributor
  • **
  • Posts: 352
  • Country: us
Re: Hacking SMPS to work as a programmable car battery charger
« Reply #1 on: June 29, 2014, 06:17:03 pm »
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.
Software by day, hardware by night; blueAcro.com
 

Offline miceuzTopic starter

  • Frequent Contributor
  • **
  • Posts: 387
  • Country: lt
    • chirp - a soil moisture meter / plant watering alarm
Re: Hacking SMPS to work as a programmable car battery charger
« Reply #2 on: June 29, 2014, 06:36:09 pm »
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.

I 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.

Offline NiHaoMike

  • Super Contributor
  • ***
  • Posts: 9180
  • Country: us
  • "Don't turn it on - Take it apart!"
    • Facebook Page
Re: Hacking SMPS to work as a programmable car battery charger
« Reply #3 on: June 30, 2014, 01:46:44 am »
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.
Cryptocurrency has taught me to love math and at the same time be baffled by it.

Cryptocurrency lesson 0: Altcoins and Bitcoin are not the same thing.
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 10174
  • Country: nz
Re: Hacking SMPS to work as a programmable car battery charger
« Reply #4 on: June 30, 2014, 01:56:00 am »
If you want a charger with programmable current limit you cant beat the hobbyking/turnigy RC chargers for like $25
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline johansen

  • Super Contributor
  • ***
  • Posts: 1090
Re: Hacking SMPS to work as a programmable car battery charger
« Reply #5 on: June 30, 2014, 02:44:14 am »
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.
 

Offline Richard Head

  • Frequent Contributor
  • **
  • Posts: 685
  • Country: 00
Re: Hacking SMPS to work as a programmable car battery charger
« Reply #6 on: June 30, 2014, 06:11:44 am »
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.
 

Offline AlanR

  • Regular Contributor
  • *
  • Posts: 50
Re: Hacking SMPS to work as a programmable car battery charger
« Reply #7 on: June 30, 2014, 07:08:14 am »
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.

« Last Edit: June 30, 2014, 07:44:04 am by AlanR »
 

Offline miceuzTopic starter

  • Frequent Contributor
  • **
  • Posts: 387
  • Country: lt
    • chirp - a soil moisture meter / plant watering alarm
Re: Hacking SMPS to work as a programmable car battery charger
« Reply #8 on: June 30, 2014, 09:32:10 am »
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.

Offline Richard Head

  • Frequent Contributor
  • **
  • Posts: 685
  • Country: 00
Re: Hacking SMPS to work as a programmable car battery charger
« Reply #9 on: June 30, 2014, 12:01:42 pm »
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
 

Offline AlanR

  • Regular Contributor
  • *
  • Posts: 50
Re: Hacking SMPS to work as a programmable car battery charger
« Reply #10 on: June 30, 2014, 12:27:03 pm »
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

If 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.

 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: Hacking SMPS to work as a programmable car battery charger
« Reply #11 on: June 30, 2014, 12:35:30 pm »
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.
================================
https://dannyelectronics.wordpress.com/
 

Offline peter.mitchell

  • Super Contributor
  • ***
  • Posts: 1567
  • Country: au
Re: Hacking SMPS to work as a programmable car battery charger
« Reply #12 on: June 30, 2014, 01:14:51 pm »
If you want a charger with programmable current limit you cant beat the hobbyking/turnigy RC chargers for like $25
And 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.
 

Offline miceuzTopic starter

  • Frequent Contributor
  • **
  • Posts: 387
  • Country: lt
    • chirp - a soil moisture meter / plant watering alarm
Re: Hacking SMPS to work as a programmable car battery charger
« Reply #13 on: June 30, 2014, 02:07:51 pm »
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.

Offline Richard Head

  • Frequent Contributor
  • **
  • Posts: 685
  • Country: 00
Re: Hacking SMPS to work as a programmable car battery charger
« Reply #14 on: July 01, 2014, 05:27:56 am »
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.   
 

Offline ConKbot

  • Super Contributor
  • ***
  • Posts: 1397
Re: Hacking SMPS to work as a programmable car battery charger
« Reply #15 on: July 01, 2014, 12:41:15 pm »
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 away ;)  What 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.
 

Offline miceuzTopic starter

  • Frequent Contributor
  • **
  • Posts: 387
  • Country: lt
    • chirp - a soil moisture meter / plant watering alarm
Re: Hacking SMPS to work as a programmable car battery charger
« Reply #16 on: September 15, 2014, 08:21:22 am »
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.

Offline Richard Head

  • Frequent Contributor
  • **
  • Posts: 685
  • Country: 00
Re: Hacking SMPS to work as a programmable car battery charger
« Reply #17 on: September 15, 2014, 09:11:45 am »
That's what I said in my post.

Leave the feedback loop intact and replace the existing reference with the DAC output.

 

Offline miceuzTopic starter

  • Frequent Contributor
  • **
  • Posts: 387
  • Country: lt
    • chirp - a soil moisture meter / plant watering alarm
Re: Hacking SMPS to work as a programmable car battery charger
« Reply #18 on: September 15, 2014, 11:30:46 am »
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.

Offline Richard Head

  • Frequent Contributor
  • **
  • Posts: 685
  • Country: 00
Re: Hacking SMPS to work as a programmable car battery charger
« Reply #19 on: September 15, 2014, 01:02:39 pm »
miceuz

Their 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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf