Week Ten: Output Devices

This week we were making output devices! I decided to hijack it to do some testing for my final project, so I made a buck converter. My final project involves a controllable constant current output into a wire for hot-wire cutting. The final version will use the 16A mosfets in the lab, but since there wasn't a corresponding p-type mosfet, I went with just using an h-bridge to do my testing with. I mostly wanted to check out how difficult it would be to use the built-in PWM mechanisms and dead-time generators on the ATtinys. Since I wanted a relatively high current, I opted to use the 10 microH inductor, which is rated for 3.9A (the 1.2 microH inductor would require me to switch at ~MHz). I calculated that with the 10 microH inductor, I'd need to switch at 200kHz. I decided to use a 10 microF capacitor because that'd give me ~16 kHz oscillator frequency and the bode plot said the gain wasn't too scary there. Here's the final board I made:

I actually made two boards that I stuffed. I discovered that the first one I made (pictured below) would probably have let out magic smoke if I tried to program it: I used OC1A and -OC1A as my PWM and -PWM, but they're also the pins for MISO and MOSI. I looked up the timing diagrams on the data sheet and it seemed like those would go on at the same time, thus causing shoot-through in my mosfet totem... so I didn't try programming it, and redesigned the board.

Made the second board, stuffed it, etc. I think my first attempt at it had a short somewhere, so I desoldered it (a few times) looking for it. The second time I desoldered it was when I saw 41.6kOhms between my 5V and ground, but I eventually figured out that that was an acceptable resistance when I measured just one of the 5V regulators not on the board. Then I ran into problems because my pull-up resistor on the n-fet driving the p-fet was too large and not charging the p-fet gate fast enough, so I was getting shoot-through. I ended up stacking 3 499ohm resistors on top of each other to reduce that resistance without going out of the resistor's wattage rating. Then I got a fairly acceptable pwm signal (yellow is p-fet gate, blue is n-fet gate):

And it bucks fine! I had about a 60% duty cycle going, and got around 4.3V at 7V input, and 6V at 9V input. There was a bit of voltage ripple (about 1V p-p), so I might stick a bigger cap on there. Here's the output traces of those two:

I tried doing feedback on the output voltage, but I think I need to actually design the control system for that so it can be really good. Right now the voltage is feeding into the one last ADC I have left, so I might switch to an attiny with more pins so I can have a pot comparing to that voltage output and regulating that way. Anyway, when I tried to do feedback, I once got a perfect square wave (so my gain of 1 was probably too high), and other times got other values that I found difficult to diagnose... so I decided to work on that another time.