Alex's Linear Power Supply Build Log

I guess Im Convinced! DAC’s on the way, and another encoder just to have the physical differentiation between voltage and current settings. Im going to do some research and see what DAC I want to use. The options and benefits seem to outweigh the 7$ a piece price tag for the analog pots I am using.:rofl:

I hope the next iteration goes well!

You might look at the MCP4728. It is a 12bit DAC with 4 channels out, I2C control, internal Vref with 2X output gain, on board EEPROM to hold power up defaults and I2C addressing, settling time of 6 micro seconds for under $2.50. There is no need for four channels out, only one is currently indicated, but it is always nice to have some expansion as long as the cost is low. Similar devices with only 1 channel are about half the price. And using the DAC instead of analog feedback, you can decrease the op amp count to one for the current sense and one to add a gain of around 3.66 to the DAC output to reach 15V gate drive, so adding the chip for the DAC should be balanced by reducing the op amp packages by one. And with Vset and Iset determined by digital control will free up to analog inputs to the ADC so only one package will be needed there.

The one concern with doing it all in digital is if the micro locks up and the load changes then the output regulation will be off. One approach is to put the output regulation in an independent, fast interrupt routine and also set the watchdog timer to shut everything down if the interrupt fails.

In the interrupt routine, read the ADC for the VFeedback and IFeedback, select which one is in control, write it out to the DAC, then reset the Watchdog timer. Since the Vset and Iset are determined by the software they don’t need to be measured as well. With the Watchdog timer set for 16msec if the micro locks up or something and misses 16 cycles of the interrupt, the watchdog timer trigger and will allow setting the DAC to zero and then shutting down to prevent runaway output.

The ADC converts in about 300 micro seconds and the DAC output settles in 6 micro seconds, so you would need to program one of the timers for around 1msec to leave slack time for the main program to run. You can even implement a PID in software in the interrupt loop to get rapid return to voltage with changing loads and still eliminate any oscillations. The ATMeage does not have much arithmetic capability so if you want to linearize the moset output or do a PID keep the calculations as simple as possible.

Reading the rotary encoders and writing information to the LCD, handling all the menus and sub-menus and pretty much all the other microcontroller operations can be done in the main code looping around indefinitely. Startup would program the DAC to zero as well as setting the EEPROM to output zero at power up, starting the mosfet gate control loop then setting up the watchdog timer. With Vset and Iset deterined by software, you can also change them as needed to prevent over heating. If the user is turning the current limit knob up too high you can lower Vset at the same time to compensate or do the same with Vset changing Iset.

The specs on the FDA38N30 make it look like the linear mode is not especially linear, and one possibility is to measure the current conduction of the FDA38N30 for the full range of gate voltage inputs and then work up on your computer a piece-wise linear correction factor to make the mosfet conductivity a flat, linear function of the digital gate control value generated in each interrupt loop above. However, the feedback process will correct for the non-linearity in the mosfet. The linearity of the power supply will be the combination of the ADC converter for Vfeedbck and IFeedback and the digitally generated Vset and Iset.

With the speed of the ADC allows about 1msec response to changes in the load. Not as quick as the analog circuit but not too slow. With a 1msec response time, a 30A surge would drain the two 47uF caps by about .350V. To get a smoother output under worst case conditions you would need to increase the size of the caps.

If all this sounds like too much, you can always stick with what you have now. It is mostly just a matter of personal preference and how much you need the extra features.

I’m not trying to “convince” you, it is your design you should do what you are comfortable with.

I think the second encoder is a good idea.

If you do go that route there are chips that have both the ADC and DAC in one package.

Only one? :thinking:

:astonished: Only a digital person would even say such a thing! There would be no point in measuring the transient response of such a power supply as it would be guaranteed to be abysmal by design.

Let’s not forget the time spent communicating with these devices over a serial bus.

It looks pretty linear to me between 1 and 10 amps, and even more so below 2.5 amps which is the limit in this case.

No, it’s mostly a matter of having a design that works vs one that doesn’t. :wink:

Actually, if he wants one for Vset and one for Iset, which I think is a very good idea, he either needs to setup some way to multiplex one or both of the rotary encoders to also operate the menus, change settings, etc. Having three encoders would allow instant change of voltage or current limit, even while navigating the menus and all the extra functions. Or you can use a single one with switch and LEDs to indicate voltage, current, or menu mode and use the push button to cycle through them. So three encoders reduces confusion, allows instant access to voltage and current controls, and reduce cases of changing the wrong one, especially when you are in a hurry.

Some how this has completely slipped past me. So I looked and found one that is rather like the micro pins, each of the 8 channels can be individually set to analog voltage out, analog in, digital out, digital in with I2C for about $7. That would be a possibility for this project.

Well, even I felt a little uncomfortable with the slow response time. In this case, at least 2 DAC channels for Vset and Iset, use the rest of the feedback as is except possibly use digital control to switch from voltage regulation to current regulation or back. That could simplify the control mixing without slowing the normal load current response time.

This is one for the digital guy. I left out the serial communication time for the second conversion because it is small compared to the conversion time (roughly 1/5th) and included the DAC output settling time just as information. Since the DAC is an output not an input, it can be set and then return from interrupt whereas the ADC conversions must complete before they can be read. The results of the first are read during the second conversion, the second adding the com time you mentioned but having little effect on the interrupt service time

At normal I2C speed of 400Khz the communication time would be around 1/5 the sample time, and I think you can start the second sampling while reading the first. This particular ADC chip has a high speed version of the I2C bus as an option. It is 3.4Mhz, about 9 times faster than the 400Khz.

2.5 amps. Some how I was always vague about the intended current range but I was thinking it was much larger. I was also trying to use figure 1 to derive the linearity, which has no reading below a gate voltage 5.5. Looking at figure 2 it is a log-linear with the response curving downward. Always hard to judge linearity on a log-linear so I eyeballed the numbers and replotted on linear-linear. There it curves upward more strongly. With only 2 points below 2.5 amps and none below 1 amp it still looks like it is not terribly linear. But the feedback system will take care of all of that so I raised a mote point earlier

i
So true! At least in software you KNOW that it will not work the very first time, but you can keep iterating until you get it to mostly work and you have slowed down on adding bells and whistles!

And it would seem that I still need to work on my remedial note reading for schematics, as well as basic circuitry.design.

Three now? :laughing:

I don’t know how you arrive at that figure. I haven’t looked into the exact command set of these ADC/DAC but, depending on the mode you are running the ADC in, you typically send at least a single byte command to begin a conversion. That’s 8 bits plus the start condition plus the acknowledge bit plus the stop condition, That’s 11 bits, at 400KHz that’s 27.5us. To read the results is another command plus reading 2 bytes per channel, plus start, stop and ack = 5 bytes/40 bits + 3 bits = 43 bits or 107.5us. Then writing the new data to the DACs will again take about 107.5us, that’s a total of 242.5us or ~81% of the conversion time.

Edit: The above is based on a two channel ADC instead of four so it should instead read:

… 2 bytes per channel, plus start, stop and ack = 9 bytes/72 bits + 3 bits = 75 bits or 187.5us. … that’s a total of 322.5us.

Ooops! I only counted one ack bit above when there is actually one per byte:
Start conversion: 27.5us
Read from ADC (4ch): 207.5us
Write to DAC (2ch): 117.5us
Total: 352.5us

Wonderful! If only the ATMega supported that.

From post 11:

Yes, Figure 2 titled “Transfer Characteristics” is a semi-log graph and, looking at the 25C plot, it curves slightly to the right, but it is also almost vertical so the log nature of the Y axis has less effect. Do the math, for Vgs of about 5.25V Id = 1A, Id=10A when Vgs is about 5.9V. Picking a point in the middle, Vgs=5.6V, to be linear Id would equal about 5.8A. Looks pretty close to me. But then, as you said, it is irrelevant.

Hey all,

Had to put the power supply to the side for a bit while i was away on work and waiting for parts to arrive. I got the boards back from JLC PCB and the quality is pretty good. I don’t have time yet to get the whole board assembled but I thought I would get the new power section up and running so I could do some load tests on the 5 volt rail.

The voltage is pretty solid throughout a wide input range as expected
5.11 volts with just the LED loading down the output at 2 mA or so. This drops to 4.99 Volts at the rated 500 mA and the switcher IC gets a bit on the warm side, but the diode I’m using is not exactly the correct one as per recommended in the data sheet so I think there is some loss there. I am still waiting on the correct diode as well as some of the digital components

1 Like

another note, here is a scope view of the transient turn on response of the output voltage. currently just running from a 12V input voltage. about 1.53 milliseconds rise time when power is applied.

I’m sure it’s cooler than the previous linear regulator, but I wouldn’t expect it to be too warm at 500 ma. I have a switcher bucking 24V down to 3V3 at close to 1 A and it barely gets warmer than ambient.

Care to post the schematic for your new board?

Sure, schematic is here.

Lab Bench Power SupplyV3.0.pdf (234.4 KB)

I see you have an input filter on your DC-DC converter. If that isn’t designed correctly it can do more harm than good. It might be interesting to put a scope on it and see how it is performing. A poorly designed input filter can cause the converter to be less efficient.

Also, I would use the output of the current control section (Q4) to instead drop VSET instead of pulling down the output of the voltage control section. As it is it might not be very stable at the current threshold as the voltage control section would continue to try to control the voltage.

I did some more looking into the board and aside from the budget wire you saw in the photo for the feedback wire, I think I was also using a blown catch diode. Checked it out with a meter and it looks pretty dead both ways. I re did the assembly with a nex converter as it seems I also killed it during the process. It looks pretty good now, almost no heat buildup at the converter and the as expected 2MHz switching frequency at the catch diode. The output voltage seems to collapse though as I go up above 400mA, down to 4.38V from the nominal 5.03V. I’m thinking its partly my layout not having large enough traces for the current path? I tried to use big copper pours for all of the converter layout though.


Uploaded one of the wrong photos.

As I mentioned above, check you input filter.

Looking at the input to the switcher and prior to the filter on the scope, I don’t see any oscillations or noise getting into or through the filter at those loads. I did however lower the inductor value from the 470uH i originally designed to a 100uH. I have populated the rest of the board and have started testing the rest of the digital components as well.

I see now that converter is only rated for 500ma, but still it shouldn’t be dropping so much at 400 ma. In the photo above D3 appears to be installed backwards, could be how it got damaged and why things ran warm. Most of the parts don’t match what is on the schematic. It was recommended you use the TI WebBench for the DC-DC converter but you ended up using the minimal example from the datasheet of an Infineon part.

It would be interesting to hear how you are getting on with this project.

Sorry about not posting, I haven’t even realized its been 2 months since the last post. I have had to put the project on hold for a bit, due to work schedule and the fact that I just started moving. :tired_face:. the case and board are buried in a cardboard box right now.

Trying to do a little work on the firmware from time to time but I haven’t been able to get any assembly completed on the board or hardware. I had to opt out of using the SD card since I hadn’t read the fine print on the DAC (MCP4922) and left the enable pin unconnected so it was either the card slot or the DAC and obviously the DAC wins. I was able to talk to the DAC pretty easily and had I outputting a varied voltage on both channels through the serial port on my computer’s Arduino IDE.

The external ADC (MAX11612) is sitting on the I2C bus and seemed a little more tricky. I believe I have everything in the setup and config bytes set up and sent to the chip and I’m getting the requisite two bytes back but the output on the serial monitor doesn’t seem to match. I just spent some time earlier today digging through the Datasheet a few time again and will get the board out again this weekend and try some different things that I think I missed.

Forgot,
Here are the datasheets for the parts I’m working with if anyone was interested. I’ll post again soon on my progress with them.

MAX11612
MAX11612-MAX11617-78493.pdf (294.5 KB)

MCP4922
MCP4922.pdf (3.3 MB)

Just started using TI Webench, great stuff for learning different power designs!

1 Like

Well, it’s been a long but I’ve finally gotten time to get back to this project. I’ve actually just respun the new version of the board since I spent some time getting most of the different parts working with test code. the ADC got changed from the MAX11612 to an ADS1115, partially because there is already a working library online for it and that just makes things easier to get it all going since I’m still not great with programming. The new board is actually my first time using a 4 layer board. I just sent the gerbers off to the board house so I should have them in about a week once I finally get back home. other than the ADC part change, I also did away with the SD card. It was just too many things on the board and i wanted to simplify the design before I got to a point where I knew I would just never finish it. I changed the 5V power supply IC as well, I didn’t go with anything from the TI Webench, although I’ve used it on other projects. it is a newer chip from Monolithic Power Systems that is still fairly inexpensive but isn’t at the end of its design life like the other chip i was using was. looking forward to getting back home so can dig into this project again it’s been a while since I’ve done any hardware at all so this will be fun!