A 4-quadrant power supply built on a 1sqin PCB, +/-12V, 100mA, and floatable for multiple paralleling/series. 4layer, $10 OSHPark PCB.
To make the experience fit your profile, pick a username and tell us what interests you.
Schematics (not 100% up to date, some components changes have been made... see comments)
Adobe Portable Document Format - 81.94 kB - 10/01/2018 at 22:17
x-zip-compressed - 37.90 MB - 10/01/2018 at 16:01
KiCad PCB file
kicad_pcb - 161.64 kB - 09/06/2018 at 19:57
Schematic file (does not include libraries)
sch - 55.65 kB - 09/06/2018 at 19:57
Auto-generated XML file
XML - Extensible Markup Language - 46.90 kB - 09/06/2018 at 19:57
Further development on this project is on temporary hold due to unrelated issues. Not too worried though, everything for 1sqin project is already here, doubt it'll do much good anyway though since it's not in a 'complete' state.
I'm updating the software now, and making the changes to the PCB I had intended. Right now, I've got 4-quadrant supply working, the main thing is how to handle the current limits, and getting a faster response time out of the system. I can respond to a voltage change in a few hundred microseconds, which isn't ideal, but reasonable enough for my purposes.
I updated R13 from 75k to 50k, and put common mode correction factors into the software. I think I stressed an output mosfet really hard though, as my correction factors are going wonky now for some reason (I'm seeing negative current when nothing is actually attached, which makes me think the PFET might be going, or the ADC ref is going weird, or the MCU got hit). I have it oscillating between +4V and -4V, drawing 20mA over a 200 ohm resistor just fine, and am now trying to see how I can set the current limit to 10mA. It works reasonable, but the problem is I'm oscillating around the 2V mark a lot, so I'm trying to get fast response, but not too much oscillation. I probably need to put some kind of PID loop.
Another thing cropping up is the overall ability of the system. The output mosfets really have a high VGS(th) compared to a lot of standard mosfets (I mean, really, what do you expect for a little itty bitty thing in a SOT23 anyway?). As a result, the system kind of poops out at +/-10V and 50mA. It'll do 12V if you don't load it, and 100mA if you want it at 5V, but not at 12V.
I'll still have to do a video in the coming days showing response time and 4-quadrant operation.
Video is now live on youtube ...
So, you would think, being a ham, I would know that 1500UTC is 9am, right? Right?! Nope. For some stupid silly reason I thought it was 9pm. So I threw together a video with a partial of my ideas for what I had planned, and I will finish the project up tonight and/or tomorrow as best I can, so there you go, judges. This is how deadlines break a person :D
So, this project will not be 100% complete by the deadline. To make matters worse, my video that I made this morning, I can't upload because the internet connection at home (SCREW YOU CENTURYLINK) is down. Mondays, amirite?
Look for my video on my channel, https://www.youtube.com/channel/UCaPs3gfibHWNte9qREZi_IA/videos , and I will make a project update once it's done.
I'm also going to upload a snapshot of the files for the project, exactly as they sit in my project folder right now... thankfully I had a USB drive available...
Well, the MCU was the culprit. The problem with being stubborn and obsessive is you stay up past your bedtime and do things after thinking about them some more, because you just can't stop thinking about it.
So I reflowed the MCU with a new one after breaking out my hot air rework station which was tucked away. Now everything works fine. And, to make things better, I found two things. One is a bug in my code (well, a line of code I failed to remove), and the other is the fact that I think the power supply on the PCB and the power supply in the programmer like to fight each other. Not sure why, but from now on, when programming the MCU, I'm going to turn off the input power supply. One of these two things might have caused the issue.
So, now I can verifiably set a voltage (say +4V, or -8V) and have the MCU set the voltage at the DAC such that the output goes there.
One thing I've found though is that my center reference voltage change from 1.65 to 1.0085 has screwed up the DAC output, in that the full voltage swing isn't covering the entire capability of the IC now. I can go full negative, but not full positive. Full positive is now limited to +9V. This is an easy fix at the gain stage level really. It just means instead of having +/- 30mV resolution, I will have +/- 50mV resolution. The fix is to increase R9, or decrease R8. Right now I've got a gain of +10, so 0V input, 1V reference = 10V out, and assuming 1V gate-source, that's about 9V max. I want ~15V out, so I'll need a gain of 15. This means R8 to 3.3kOhms, or R9 to 75k (likely I'll go with the latter, as I use 75k resistors elsewhere).
I will make a video tomorrow at lunch I guess!
While testing the current measuring portion of the system, something happened. I'm not sure what, but this what time-constrained failure looks like. I was testing the feedback loop on the DAC to set the output to 0V. I wanted it at zero volts, so that I could put a resistive loaded power supply onto the output, when I saw the serial port output looked funny, it was reading -4V at the output stage. After resetting, I noticed my bench power supply supplying the board was reading 350mA. I felt the board, and the regulator was hot. I isolated a few portions, but I'm relatively certain the MCU is the culprit. Applying 3.3V to just the power supply, it is drawing 180mA. Because this was my first time testing the voltage feedback loop (I had just gotten it to measure voltage when another voltage was applied to the input, without the DAC stage connected), I'm not fully sure what happened, but my guess is one of a few things.
*The DAC got overloaded
*The ADC went out of range (unlikely culprit, I've measured +/- 12V with this thing)
*Some little gremlin took a crap in my processor.
I dunno, it's kinda odd. Usually when things fail, they fail pretty dramatically and I get a short circuit.
It's not the op-amp chip, pulling vcc has no difference. And VCC isn't hooked up to the 3.3V rail anyway. Powering just the 3.3V rail yields 180mA with the +/-15V rail floating.
So just replace it you say. Not so fast, it's a QFN32 package. I have a hot air station, but not the time of day right now to replace it without risking more destruction. I'll have to take it to work in the morning.
I'll have to decide tomorrow if it's worth furthering this entry to the contest. Given I'm now unlikely to produce a functioning board (a specific requirement for the contest) with my time constraints, I'm going to bed. If only work hadn't sent me to the Philippines for 2 weeks plus vacation...
So, the datasheet really isn't clear what the input range is. There are some formulas and stuff for input range and other things, but nothing _really_ makes it clear. So I'm now using VDDANA/1.48 (~2.2V), with an input gain setting of 1x, and I'm just going to full-scale everything from 0V to 2.2V and call it good. To this end, I'm going to change R4 in the reference generator to 2.2kOhm, which should give me a 1.0-something center reference. R15 is also instead of being 1k to make a 1/10 gain ratio, I'm going to use 750 ohms (1/13.3 gain ratio, about).
At the very least I'm producing 4095 data values, so I know things are working. Mostly. Because I forgot that I left a power supply connected while powering up the MCU. So I fried one of the output mosfets, whoops. Good thing it's just a 2n7002....
I am learning to hate ADC's on this ATSAMD21 chip. The datasheet has all the relevant information I'm sure, but it's just a hot mess to understand.
3V into the ADC is producing an ADC value of 2960-ish, on a 1/2 (VDDANA) reference (3.3V/2) using a 1/2 gain preamplifier. Somewhere, somehow, I'm missing something in my configuration. I have to travel today though to visit parents, so I'll have some time to think about it in the car.
I'm going to have to change the gain of my voltage amplifier from 0.125 to 0.1, as the 1.65 voltage reference used as the center reference for the amplifier cause the negative range (-12V) to show a 13.65V difference, which * 0.125 is 1.70V above the reference (1.65) and that's above the 3.3V rail where the ADC should even be operating. Fortunately, this means changing a 1.2k resistor to a 1.0k resistor. NBD.
I could probably lower the reference to like 1.5V if I so desired, but I don't think it's worth monkeying with at this stage.
Alrighty, off for 7 hrs of driving...
The circuit board is functional. I can set the DAC output, and get an output from +12.8V to -13.6-ish volts. I need to get some basic software working, but serial communications from the ATSAMD21 out via the isolated port is working, and basic ADC functions are in place, just need to calibrate and do a little math to do measurements right. My initial code was stuck at 8Mhz, figured that one out today so it's now at 48MHz I think.
Disable output ; apply bench power supply and measure ADC value over voltage range using NIST-calibrated DMM/Power Supply, to see what correction factors I need for the ADC
Bypass output system and do the same for the current sense ADC; Make sure current/voltage ADC values are getting into memory appropriately and scaled right.
Define local variables and function to set voltage and current limits.
Write final control loop
Characterize the response waveform to transient load application.
Draw presentation slides
Make a video for final submission
I guess my comments should go here. Board received 9/15; built up the PCB's week of 9/17; working on software week of 9/24 ; I've never used this particular MCU before, so I'm getting my segger j-link up and running - And I need to figure out how to get an LED to blink (I have a separate PCB that I designed a while back around this MCU, but never got around to building up experience on the toolchain, so now it's do or die time.) I'm not a software guy, so this is going to be my stalling point, but I really need an ARM M0 in my personal component lineup, and I really like the feature set of the ATSAMD21 series.
Become a member to follow this project and never miss any updates