Author Topic: SMPS with constant current and constant voltage modes  (Read 332 times)

0 Members and 1 Guest are viewing this topic.

Offline profdc9

  • Regular Contributor
  • *
  • Posts: 223
  • Country: us
SMPS with constant current and constant voltage modes
« on: April 10, 2021, 02:47:10 am »
I have a project to construct a simple to build, reprogrammable battery charger that will preferably avoid using any exotic parts.   To do this, I have used the venerable TL494 chip because I was able to find some clear information on how to use it and it is super available and there are gazillions of clones of it.  I realize it has some severe limitations.  So I use the parts ATMEGA328P, TL494, and LM358, as these are all about as common as you can get.   I know of commercial solutions like the LT3741:

https://www.analog.com/en/technical-articles/power-supply-ensures-safe-charging-of-surpercaps-and-liion-batteries.html

but these are quite expensive at $10 apiece.

The TL494 is commonly used for constant voltage supplies such as ATX power supplies.  There are capacitors that hold the voltage of the output constant and so a buck converter with a reasonable switching frequency and with medium duty cycle can maintain a low-ripple variation at the output.  Typically these supplies when they sense overcurrent pull the dead time control line high with a SCR to shut down the supply until a power cycle occurs and so a constant current mode is not used.

My device uses a buck converter to convert from +24 VDC or so (like a laptop power supply) to a lower voltage, from 4 to 14 VDC.  If the buck converter is in constant voltage mode things are ok and the ripple is mostly dependent on the difference between the input and output voltages, with more ripple when the ratio of the voltages is higher.  But if one wants to try to deliver a constant current there is a problem when there is a large capacitor at the output to reduce ripple because the capacitor causes a large lag in the response of the current at the output because the capacitor must be charged and discharged.  When the current is too high the comparator is triggered and the duty cycle falls.  The large capacitance puts a significant lag in the compensation loop and therefore the ripple can be quite large, about +/- 200 mV or so depending on the ratio of input and output voltages, and there is about a 4-20 kHz oscillation in the output voltage.  I played around with the compensation on the voltage and current quite a bit and didn't see a huge difference.

The problem as I see it is that there is a fundamental issue with a constant voltage/constant current power supply, where a large capacitor at the output is needed to reduce ripple, but then prevents the constant current mode from regulating precisely.   This must also be common to linear supplies as well.  The LT3741 seems to solve this problem by switching rapidly (200 to 1000 kHz) and using a small capacitor (2 X 150 uF) at the output.

So now a few questions:

1.  Does some voltage ripple at the output on the order of 100 to 200 mV hurt charging batteries?  For example, a 4.2 V 1-cell or 12.6 V lithium iron battery with balancer?
2.  Since there is a microcontroller monitoring the charging, the constant current mode is there mostly to prevent a short circuit or some problem with the battery resulting in excess power being delivered.  It is also there so that in case the microcontroller crashes or otherwise fails to respond, the TL494 can independently prevent a short circuit from being a problem.   But if the microcontroller responds reasonably fast, say within 10 to 100 ms, and dials back the voltage so that the constant voltage mode is restored, or just shuts the charge down, would that be fast enough to avoid a problem?
3.  Is there some ingenious solution to this problem that I have missed in my internet searching?  I wonder for example if extra capacitance should be switched in and out with a MOSFET or relay when entering constant voltage mode and disconnected using constant current mode?

Anyways I know that I was advised against using the TL494 but it works certainly as a constant voltage supply and kind-of as a constant current supply.

I have the schematic and a picture of the device below.

 

Offline SuzyC

  • Frequent Contributor
  • **
  • Posts: 607
Re: SMPS with constant current and constant voltage modes
« Reply #1 on: April 10, 2021, 07:27:22 pm »
Most PC bricks have output voltages under 22 volts.

The Atmel chip you have chosen is also not a best choice because of its overly complex, poorly explained PWM setup.

Trying not to brag, but I know it is possible and I've designed a very good LI-ION charger design using only a low-cost single 8-pin PIC chip (12F1572) and a few external BJTs, a P-Chan power MOSFET, a 5.0V regulator,  and (of course), several other passive parts to create a step-down converter for charging, but omitting all the fancy displays and buttons, except for a single 7-seg ticker-tape display driven by a 8-bit shift-reg.

The 494, in the way you are using it, is not anywhere close to a good idea.
You don't need the 494 at all for your design to work well and to use this chip in the way you have used it in your design is IMHO(for lack of a better choice of words) very naive.

Instead, just use the PWM output of your MCU to control charging voltage(and thus current) by slowing increasing the duty cycle of the step-down convertor switch element. The MCU should be used to directly control the power switch element by PWM.

Consider this very important single idea in your design:

You can best control/set constant charging current by simply controlling charging voltage.

To achieve a constant current, it is only necessary for the MCU to continually adj.  the charging voltage.

To do this, the applied charging voltage is slowly brought up from zero to a perfect level to push, increase current flow into the battery to achieve the desired charging current.

As the battery voltage increases while slowly being charged, the MCU is always monitoring the charging voltage and current and it slowly adj's the (PWM dutycycle controlled) charging voltage to continually set the required charging constant current.

When charging cutoff voltage is reached and the batteries are nearly fully charged, the MCU code stops increasing the charging voltage and terminates charging when the charging current falls below a decided end-of-charge cutoff current.

This method allows the use of large filtering capacitors at the output of the buck switching regulator because voltage is always adj'd slowly up/down to set current.

In case of  severe overloads/short-circuits, the Dcyc is simply reduced to zero when a large overcurrent is detected.
« Last Edit: April 10, 2021, 08:18:59 pm by SuzyC »
 

Offline profdc9

  • Regular Contributor
  • *
  • Posts: 223
  • Country: us
Re: SMPS with constant current and constant voltage modes
« Reply #2 on: April 11, 2021, 03:40:18 am »
I thought it might be safer to use a SMPS controller rather than directly control it with the microcontroller because if the microcontroller crashes, the SMPS chip would continue to limit current.  This is especially the case if there is a short-circuit at the output and a fast reaction is needed to prevent the buck converter transistor from exceeding SOA.  It seems very tricky to me to implement a 100 kHz switching speed using a comparator on a microcontroller, and a higher speed would help reduce ripple.   A 50 cent, extremely common chip can take care of all of this fairly readily.  It seems like there could be a lot that could go wrong by using a microcontroller to directly generate the signal for a transistor unless that device is completely dedicated to the purpose, and is not doing anything else like displaying a user interface or communicating via UART which could cause timing problems or possibly a crash.

I intend to use constant voltage mode most of the time but the constant current mode is a fallback to safeguard against rapid failure.  In case the TL494 needs to be shut down immediately, I can pull the dead-time control line high with the microcontroller and the SMPS should instantly stop.  But I thought I should have a constant current protection so that the current is limited even if the microcontroller can not respond.

Are there any particular dangers you could identify for me to using the TL494 the way I used it?  I have been torturing the SMPS with short circuits and such and such and haven't had a problem yet.  I am concerned about ripple being dangerous for the battery.  I can get 100 to 200 mV of ripple when I force the device into constant current mode and the difference between the supply voltage and the output voltage is large.  Will this hurt a battery?  For example, lets say I'm charging a LiFEPO4 battery at 13.2 V with a 3 A limit, and for some reason the battery starts drawing more current and the microcontroller doesn't respond so there is ripple on the voltage output.  Could the ripple cause the battery to explode or damage the protection circuit / voltage balancer?

The problem with direct microcontroller control is that it seems that most devices aren't suited for rapid control (like cycle-by-cycle current mode control), simply modulating the PWM duty cycle  seems rather crude as the output voltage is related to the input voltage and so a fixed duty can't necessarily be used to generate a particular output voltage.  Using an external SMPS integrated circuit may be inelegant, but is there anything dangerous or wrong with it?

 

Offline SuzyC

  • Frequent Contributor
  • **
  • Posts: 607
Re: SMPS with constant current and constant voltage modes
« Reply #3 on: April 11, 2021, 10:15:03 am »
If a watchdog timer is  used by the MCU, a crash will activate the WDT and reset the MCU under any failure and, upon startup/reset, the MCU turns off the PWM/charging current.

If a simple cheap comparator of a  x4  comparator=(LM339) is used. and one of its comparators is configured to  set current limit, thereby set, always independently control the charging output max constant-current by inhibiting the switching element when reaching the setpoint/limit, then this makes a comparator an intrinsic part of an independent hardware external control loop, and if the MCU must turn up one of the comparator's section's inputs to adj. chargng current using PWM to set the output voltage to set current, then a MCU crash prevents failure  because the comparator is only setting output current by PWM, with a reset condition setting PWM=output current limit to zero.

In my design, one comparator is controlling the max charging current independent of the MCU, and the MCU is setting PWM dutycycle to control a second comparator to set charging current. So there is always a hardware fail-safe overcurrent limit and the MCU-controlled PWM setting charging current/current limiting of the charging circuit.

As an additional safeguard, the battery temperature can be monitored by a thermistor to detect charging time/over-current/overheating conditions and this can be done by external comparators independent of the MCU, and can shutdown the charging.

It is also simple tp add a secondary 8-pin MCU(also using WDT) to failsafe monitor charging to monitor and detect excessive charging time/inactivity,current/temperature/voltage and reset the primary MCU if an any out of normal condition is detected. This failsafe MCU will only shutdown charging, not control normal charging. This means both MCU's must crash at the same time to not detect and inhibit a problem  condition. In this way the stability/reliability of a MCU controlled charging circuit to very closely approached the safety of a dumb hardware-only charging manager chip to accomplish safe charging.

You seem to not yet understand that setting the instantaneous constant charging voltage output absolutely sets the desired constant current charging level. Voltage is controlling current. And any undervoltage charging output voltage reduces charging current drastically with only a tiny decrease of the charger output voltage setting. The MCU always needs to set output voltage to be a few mV higher than the battery, high enough to allow/push charging current to flow into the battery.
 

Offline PKTKS

  • Super Contributor
  • ***
  • Posts: 1023
  • Country: br
Re: SMPS with constant current and constant voltage modes
« Reply #4 on: April 11, 2021, 11:41:01 am »
As far as I could pick from your schematic...

You are driving a TL494 specifically designed to
work on a closed loop real-time controller...

With a MCU based PID interface... so what to expect?

- PID controllers are  by default lag devices
- they operate no matter what frequency by foreseen trends
- the more your bulk output (bigger bat) more lag it will have.

On the other hand.. a closed loop typical compensator operates
in real-time by instantaneous changes limited only by the error sampler
bandwidth - by design to setup the proper stable operation point..

Digital may seem tempting but as far as this crucial PID inherent
operation is concerned it can not be compared to real-time closed loops.

.. where TL494 was designed to operate within..

It works ... , kinda ... lag

Paul
« Last Edit: April 11, 2021, 11:43:04 am by PKTKS »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf