Author Topic: DIY Digital Power Supply design idea recommendation  (Read 1468 times)

0 Members and 1 Guest are viewing this topic.

Offline Eldi4Topic starter

  • Contributor
  • Posts: 41
  • Country: id
DIY Digital Power Supply design idea recommendation
« on: April 17, 2021, 05:53:32 am »
Hello, newbie electronic hobbyist there.

I've been trying to building DIY digital power supply for my electronic lab, and also for some learning experiences.
I aim 0 to 20V output, non-isolated dual channel with maximum total 5A, CC/CV.
For the first version i used STM32F103C8T6 for the MCU, a low-pass filter for the DAC that drives output transistor, a current shunt with TL084 for current sensing, and a 24V 6A power supply for the main supply.
The first version failed pretty miserably, with 24V single-supply, the current sensing TL084 did'nt work properly (i'm not even testing or simulating it beforehand, doh!). The MCU died several times because the amp might output more than 3.3V to the ADC. the MCU had some speed problem with the interrupt loop, i aimed for 50kHz loop but ended up getting 20kHz, but probably 20kHz loop might be better though, because higher frequency might introduce instability, oscillation and stuffs.
And then after that, i decided to use the raw output of the 0.1 ohm shunt resistor, and while i was still working the code, accidentally short circuit-ed the output also kill the MCU, so i added adc protection with two diode, but probably because my diode had pretty high reverse leakage current, it kind of messed up with the ADC reading, but meh i think it's better than getting my MCU fried everytime.
And for some reason sometime, turning on the supply might kill the MCU, so i added soft-starter with RC circuit mosfet and relay.
And at last, it does work but the power supply chassis is just full of mod wires and stuffs that added later on that i did'nt even think of, like MOSFET fan switches, buzzer driver because i didn't have active buzzer at a time and did'nt want to load MCU, the soft-starter relay, and other stuffs. I can't really measure the overall performance of the power supply like the noise or ripple, short circuit or current limit response time, oscillation, and stuffs because i don't have oscilloscope there, but i think it's baadd, sometime i can't power a laptop with this power supply, but for most of my other work it does just fine like powering mcu, testing electronics, charging batteries, i mean better than having no lab power supply at all  |O.

But because the inside chassis of my lab power supply is full of stuff that is dangling all around and really hard to clean, it recently killed the main power supply after just 4 month of operation because bare copper wire dropped and shorted something and killed my precious made in Japan 24V adaptor  :palm:.

So i decided to just rebuild everything from scratch. I plan to just order a pcb and had a proper connector for every component outside PCB so that no one get dangling and no more bare wire dropped incident.
This time i plan to use LM324 on current sense with +5V and -5V supply, the LTSpice simulation seems good and the output nicely clamp itself to around 3.5V at extreme current cases, so no more fried MCU, but i haven't tested it yet. the negative rail is generated by MC34063 by inverting the 7805 output. and apparently just using voltage divider at positive output will give inaccurate result because voltage drop of shunt resistor, so this time i plan to use differential amp LM324 (+-5V supply, so offset voltage did'nt interfere) with gain lower than 1 to feed the voltage sense ADC.
And remove 10nF cap on output of amp because i just read from STM32 ADC guide, C(ext) will just slow down the sampling. probably keeping STM32F1 as MCU.

I attached the first version of the schematic, because next version is full of mod hence no eagle schematic at all.
I decided to remove the dummy load functionality because it will just load the MCU more. it had a lot of revision on I/O of MCU, like the upside down TIP41C that drive buzzer and fan, added CC/CV LED indicator, changed 7805 to buck converter because it burns with 24V input, and more.

I will base the rebuild from previous build, so i want recommendation or critics on my design, or probably reference to other digital power supply design, mainly software or MCU, hardware is fine but here in my place it is pretty hard to get wide range of components, so i prefer really widely available component for every components, like MC34063, LM324, TL074, ATMega, STM32F1, AMS1117, 7805. Aside from that, i also have really limited budget, like 20$ only.

Thank you for the attention, i'm sorry if i had english error.
« Last Edit: April 17, 2021, 06:13:29 am by Eldi4 »
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14155
  • Country: de
Re: DIY Digital Power Supply design idea recommendation
« Reply #1 on: April 17, 2021, 06:28:47 am »
With 24  raw voltage and 5 A max. it gets tricky with a single power transistor. Not impossible with a really high power one (e.g. MJ15003), but needs a good heat sink.
Aiming for only 20 V is good, but 5 A is rather high for a 1st try. There is less magic smoke at 1-2 A.

For protection there should be a reasonable fast current limiting. The µC and than control via a PWM + fitlering DAC is not sufficient for this.
So there should be some analog current control loop.

For the regulator part it is a really good idea to similate up front (no need to include the PWM part).
The regulator usually needs at least some (e.g. 10 µF) capacitance at the output. It is really hard to get away without and still keep it stable even with an external cap added by the user.

There are a few designs out there, that could be used for inspiration. A main decision is if the output stage is designed as emitter follower (low impedance output) or current source. With only 20 V the emitter-follwer type can still work and may be slightly easier with the compensation.

For the DAC filters I would use a proper 3rd order sallen key version - it needs just one more R and C (extra feedback from the buffer output), but gives a steeper roll off.

The voltage regulator should compensate for the voltage lost at the shunt. Otherwiser the shunt at the low side is OK and a proven concepts. Of cause it does not work well with TL084, but more like LM324 (single supply).  While in principle OK, the cross over distortion of the LM324 / LM358 can cause some extra trouble in some designs. If SMD I would at least upgrade to MC33172/4. 
 

Offline Eldi4Topic starter

  • Contributor
  • Posts: 41
  • Country: id
Re: DIY Digital Power Supply design idea recommendation
« Reply #2 on: April 17, 2021, 07:07:09 am »
With 24  raw voltage and 5 A max. it gets tricky with a single power transistor. Not impossible with a really high power one (e.g. MJ15003), but needs a good heat sink.
Aiming for only 20 V is good, but 5 A is rather high for a 1st try. There is less magic smoke at 1-2 A.

My 2SC2922 with an overclocked AMD Processor fan at 20V are able to handle 5A though, if i remember correctly i have tested it by short circuiting the output at 5A, so the transistor is dissipating power around 100W, and still works fine after hours.

For protection there should be a reasonable fast current limiting. The µC and than control via a PWM + fitlering DAC is not sufficient for this.
So there should be some analog current control loop.

I just recently looked at some sophisticated digital power supply and all of them had this, but i don't have any idea on how to implement this though, i'm not a electronic engineer student so my knowledge is so limited. Any recommendation for analog control loop using widely available part like LM324?.

For the regulator part it is a really good idea to similate up front (no need to include the PWM part).
The regulator usually needs at least some (e.g. 10 µF) capacitance at the output. It is really hard to get away without and still keep it stable even with an external cap added by the user.

"Regulator" you mean here means the output of my power supply right?.
Did'nt adding additional capacitance on the output will slow down the loop?

There are a few designs out there, that could be used for inspiration. A main decision is if the output stage is designed as emitter follower (low impedance output) or current source. With only 20 V the emitter-follwer type can still work and may be slightly easier with the compensation.

The voltage regulator should compensate for the voltage lost at the shunt. Otherwiser the shunt at the low side is OK and a proven concepts. Of cause it does not work well with TL084, but more like LM324 (single supply).  While in principle OK, the cross over distortion of the LM324 / LM358 can cause some extra trouble in some designs. If SMD I would at least upgrade to MC33172/4.

I'm sorry but i don't really understand, mine is just transistor voltage regulator right?, what benefit do i get by changing my output stage?.
It fix the latter mentioned cross over distortion?, i'm sorry if i understand this incorrectly, but did it really matter on my design?, i have simulated with LTSpice the LM324 as current sense (non-inverting) and voltage sense (differential), and it did work fine on every range i wanted.
I try to compensate the voltage lost at the shunt by using differential amp to measure real voltage that is applied to load.

For the DAC filters I would use a proper 3rd order sallen key version - it needs just one more R and C (extra feedback from the buffer output), but gives a steeper roll off.
I see, steeper roll off means faster response right?
EDIT: Tested the sallen-key low pass filter, it does have steeper rise as seen on LTSpice simulation, but why does it has some spike at input transition?
« Last Edit: April 17, 2021, 07:27:07 am by Eldi4 »
 

Offline Jay_Diddy_B

  • Super Contributor
  • ***
  • Posts: 2733
  • Country: ca
Re: DIY Digital Power Supply design idea recommendation
« Reply #3 on: April 17, 2021, 09:56:49 am »
Hi Eldi4 and the group,

I have looked at your schematic and you have some issues with the low-side current sense resistors. Consider these cases:

Dummy Load connected to Power Supply




The current sense resistor in the power supply is shorted by the connection to the load.

Two Power Supplies




Here I have two loads, but there is a common connection at the load. The two current sense resistors are connected in parallel.

Schematic Error - Fan and Buzzer




Q1 and Q2 have the collector and emitter reversed. You need to a base resistor to each transistor.

Regards,
Jay_Diddy_B

 

Offline Eldi4Topic starter

  • Contributor
  • Posts: 41
  • Country: id
Re: DIY Digital Power Supply design idea recommendation
« Reply #4 on: April 17, 2021, 10:25:48 am »
Hi Eldi4 and the group,

I have looked at your schematic and you have some issues with the low-side current sense resistors. Consider these cases:

Dummy Load connected to Power Supply

(Attachment Link)


The current sense resistor in the power supply is shorted by the connection to the load.

Two Power Supplies

(Attachment Link)


Here I have two loads, but there is a common connection at the load. The two current sense resistors are connected in parallel.

Schematic Error - Fan and Buzzer

(Attachment Link)


Q1 and Q2 have the collector and emitter reversed. You need to a base resistor to each transistor.

Regards,
Jay_Diddy_B

Hello

As i have mentioned on the original post, i decided to remove the dummy load part entirely, that schematic is not the final version of my build, mainly because it was full of modifications, so it did'nt have any schematic.

Thanks for pointing the common gnd load in parallel though!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf