Ancestors

Toot

Written by jaseg on 2025-01-16 at 11:02

With @sad_electronics and others discussing funky switching regulator circuits in another thread, I was reminded of something I’ve been wanting to try for a while now: Take a small microcontroller such as STM32G030 and make it a switching regulator with as few external components as possible.

=> More informations about this toot | More toots from jaseg@chaos.social

Descendants

Written by jaseg on 2025-01-16 at 11:03

I know that other people have done this before and that there are manufacturer application notes on this because it has legitimate applications in high-power converters that need complex, custom control loops. I still kind of want to try it myself.

=> More informations about this toot | More toots from jaseg@chaos.social

Written by jaseg on 2025-01-16 at 11:05

This idea has a similar vibe to @janamarie deciding to use an STM32 as an IO expander in a thread last weekend. It would be a neat challenge to take a schematic and just see if you can replace every chip with a microcontroller somehow 🤣

=> More informations about this toot | More toots from jaseg@chaos.social

Written by Jana on 2025-01-16 at 11:13

@jaseg I've used STM32's before as switching regulators 😬 (actually my first STM32 project was all about this). I can highly recommend to look at their HRTIM, up 5.6GHz "clock" with 16bit timer depth and good analog peripheral interconnect allows for >Mhz PWM output with a fairly high resolution, current and voltage measurement and control, and even overcurrent break inputs

=> More informations about this toot | More toots from janamarie@chaos.social

Written by Marcus Müller on 2025-01-16 at 11:12

@jaseg I'd say go for it. I'd probably start with an stm32g* that has a hardware comparator built in, just to have an easy way to be sure you react in time to overcurrent, but other than that: not that hard. (I mean, the hard part is the robust yet nimble control loop design, and hm, you'd probably just test that with a PRNG-switched load as test and fiddle an IIR as loopback filter until you get good behaviour.)

=> More informations about this toot | More toots from funkylab@mastodon.social

Written by Cato, registered Lynx Ⓛ on 2025-01-16 at 11:04

@jaseg @sad_electronics I guess that would just involve a voltage divider (maybe not even that) for feedback to the ADC and a gate driver (maybe not even that)? Or is that too naive :D

(and of course the power components)

=> More informations about this toot | More toots from cato@chaosfurs.social

Written by jaseg on 2025-01-16 at 11:09

@cato @sad_electronics I think it depends on input and output voltage ranges. For Vin > 3.3V, you’d need at least an external pass transistor and inductor, but for Vout < 3.3V you could use the ADC without divider for feedback. For VIN <=7ish volts, you’d could use the STM32’s “5V-tolerant” IOs for synchronous rectification, saving you a diode or mosfet for the low side. For VIN <=3.3V, you’d could also use an IO instead of a pass transistor (at least for loads up to a few dozen or so milliamps)

=> More informations about this toot | More toots from jaseg@chaos.social

Written by Manawyrm | Sarah -> FOSDEM on 2025-01-16 at 11:08

@jaseg @sad_electronics especially the G chips with those motor controller peripherals/high-res timers should be pretty ideal. Definitely 1000x better than ATmega8‘s 😹🤭

=> More informations about this toot | More toots from manawyrm@chaos.social

Written by jaseg on 2025-01-16 at 11:12

@manawyrm @sad_electronics yeah, they even specifically advertise the high-res timer for such applications. A not so fun detail I found out a while ago is though that the high-res timer is really only there in the G474 and G484 chips specifically. All other G series parts or those of other series either lack the peripheral altogether, or have a cut-down variant that is not actually high-res (e.g. H5/H7).

=> More informations about this toot | More toots from jaseg@chaos.social

Written by Chip on 2025-01-16 at 17:29

@jaseg @sad_electronics I feel like as soon as they started putting comparators in microcontrollers they were begging us to do this. 😄

=> More informations about this toot | More toots from bytex64@awesome.garden

Written by Lukas on 2025-01-16 at 18:45

@jaseg @sad_electronics I've built two or so boost converters using an AVR as a PWM controller. The control scheme was pretty dumb:

if adc reading > setpoint

pwm--;

else

pwm++;

Maybe with some added hysteresis. Worked surprisingly well since the load was just a bunch of LEDs in one instance.

=> More informations about this toot | More toots from karotte@chaos.social

Written by fruchti on 2025-01-17 at 06:20

@jaseg I built a few with different small microcontrollers. I’ve always found them pretty finnicky to get stable (might be mostly the small duty cycle resolution). And loop tuning in software is nowhere near as fun as in hardware, at least for me :blobEngineer:

=> More informations about this toot | More toots from fruchti@twoot.site

Proxy Information
Original URL
gemini://mastogem.picasoft.net/thread/113837695374634981
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
327.501357 milliseconds
Gemini-to-HTML Time
4.106605 milliseconds

This content has been proxied by September (3851b).