
Machinist
@Machinist@lemmy.world
- Comment on PWM resolution for switch mode power supplies. 1 week ago:
Why make this harder? A constant frequency simplifies the analog design
I wasn’t planning on variable frequency, you were speaking to the influence of frequency on voltage output earlier. I just meant that I could vary the frequency without messing up synchronization of the waves. I.E. I can produce two square waves of arbitrary duty and frequency up to 625kHz. The higher the frequency, the less resolution I have, however.
Anyhow, the output will be filtered with at least some fat caps. My load is a static resistance (heating element). I could probably drive this thing with a 555.
As far as I know, the Atmega328, at least, can’t use the ADC to bypass the CPU and directly set the timer registers. The ADC can throw an interrupt and then the CPU sets the timer. When your pwm frequency is sub 100kHz, there is plenty of time to change the duty.
I don’t know that I will need to vary the duty with logic. It’s just an idea I had that seemed neat. Quick coarse adjustment and then a fine tuned adjustment.
I’m teaching myself about SMPS, and I’m curious. While the final circuit will have utility. I’m really learning how to use a scope, the newer AVRs, and switch mode power.
Everything has switch mode in it now, my vehicles, my arc welder, every chunk of electroincs pretty much. It’s treated like a black box, buy the chip, follow the data sheet. However, if you want to build or fix one from first principles, good luck. Most approachable reference I’ve found is the DC/DC Book of Knowledge by Steve Roberts. And even it assumes that you’ll mostly be using an ASIC.
Generally, I come up with an idea in electornics or programming that is novel to me, somebody else figured it out decades ago. That’s why I’m wondering what you call the minumum pwm resolution and whatever this fast dumb logic adjustment to duty is.
- Comment on PWM resolution for switch mode power supplies. 1 week ago:
I explained it poorly. The chip has an ADC that can operate in window mode. I. E. when my output voltage jitters high or low out of bound, I can use logic to very quickly effectively increase or decrease my duty cycle. (Actually substitute another pwm signal that is in pnase but with a larger or smaller duty)
5V square PWM from the ATtiny goes to a gate driver capable of several amps at 5V, that gate driver switches a pair of logic level MOSFETs, one of the MOSFETs switching the coil and the other acting as the recitfier. Topology is a synchronus inverting buckboost.
Changing the duty cycle then raises or lowers the voltage.
At the same time, via interrupt or event channel, the cpu starts calculating a new duty cycle and setting the timers. Interrupts may take 100 cycles. Whereas, pwm at 625kHz will have completed an additional three cycles before I can even start to modify the duty from the program.
None of this may matter. Static dumb resistive load, I could probably just about run my MOSFETs off a 555 and not even worry about feedback or regulation.
However, the idea is interesting to me. Quick response regulation with more precise regulation happening as the CPU catches up.
Seems like it would give you a flatter output.
I’ve found when I discover an interesting electronic or programming technique or problem, that usually means I don’t know the name. It’s usually something figured out decades ago and there are references and papers that explain it and consider angles that I didn’t know about.
- Comment on PWM resolution for switch mode power supplies. 1 week ago:
Gain bandwidth seems to be really analogous to what I’m trying to figure out. If I can’t find a version that is more digital/pwm specific: it will probably be easier for me to figure out what minimum resolution I need experimentally.
I’m looking at a constant frequency, variable duty drive as that seems the simplest. Also, the higher I can get the frequency, the less ripple I’ll have to deal with. However, there’s nothing really stopping me from doing variable frequency.
The timer I’m using is TCA. I haven’t tried it yet, but it allows buffered register changes. I.E. the registers where I’m setting my duty and period can be updated in sync with the waveform. So, in theory, I can vary my waveform frequency and duty cycle all over the place. I’ll actually be using two of these signals, the other will be for a mosfet in place of the rectifier diode. Dead spacing shouldn’t be any trouble.
I may even be able to use the programmable logic to combine 3 pwm signals into one per channel. I will have the spare internal outputs available.
I’m still kind of studying on this and probably need to draw a picture. Say you have 3 square waves that all have the same period. They are synchronized on the rising edge. 1st signal is 25% duty, second is 50%, and the third is 75%. Depending on what a comparator is reading, your logic selects which signal to output. 50% to maintain and the others to drop or raise the voltage.
So, if your voltage goes out of bounds, high or low, within a single clock cycle your square wave can be adjusted by some amount (25% amounts are just an example.) At the same time, your cpu begins grinding cycles to reset the buffers to adjust everything to a new duty center.
It would probably be a small amount of fast logic adjustment. At a guess, 10% or less.
I apologize if this is confusing and will draw it, if needed.
Any idea what that would be called?
- Comment on PWM resolution for switch mode power supplies. 1 week ago:
The period is divided up into 32 pieces, instead of a 256 bit width, if that makes sense. So, the frequency is 20mHz/32 = 625kHz. 0b100000 / 0x20.
Yeah, and with the load I’ll run, it’s not real critical. I just figure there has to be a name for this sort of tuning. If I know what it’s called, I can read up on it.
- Submitted 1 week ago to askelectronics@discuss.tchncs.de | 11 comments
- Comment on Driving a logic level MOSFET with an ATtiny 3224 3 weeks ago:
I’m looking at the FAN3224, a gate driver capable of several amps at 5V to run my MOSFETs. I’ll probably play with direct driving them with the ATtiny at first just to familliarize myself.
The original circuit is running some sort of bridge configuration. I’ve used a 1.6ohm load for years, with wattage set to 14.5 or 14.8. However, the orignal is capable 25w in the lowest output version. I’m not sure what resistance range it’s capable of pushing that 25w.
And, yes, the goal is to build a variable DC supply. I’m finding it really interesting. I’m looking at the synchronus inverting buckboost. I think my final version would use half the components of the original.
If I understand this stuff correctly, (real big if), with the convertor pushing negative voltage, I sidestep high side drive problems. My load is dumb resistance so it doesn’t matter how noisy or negative its power is.
So the ATtiny has an ADC capabale of running in windowed mode. A lot of the peripherals are able to run independently of the CPU, you can link them up with onboard programable logic called CLC. So, using logic I can tie the ADC to my PWM at pretty fast speeds. It also has a selection of internal voltage references. I’m planning to use some sort of voltage divider for feedback to the ADC, using the logic to vary my duty cycle when the voltage goes out of bounds.
Before I get that far out in the weeds, I need to play with mosfets, pwm, an inductor, and my new scope.
- Comment on Driving a logic level MOSFET with an ATtiny 3224 3 weeks ago:
Plan is for the ATtiny to actually mostly be asleep on the battery voltage. The 5V driver IC has an enable pin and goes into bypass mode when it’s not enabled. Only when it wakes up will it turn on the 5V.
I want the 5V for the 4.5V gates on my MOSFETs, the OLED display (IIRC, it will also run on 3.3V), and the 20mhz for PWM and ADC.
DC/DC convertor. I’m hoping I can make a synchronus inverting buckboost supply in the neighborhood of 25w/6V max.
- Comment on Driving a logic level MOSFET with an ATtiny 3224 3 weeks ago:
I’ll be reading up on push-pull. Thank you!
Main power source is a single cell lithium, so 3.7ish volts. Supply for the ATtiny is a 5V driver IC (I’ve already got it working).
The convertor I want to build will be inverting as the load is basically a pure constant resistance. (14.5w 1.6 ohm typical). I think that means I sidestep all the problems with a voltage higher than my control.
I’m hoping to use the window mode of the ADC and the programmable logic (CLC) to actually control the convertor mostly independent of the CPU.
- Comment on Driving a logic level MOSFET with an ATtiny 3224 3 weeks ago:
I’m bumping against the edges of my ignorance here. I haven’t done any calculations yet. I’ve been reading the DC/DC Book of Knowledge by Steve Roberts.
I’ve got a working 5V switch mode supply using a driver ic for the ATtiny. Plan is to use that supply and the ATtiny to variably control a larger inductor/MOSFETs. This will power a resistive load around 25w max, 14.5w typical, 1.6ohm so roughly 4V/3A typical.
The data sheet gives an absolute maximum of 40mA for output on a pin with 5-10mA being ideal. My understanding of the chart above is that the voltage will also sag below the 4.5V gate actiivation. I’m assuming trying to switch the MOSFETs with just the ATtiny either leads to a blown output or an overheated MOSFET.
I guess I need to figure out my target frequency and work backwards from there. I’ve got a working reference circut, but all the ICs and MOSFETs have been laser obufuscated. Inductor is 1.5uH and 27A.
So I’m assuming I need a higher frequency than what I can push with the ATtiny but I don’t know that.
Sorry for the novel. Writing this down helps me work the problem. Do you see anyrhing wrong in my assumptions/reasoning?
- Comment on Driving a logic level MOSFET with an ATtiny 3224 3 weeks ago:
I was thinking bjt or opamp to drive the mosfets, but I’m not sure.
And yeah, I’ll be scoping it as I start testing. I’m just still wrapping my head around the synchronus inverting buckboost I think I want to use.
- Comment on Driving a logic level MOSFET with an ATtiny 3224 3 weeks ago:
I’m hoping to end up with a pcb that has the features of an obsolete ecig that my spouse and I prefer. I’ve probably purchased a dozen of them over the years. The switches always fail.
Given the politcal climate towards ecigs (What about the children???), my particular harm reduction method continues to become more difficult to source. So, I’m just going to future proof things and build my own. I doubt the design will be worth any money so I’ll probably open source it if it works.
So pretty serious about durablility, it would be a tool for daily use. I plan for switches to be on a daughter board so I can just change them out.
I’ll be checking out the video this evening.
Thanks!
- Submitted 3 weeks ago to askelectronics@discuss.tchncs.de | 13 comments