Previous Video HERE: http://www.youtube.com/watch?v=xa9Lyb45oJM
Rev C Schematic HERE: http://www.eevblog.com/projects/usupply/
Part 12 in the PSU design series.
A thorough look at the Rev C schematic and all the changes.
18650 Lithium Ion battery charger, software controlled switching pre-regulator, replacement of the uCurrent capability, return of the PWM DAC, accommodating the Wiznet Ethernet module, and a whole lot more.
Rev C Schematic HERE: http://www.eevblog.com/projects/usupply/
Part 12 in the PSU design series.
A thorough look at the Rev C schematic and all the changes.
18650 Lithium Ion battery charger, software controlled switching pre-regulator, replacement of the uCurrent capability, return of the PWM DAC, accommodating the Wiznet Ethernet module, and a whole lot more.
And here's my Revc schematic which we'll go through in uh, quite some detail now. I Started out by uh looking at this Rev C design It was uh, reason I did it is because cost was getting a little bit out of hand I wanted to shave a few dollars off here and there and one of the things was of course the battery charging in the battery um and the separate battery p PCB I was going to have well, an extra PCB Of course that costs money And the battery charger uh chip was actually the most expensive chip on my board because I originally had the concept that um, you'd be able to charge this from a 5 volt uh USB input. So of course the battery voltage using three lithium ions at um, you know, 4.2 volts each um over 12 volts was actually greater than the 5 volts you needed a step up converter but then I thought, well, it' be great if you could, um, not just use a step up but uh, use what's called a sepic uh voltage converter which basically um is a DC to DC converter but the input voltage instead of being a boost or a buck, it's both. It can actually accept any voltage um above or below your battery uh, charge voltage and linear technology make a brilliant uh sepic uh, constant current, constant voltage battery charger chip the LT 1512 but unfortunately, it's even in volume.
at 100 of quantity here, it's still 3 bucks 85 and that put it as the most expensive uh Semiconductor in my entire design and that just didn't really make sense. Um so I start. That's where the whole Cascade of changes came from: I decided Well if I eliminate the battery PCB put the charger on the main board I decided to go for SMD uh circuitry rather than the through hole kit. Now I've explained uh that before on the Forum and several other places and uh, really, it's it.
Just made sense to ditch the Uh 5V USB uh Charing charging capability and it'd be very slow too. Of course, because um to charge a 12 over 12volt Uh battery from a 500 milliamp 5vt uh USB or only 2 and 1/2 watt USB um interface. it's not that good and then it breaks the Um isolation as well. if you're powering it from a 5V uh Source that's um, not isolated like a PC or something like that.
Well, it's bugged. So I decided to ditch the LT1 1512 As good as it is, and um, here it is. By the way, if you want to, actually, um, if you're interested in the Uh circuitry of that, it the Uh wall adapter. Here, it's actually a sepic converter configuration and the input can be the input from what they call the wall adapter here actually can be greater than than or equal to supply voltage.
So I could have had the option of USB charging or 12vt charging or 15 volt charging or something like that from an external plug pack or USB would have been really nice but far too expensive. So I went through all my parametric searches I won't bore you with the details and uh I ended up um, well it turns out that uh, as I mentioned before, having three lithium ion batteries uh actually makes um, the choice of uh battery charging IC more difficult, more exp, expensive, more complex things like that. So I started looking for another Uh battery charging chip and I won't bore you with the details. But as it turns out, the Uh microchip one surprise surprise are some of the cheapest uh on the market. But if you go through the microchip uh website, they only support if you look at this column here number of lithium ion cells there. then they only support one and two cells devices. So um, it looks like I'm going to have to I told myself I'm going to have to choose a two cell device and it just so happens at the mCP 73213 it's only $129 in volume. it is a 10 pin dfn but package over here but I am going for uh surface mount anyway.
Um, the bul will actually be pre-assembled won't be hand solded, so not really an issue. We're trying to save some cost here, so I've already saved a couple of dollars on my bill of materials uh, cost by choosing this, but it only supports two cells maximum and uh, really, that changes the whole ball game because I was originally going to have a 0 to 10 volt uh Supply which actually was going to be lower than 10 volts as the battery voltage drops and the software inside the unit would have been intelligent enough to actually measure that and know that it's no longer capable of outputting 10 volt. so it would change the maximum range that you actually had available. So now with only Uh two cells at 4.2 Vols per cell, absolute maximum.
um really, we're only talking about like a0 to 6vt supply at the you know outside. um, that's with a full Voltage cuz we got a couple of volts uh drop with our Lt380 linear regulator. So really, um, that changed the whole ball game and started the Cascade of changes like I've talked about and uh I went right. Well now I've got two lithium ion cells.
what can I do with that to get a bigger output range? Well, I can put in a Um switching uh, a switch in preon converter in there to boost the voltage up uh before the Lt380 so that gave the capability to then actually give um the entire Um to give a much bigger Uh output voltage range. In this case, it'll be 0er to Uh 20 volts instead of 0 to 10 volts and we can do that by having a boost in pre-regulator down here. and this is my new Revc schematic and this is my boosting pre-regulator It comes from the battery. We'll go through the whole thing, but it comes in from the battery and it boosts it up before it goes over.
So the battery the input Uh battery comes here. Here's my mCP fact. we'll go through it now. here's my mCP 73213 battery charger.
We got our DC jack here which is uh 12v 1 minimum. We've got some diode protection there. the charge rate I've set to 550 milliamps um half an amp and there's our battery connector there. that's our two cell battery.
We've got some battery measurement here which goes to the ADC but basically um, the Vbat goes into the DC Todc converter which is actually software controllable. go into that later the E. It's got an E pot here, so it gives an output range here of 9 volts to 22 Vols output range 22 volts being 2 volts above our maximum uh desired range and that then goes into our existing Um circuitry which we've got here and the as you've seen before the Lt380 and we drive it linear. So what that gives us is by only keeping under Intelligent Software control the input voltage to the Lt380 voltage regulator. keeping that only 2 vol above the output. we're only dissipating at a maximum of 1 amp output current. We're only dissipating a maximum of 2 watts in that Lt380 regulator instead of much higher than that before using just a straight linear voltage regulator. So now we're only dissipating 2 watts in our linear voltage regulator.
It was like five times that before. So now we can get away from using that expensive heat sync. So here come the Cascade of cost savings. we Chang out.
We've eliminated a PCB so that was you know, a dollar or $2 a couple. At least a couple of dollars cost there even if you get it if you got it from China More than that, probably double if I get it from my New Zealand source. So a big cost there for the extra Uh PCB large battery PCB which we're looking at to mount the battery holders on. We're saving that cost.
We're saving a couple of bucks on the LT Uh 1512 uh charger by choosing a different charger. We've got one less battery in the design and we're dissipating less power so we don't need that huge uh, four $4 plus uh, heat sink in volume. So we can use our back panel which will be an aluminium back panel because it it is still dissipating 2 Watts So you know it, it will actually uh, dissipate, will actually get to a fairly high temperature. Um, if if we only have that on a modest, say a uh heat SN which built onto the PCB and we'll go into that.
So uh, really, we've already saved quite a significant amount of cost just there. but there's more to come. But of course some of our cost saving has actually been offset by the need to actually have this DC Todc boost converter and the E pot as well. But these devices are quite cheap.
uh, as we'll go into and we'll go into the selection for these things. but we're still saving. Even with the addition of these two devices plus a few passive components around there, the inductor and things like that, you know, 20 cents for the inductor or something, we're still saving many on our overall cost. Now there's one thing you might Notice missing from the Uh battery charger circuitry here.
and that is battery protection. Well, uh, it's not that we don't have any. we're actually going to use the Uh 18650 cells that have built-in battery protection circuitry I.E they um, have a little, uh, they're slightly longer than your standard 18650 uh cell. but there's a little PCB in there with battery protection circuitry which a stops it being overcharged over 4. uh2 Vols and it also, uh, stops it from being overd discharged and it cuts out at 27. Vol So uh, really, where um, it's using those batteries saves us uh, cost and it offloads the protection into the batteries where it probably should be anyway. And if we take a look at our mCP 73213 uh dual Cell Lithium ion Lithium Polymer Battery Charge Management I See Um, it does have different battery charge voltage options cuz we're using 4.2 Vols per cell. We need the 8.4 volt version so you got to be careful when you order this thing to actually order the right part number.
You can't just order mCP 73213. Otherwise, you could end up with anything. You got to order the exact part number. Now it actually has uh, um output.
Uh charge. Fast Charge capability is programmable from 130 milliamps to 1.1 amps. That's great. Um I've got it set to a nominal half an amp just over half an amp at the moment.
but I might set it up to an amp or something like that. and uh, these Uh batteries are typically uh, like 2700 milliamp, uh, hours or something like that. So uh, really, you know, at a charge current rate of uh 1 A. but they should charge in say 3 hours or something like that.
And the other great thing about this device and the advantage over the original LT um 1512 that I actually used. It actually has um, end of charge, uh, control and things like that where you can select the minimum current, uh ratio. It's got safety timer, it's got preconditioning for depleted cells in here and it's you know it's a really nice device and another Advantage is. it also has a status LED as well.
So um I'm going to put that on the front panel where the 5V USB connector is and that's a the um, that's a thing I needed before with the LT 1512 solution. needed some sort of uh LED um status solution to show you that whether it was charging or finish charging, this is all built in. It's got a single resistor programming. It's a great device.
It's so easy to use. Practically foolproof, so we're going to use that. and uh, if we take a look at the Um circuit here, you'll notice that uh, basically where um, the switch to turn the power supply off and on um is basically just uh, disables um, the power supply from the battery I could have wired the other um, uh, uh, throw of that uh switch to the input here. but then the Vbat.
Then you're limited by the maximum voltage of the Micro 2253. so it's not like you could use a 12volt plug pack and feed it straight through. otherwise you'd blow up your Uh MC 2253 here. So basically the unfortunately, the Uh power supply um, it.
It would have been nice to have it powered from the plug pack while the battery was charging, but we're going to have to live with Um powering the Uh power supply circuit while the battery is charging. Either that or actually disconnected. So really, when the batteries are charging, if you want to use the power supply at the same time that it's charging, well, it's going to share some of the Uh current um charge current. so it's going to charge uh, slower. but there shouldn't be any problem by having the load um, in parallel with the battery while it's charging. So our battery uh voltage range when it's fully charged is going to be 8.4 volts. and uh, that's going to drop down to an end of life of uh, 5.4 volts. Or that's where the uh safety cut off in the battery will typically uh, cut in, but not that you really should let them go that low.
So um, the. But because we're reading the battery voltage here with our microcontroller, the microcontroller can determine what the low uh battery, uh, cut off voltage is is and unfortunately it can't like. Well, it could actually disconnect the load. Um, if it wants to, uh, do that automatically, it can.
It has that has the option to actually do that, but uh, really, it can. Uh Flash the low battery warning indicator at any voltage you desire. So how long will the batteries last in this design? Well, you know, how long's a piece of string? Let's say we have our maximum output current uh capability of an amp and where we haven't got the DC to DC converted switched on here. So we're powering our output voltage say 3.3 Vols directly from the battery.
Uh Source Um, it's going to work just like a linear Uh voltage voltage regulator in that case. So 1 Amp output will flow directly through the regulator. It'll flow directly through the diode and the inductor there and it'll be um, taking 1 amp directly from the two cell battery here. And at a nominal Uh capacity, it varies.
But a typical one might be say 3,000 milliamp hours depends on the load current, of course, But let's say it's uh. it will basically last 3 hours actually providing 1 amp. uh, full capability. Uh, to the load.
So that's not too bad. And if you load is less than that, The efficiency of our switching, uh, switching, uh. Voltage regulator. Down here.
our pre-regulator will actually improve that at higher Uh output voltages, that there's less wastage. It's still operating partially. Li So it's a combination of a switching and a linear Uh voltage regulator, but it should be more efficient than just a standard regulator. So if you're pairing something small, it could last all day.
It could last 8 10 hours or or even a lot more than that, depending on on your load. If it's a very low load, geez, could last forever. Actually, my entire Uh circuit draws about a a quiescent current with no load. I Think it's about 15 or maybe even 20 milliamps tops or something like that.
It's not a huge amount that's with the LCD. It doesn't doesn't take much, and the micro Uh doesn't take much either. So uh, really, we're talking a couple hundred hours. Um, from a fully charged set of batteries just having the power supply turned on and the LCD operating so pretty much it's going to vary from uh vary from a couple of hours at full load to a couple hundred hours at no load or very low load. And when the device is Switched Off you don't really have to worry about this uh uh charger chip actually drawing Uh current from your battery because it's very minimal. If we actually, uh, take a look at it, we're talking. You know, only a couple of microamps in uh, shutdown mode there so you know it's It's really not a big deal, you can just leave it actually connected straight across your device. So just on the thermal aspects of the Lt380.
as I said, it's dissipating 2 Wats and if we jump to the data sheet here, uh for our chosen package, the To220 um the as you can see the thermal uh resistance of the Junction to case, this is without a heat sink. just the junction to the case is 3 C per watt. So actually at 2 Wats power dissipation, the Uh Junction to case is actually going to get Uh 6 C above the Uh heat sink temperature. So one of the first things you think about of course is actually mounting this Uh regulator directly on the PCB and using the copper on the PCB as a heat sink.
And once again, the to Uh the Lt380 data sheet actually gives you info on here. This is Uh for the 5 lead, DD uh pack but it gives you example uh values here of the board area 2500 square mm is 50x 5050 mm area and in this tiny case we've got that's actually a significant amount of board area. and of course that is for the device. Mount on the top uh side and look at the thermal resistance of this thing of the junction to ambient for this heat sink.
it's we You know we're talking about um if you got a total on the top side and the back side is still talking about 25 C per watt for 50 mm x 50 mm copper area on both sides of your board. So uh really, if we're if this thing actually dissipating two Watts then we're talking about it's going to get a 50 C rise in that copper and that's inside your sealed case. that's not. You know that's really not a good way to do it because the air has to actually get out as well.
There's got to be thermal convection and stuff like that. So really, that's not really a solution. It might have been a solution for say half a watt dissipation or something like that, but I can't afford. probably can't afford 50x 50 mm square area on the top and bottom to begin with.
let alone uh, talking about you know, heating up internally inside the case over long-term loads at our maximum power dissipation of 1 amp um with a 2vt drop across the voltage regulator. not to mention also the um um drop inside the Uh current shunt resistor as well. Um, you know we've got some power dissipation there. So really, that forced me into uh mounting the to Uh 220 package on the aluminium backing panel so that at least um, it's got the heat can escape to the outside world via the back panel, so that should be adequate. So unfortunately, the PCB wasn't really a viable solution there. so let's take a look at our Uh DC Todc boost uh pre-regulator here it's a Micrel 2253 I Love the Mikel Parts They're really nice and if we, uh, go over to Digi Key here, we'll find that they're not bad. Price: It's only a dollar in reasonable volume or even less than that in higher volume and it's a pretty nice part. It's a 3.5 amp 1 mahz so it's a high frequency, therefore high efficiency.
uh boost regulator with over voltage protection and soft start and you know it really is quite quite neat. And it's got a 2.5v to 10v input range which is perfect for our two Cell lithium ion solution cuz lithium ions are charged at 4.2 volts so that's going to be the maximum 8.4 volts maximum. Um, and its output voltage can be up to 30 volts. So Bingo Now we start thinking with our Lt380 also capable of these uh sorts of high voltages, we start thinking, well, our power supply, what can we make it? Well, let's make it say 0 to 20 20 volts instead of 0 to 10 volts that we had before.
You don't want to go too high and go over the top. 20 is reasonable and it worked out because then I've just got to double my Uh gain in my Uh DAC system and things like that. So I decided 0 to 20 or 20.48% Um available in a um, just a surface mount package like this. Bit of a pain, but once again, our board's been machine assembled anyway.
Um, there's the heat dissipation in this thing is taken out by a thermal pad on the bottom there as you can see and uh, and also the other the input and output leads as well. and it's a rather nice device and it's pretty simple to use. and I've basically uh, copied um, this uh application straight into my circuit because it's a standard uh boost DC Todc converter and uh, there's minimal amount of Parts There's a couple of compensation uh components down here, but apart from that, we're only talking about our voltage set resistor. and the good thing about this is that the voltage set resistor on the bottom here this 10K one.
You can change that value under software control by having an external E E squ pot as we'll see to then. uh, so the power supply can actually adjust the input voltage to the Lt380 to be just above 2 volts above the require the currently set um output voltage. So that's going to work brilliantly and just a quick look at some of the efficiency curves of our Micrel: uh DC Todc converter. Let's go for a high output voltage here of uh, 15 volts.
Let's take a look at that that's in the bottom, uh, left hand corner. Here we got efficiency uh, on the y- axis here versus output current over here. And really, it's capable of um, you know, up to 700 odd milliamps, it's going to be like, you know, 80? Well, over 80% for say, 300 milliamps through to 700 milliamps output current with a VIN of 5 volts. There's that solid line there. It's going to change as the battery drops. The efficiency? Uh. Input battery voltage? Uh, drops. Um, the efficiency of this converter isn't going to change a huge amount.
Uh, really. The output current? uh, capability. This will, uh, drop off something like that. But the you know the software can know about this sort of stuff.
You can actually program these curves or typical figures into the software so that software knows what. The maximum output capability uh is based on your particular current, battery voltage, and the efficiency of the regulator or the measured efficiency of your total circuit. Because this efficiency is not just the chip, it depends on the inductor you're Selec and and the diode and the capacitor and stuff like that. So, uh, really.
but that's pretty good. and um, if we go up here and have a look at, say, 12 volts um in the top right hand corner, 12 volts output? Uh. efficiency. Once again, we're talking well over 80% for a good um chunk of the output range from 300 odd milliamps up to Um in this case, goes up to an amp.
so that matches. This device really matches our design fairly well here, because at an input voltage of Uh 5 Vols it's you know, 85% efficient at 1 amp um output. which is our maximum Uh capability. So that is really, uh, quite nice.
It's quite ideal for this application I think and it's a fairly cheap device, but I've gone into uh, selecting, uh, these sort of things before and there's a whole could do a whole hour on just selecting the correct DC Todc converter for this thing, but this one seems ideally matched. But there's one more neat thing about this now. I Originally wanted my design to actually be low noise um, hence why I'm The LT 38 is a very low noise device, but it's also battery powered, so be a really low noise device. But now we've added this, uh, nasty 1 MHz switching regulator in here.
It's not low noise anymore, but hey, even but we do have a linear voltage regulator on the output still, so we will actually filter out a fair bit of that noise. I Might put it like an RF bead in there or something like that to maybe, uh, drop it a bit more. but um, the good thing is is that there's an an An enable pin here which allows us to switch off the DC to DC converter. If we're getting low output voltages, say we want a 3.3 volt um output voltage from our power supply.
Well, we can run that directly from the batteries. There's no need for this DC to DC converter. so the software will know that because the software is measuring the battery voltage here. so it knows uh, what the battery battery voltage is.
It knows what output voltage you're set in and what output voltage you're measuring, and therefore it can intelligently decide whether or not it needs to switch on this DC to DC converter, whether or not you can power it directly from the batteries. or you need this converter. and if it switches off the uh converter by um, pin 11 here by pulling that uh low I believe it's an active uh low pin, then uh, sorry, active high. If you pull it low, it switches it off. And the good thing about boost converters is, look what you've got here. When this chip turns off, there's an internal fet ins side here. If you look at the cursor, it goes down to ground that switch. You're basically just switching down to ground.
That's how these boost converters work. But what happens if you switch it off? Well, that internal switch switches off, so pins seven and eight effectively become open circuit. And what have you got? You've got an inductor. Here's your input voltage over here in the top left vbat that will flow through the inductor there and then flow through your Shock Key diode D5 directly to your output.
So if you disable this voltage regulator, your output voltage still works. It just goes through the low impedance inductor here and it goes through a low voltage drop. shocky diode and bingo, you switched off your converter. Now you've got no switching noise, but your circuit can still operate because it's getting the battery voltage.
minus a small drop. You know, 0.3 0.4 volts in the shocky diode? Maybe half a volt. um, at most say, and a small drop across the inductor here. which is, you know, 01 ohms or something like that? it's going to be very low cuz it's a 3.5 amp inductor.
But that's the beautiful part. these boost converters. You can just switch them off. It's not unique to the MC Uh, 2253.
Any, almost any boost converter when you in disable them like this will just allow the power to pass straight through unimpeded. So we get the Best of Both Worlds At low voltages. our supply is still low noise because the switch is turned off and at higher voltages? Well, you know you've got to use your DC to decent converter. so your output noise might go up a bit, but not a huge deal.
So I really like that versatile capability. Now as for setting your output voltage I Said we've got an E squared uh pot because we need software control of that output voltage. Well, here's here's your formula for your output: uh, voltage here. Pretty standard, uh, stuff.
Exactly the same as for most boost regulators and so therefore this R1 resistor down. here. We can modify that in our circuit via the E2 pot here and that's exactly what we're doing now. R38 Here, this is a 2k2 and from that formula, you can calculate your minimum and maximum requirements.
Let's say our minimum. We want to be 9 volts. So it's either this thing's either switched off or it'll give 9 volts minimum and we want 22 volts maximum. Well, you can calculate using that formula what the values need to be. In this case, it's going to be 600 ohms. Uh, total to give you 9 volts. Or if it's a 1.6k resistor here, that will give you 22 volts out. So you just want to design this part of the circuit with the pot which is a 5K pot, it's going to have 5K It's going to be 5K 128 Taps That's plenty for you know, this sort of thing.
We could have easily used a 64, but this one was. uh, fairly cheap. Even 32 would have been plenty of TAPS Heck Even 16 would have been quite, uh, reasonable. So we can get away with uh, just doing that.
If you do the Um follow the formula. the value of 5K in series with 820 in parallel with 2k2 gives you um, the 600 ohms uh output or close enough to it which will give you the 9 volts. and when this pot in the wiper pins five and six here are your 5K pot zero to 5K adjustable. And when it's 5K + 820 on 2k2 that gives you 1.6k total EXC 22.
So really, even if this thing Powers up and the software is doing something really stupid, then um, it. it doesn't matter, it's it's not going to like massively go over voltage or under voltage or something like that. So really that those values work out quite neat. Now the other thing about the Um mCP 40 4017 T is that it's an I C interface now.
Um, these microchip eare pots come in many uh, come in different types. One of them I Squ C interface, the other is your traditional up down uh counter pin. So you just toggle a pin and there's an up down pin and you can move the wiper up and down like actually like in a manual uh type manner. but that requires extra pins.
And here's another cascaded change we've got. if I chose the one with the up down pins, I would have needed more output pins on my IO expansion device. Remember I had uh two IO expansion devices before now I've saved cost and I've only got one. and one of the reasons for that is because I've Consolidated many of my parts in this rev C to use the I Squ C bus instead of the SPI bus.
so I parallel them and I don't use any extra pins on my microcontroller. Brilliant! So let's take a look at this change. I Had two of these devices before now I've only got one. How have I done it? well? I've What I've done is um I've now I've got my RGB LEDs here on the output of this chip which drives the Rgbs from Uh for the Um LCD backlight.
I Originally had those come in from the pulsewidth modulated Uh pins on the microcontroller, but I decided that wasn't a hugely uh, valuable capability and I could, uh, sacrifice those pins and put them on the Uh IO device over here. it might be more difficult to PE WM them. you might not even have that capability at all. but H who cares? It's only the freaking backlight, right? No one's going to care.
If it means saving cost and freeing up pins for better functionality then I'm willing to sacrifice that. So I've now done uh five switches instead of four because I removed my 5vt Um output socket so I can add an extra IO switch there. So I've got my five switches plus the three RGB LEDs But what happened to all of my um, uh, extra Uh ones I had on the second chip over here? Well, I've actually Consolidated them on the microcontroller. but how did I do that? because I didn't have any free pins last time. I was absolutely maxed out and you guessed it, I maxed out again. but I managed to gain a couple of pins by ditching the SPI interface. remember that bitbang SPI interface I was using? Well, I got rid of that and I Consolidated with Um Iqu parts. So on this I Squar Se bus here SDA and there I've got two pins and let's have a look at what we're driving here.
We're driving not only our E SED uh, pot here. Um, we're doing that. So we got that capability for no extra pins, but we're driving our LCD as well just like we were last time. So we got our LCD and I Chang my deck here from an SPI deck to an I Squ C deck and um, I think it might even be a few cents.
uh, cheaper as well. But I freed up those three pins on the Um on the on the micro because I've gone for an I Squ C device instead of Spi. So really, that was a bit of a no-brainer So these things Cascade down and I freed up all these pins. Now you probably wondering where is my analog to digital converter? Well here there's another tradeoff now which we need to get into because it's an important uh, major change from the previous version.
As you know, my previous design had a 12-bit analog 4 channel 12-bit analog to digital converter. Well, I've ditched that once again, saving some more cost CU That was also an expensive device that was actually the second most expensive device um, on my design I think it was like uh, $250 or something. third most expensive apart from from the voltage uh, regulator. So really, by ditching that, um, that was a big decision because I basically had to decide that this was no longer going to be a really high Precision uh power supply.
and the reason I wanted uh I was using that is because I wanted excellent resolution on my current uh ranges from my micro current capability and you'll notice what's also missing from here that was on the previous version I've ditched my I and my uh microcurrent capability or have I And here's my previous revb schematic and as you can see, there's my analog to digital converter plus the buffer uh, voltage followers here and that micro current uh capability which I thought was quite novel and I really didn't want to give that up. but I thought well, how can I keep that microcurrent capability or very close to it while actually ditching it completely? It sounds ridiculous, but I found a way to actually do that I ditched all this circuitry and I've replaced it with I've replaced it with another device over here which is an Ina 219 and we'll take a look at that and what I've done is I Basically decided: Well uh, a power supply like this is not really I didn't really design it to be a Precision current constant current generator. so having that uh, you know, 10bit uh Dack that Jewel Channel deck which I was using in here to drive the Uh current capability. If you remember that here, it is over here. I have my dual Channel deck driving both the voltage and the Uh current as well. Well, I don't really need to drive the current with that higher Precision it's just overload protection pretty much or just fairly rough. um, you know, current output set constant current output capability I didn't need 10 or 12 bits resolution on that, so I decided. Well, that was a bit silly.
so I could live with 8bit resolution on that. Really, it's not a big deal, but I wanted to still accurately measure the current using a 12-bit analog to digital converter and that's what I did before. I had my current sense amplifier here my Max 480 going into my 12bit 8C and I still wanted to keep that measurement capability and that full range because this previous design could measure Um up from anywhere from a microamp up to 2 amps. It was a huge measurement range that no other power supply I know of actually has that and I was able to keep that by choosing the Uh in 219 and going back to a rough and just so my actual capability of measuring the current is still uh, very similar.
but I've got a rough Pwm deck down here so I decided the Iset comes directly from a Pwm output. Put the OC uh 1A output on my Um Arduino microcontroller over here to control just the Uh. just the Uh Uh constant current Uh capability. Plus that allowed me to go to a single Channel DE getting I Squar C version lower cost and it all starts to flow together and you start really getting that tingly feeling when it all starts to you know, fit together and all these design decisions and changes actually seem to be going in your direction for the better.
So let's start by taking a look at the Uh. Constant Current circuitry is exactly the same before, but except I'm using a Pwm Dack which I went through in an early video. it's exactly the same Um error Uh current limit comparator down here. it's all exactly the same.
No changes from the previous Uh two versions, but up here I decided I'd go back to the Rough and Ready LM 35 eight um uh differential amplifier Just the single opamp differential amplifier because I didn't really need um, you know, really Precision uh low offset capability for this current like 2 milliamps uh minimum would have been fine. and if you know the LM 358 it's got you know in the order of several Mill volts offset voltage. So what I did is I upped the um the current shunt resistor here. it's actually 1 Ohm.
So I put 10 10 ohm resistors in parallel to give me a total uh shunt value resistance of 1 ohm here and that gives me with a um a uh zero to Uh. It gives me with a 2 amp output range with a 10bit um digital to analog converter. it gives me 2 milliamps per bit. So if my um if my Uh Pwm here is a 10bit, I can set the current in steps of 2 milliamps if it's only 8bit, I can set it in steps of uh 4 milliamps per bit. And really, that ties in well with the offset voltage of the LM 358. So I'm only going to be a bit or two out and you can correct for that in software. Perhaps it's not a big deal, but what it means is that you're also dropping one volt if you got 1 amp maximum output current capability which our Lt380 is capable of. you're also dropping 1vt maximum across the 1 ohm shunt resistor here.
and uh, you're dissipating some of the Uh Power in that. But it's not really a big deal. it all comes out in the wash and also that 1vt capability will be important. Uh, when we look at the Ina 219 later.
But let's just look at the um this capability here a bit more. I've got a a low pass uh filter here just to filter out any uh switching noise or transient, uh, noise from the loads or anything like that. So um, you might be wondering what this voltage follower opamp is doing in here. Why don't I put just uh, the end of R17 there directly across the shunt resistor because that's how I had it in the original when I talked about this um, uh, single opamp, uh differential amplifier before.
That's what I did. Well, there's a very good reason for that because uh, as you'll see later, the In 219 will allow us to measure down to 10 Micro amps uh, per bit load capability. So very low. So let's assume that our load our our output load here is only drawing 10 microamps.
Okay, it's very, you know, got your microcontroller, it's in shutdown, or it's a very low power design. You want to measure that? well. Uh, the Lt380. It's going to use some current of its own.
It's got 10 microamps down this set pin. It's going to be fairly constant. The Lm334 is set to 677 microamps. It's got a temperature uh coefficient, but it's not going to change a huge amount.
So basically, uh, we have the capability to offset this uh current in the set pin and the current through the Ln 334. Zero it out. So I'm going to dedicate one of my front panel switches to a zero capability and I thought I'd Do this way Back in my first revision of my design have a switch dedicated to just zeroing out the current. You disconnect your Uh output load and then you can zero out the current from the AL P380, the Lm334, and anything else which is attached to this uh output line from your current shunt resistor.
And the thing is, uh, that, um, because your output voltage is a fixed value, you a fixed output voltage. The current should not change in these two devices. it'll only change with temperature, which won't be much at all. But aha, look at this circuit here with R17 and R18 Here here.
the Output: The current flowing through those two resistors is going to change depending on your load current. So if your circuit's drawing different Uh load currents, then the value you've zeroed out is no longer accurate because it's changing based on the amount of current flowing through. R17 and R18 will be dependent um, not on the output voltage, but depending on on the output current because you'll have a different output voltage here. so the voltage drop across R17 and R18 will actually differ and you will get current through there. So there's an error term there which is dependent upon your the output current of your power supply, so you can't zero that out. It's a really very small trap, but very significant that could have ruined the capability of measuring small currents on this device. So I had the spare LM 380 It's a dual chip device I Just put that as a a buffer in there. It's a long explanation, but that's why the Buffer's there.
So there's no current flowing or insignificant current flowing into the non-inverting input of that opamp. So we now have the capability to zero out any current draw from the Lt380 and the Lm334 and the output diode. If it's got leakage in the output caps and anything else, or even an output load as well, you can zero it out. And then we can use our In8 219 to accurately measure anywhere from low to high values urrent.
Let's take a look at that one. So the In 219 device. It's not that cheap at you 100 off quantity $185 But you got to remember it's actually replacing that LT uh, 380 that we had. Sorry, what is it? Yes, the sorry.
the max 480 we had here. It's replacing that. Plus, it's replacing the very expensive analog to 12-bit analog to digital converter down here. So it's replacing those two devices with one at probably less than, uh, half the cost.
So it's a win. So let's take a look at this novel device. I Love it! It's uh described as a zero drift bidirectional current power monitor with I C interface and Bingo I C magic term. It means we don't need any extra Uh pins like we did before so we can actually, um, share once again, share our I Squ C buus.
We don't need any extra pins on our microcontroller. Brilliant! So we've got like four I think one, uh, two, three, yeah, four different devices. Uh five. actually.
With our Iio expansion, five different devices hooked on to our Iqu C bus I Love it! We're really maximizing the capability of those IO pins on that microcontroller. and that's exactly what the Iqu C bus was designed to do to free up pins on low pin count microcontrollers. So anyway, let's look at this device. It's high accuracy 0.5% over temperature.
It's got 16 programmable addresses for the I Squ Se bus. It can actually measure current, voltage, and power anywhere from 0 to 26 volts. Brilliant. We're doing 0 to Uh 20 odd, so that's great.
It's available and easy to use Sock 23 or S8 package. It's great. It's got calibration registers, filtering options, but let's have a look at what's inside it and it really is an excellent device. This VN uh, plus and VN minus here in the top left. Um, that goes across your current shunt resistor. And then it's got a programmable gain amplifier which is a bit of a misnomer because it's a more like a programmable attenuation uh, stage as we'll see. and it's got a 12bit analog to digital converter built in. It's um, it's powered from a 3.3 volt.
uh Power Supply Plus It can actually measure voltage and current and power and then actually calculate the power based on internal registers. We're not actually going to use um that capability because we don't need to measure the voltage it takes. It measures the voltage on the VN plus pin over here so it can actually uh, calculate um that uh. With that value and and the no and current and the ratio you program in for your current shut resistor, it can actually output a Direct Value in power.
But we're using it for its 12-bit analog to digital converter and it's programmable Uh gain SL attenuation capability. Now let's take a closer look at the specs here. Let's take a look at the offset voltage here and with the PGA set to a gain of one. Okay, we're talking it's got plus Minus 10 uh microv volts uh offset uh capability.
So uh, let so I'm going to use that as the bottom well that that is the bottom line system capability. Remember we're using a 1 ohm current shunt, current shunt resistor. So really the best case we can get there is um, it's Plusus 10 microvolts offset. So our that's going to uh translate to plus - 10 microamps uh measurement capability.
So um, you know it's got a maximum of plusus 100. but eh I don't know. Let's go for our typical value, shall we? Just for the purposes of today's experiment. Now the problem with that is with a 12bit Um, if we look up here full scale current sense voltage range.
With the Pr programmable Gain Amp set to Uh one gain of one, we can only get a maximum of 40 Mill volts input voltage from our current shunt resistor. And because our current shunt resistor is fixed at 1 Ohm, that only allows us 40 milliamps maximum current. So this device, if it didn't have this programmable gain amp, if it just had a gain of one, we can only measure from zero to 40 milliamps which is great if you only got a 0 to 40 milliamp Supply But our supply is zero to Uh 1 Amp capability. so we need a way to measure greater values and we can't change our current shunt resistor or we could.
But then we need extra circuitry to do that, mosfet switching, and Mxing, and oh, it gets all really quite ugly. So what we want to try and do is use that fixed 1 Ohm current shunt resistor and change. This program will Gain Amp here to give us and if you take a look at it, if you put in a programmable gain app that's not plus eight there, that's actually divide by eight in there. so it's actually an attenuator so it can give you a maximum it can tolerate or measure a maximum of 320 M volts across that current sh resistor input and at 1 ohm, that's Z 0 to 320 milliamps and it's got a couple of ranges in between so we can keep. So the Um Micro controller the our Arduino can uh, know what current is coming out of this thing If it's overrange, automatically switch the range this programmable gain amp and actually keep very high resolution regardless of what current it's measuring. so it can actually measure any current accurately. At 12 bits from 320 milliamps right down down to a maximum resolution of 10 microamps, that's a massive range. Great capability in this one device which only cost like $150 and we've eliminated our two other devices and Consolidated into one so we're still effectively got pretty close to our micro our microcurrent measuring capability, but it's all Consolidated in one device I Love it! It's a really brilliant device and they've got other devices similar in the series that have actually got um, uh, DAC output currents and almost uh, a device which is perfect that actually has a current sense comparator and a Dack as well.
but unfortunately it's not quite suitable so I won't go into that. but you can have a look at uh, that device as well. But hey, we've only got 320 milliamps. where's our 1 amp range? This chip can't do it.
Back to the schematic and that brings us back to our analog to digital converter. We had our 12-bit converter before, but now it's built into this device and we now no longer have 12bit uh measurement capability of our output voltage. But because we've only got a 10bit deck here anyway, why do we need a 12-bit measurement on our output? We don't. We only need a 10bit resolution analog to digital converter to match our Dack So this current sense uh value over here.
we need to feed that into a 10bit ADC and of course the Arduino. The microcontroller has a 10bit ADC built in, so we're going to take that Adcv out and we're going to feed it directly into a pin on the microcontroller. here. one of the ADC zero pins There it is measuring the vout, but it's also measuring the battery voltage.
We're using a second Channel there. This Uh AVR microcontroller has um, multiple Channel analog to digital converters and we're also measuring a third channel here which is our C I out which actually takes the output voltage from here directly from the output of this Rough and Ready differential Uh amp which we're using for our constant current set capability. But because that will give a direct output voltage in volts from 0 to one volt. output of pin 7even there on the Lm358 will be 0 to 1 volt output for a 0 to 1 amp across our 1 ohm current shunt resistor or 1 M volt per milliamp current sense output as my little yellow note there says so That allows us to give us a fifth Uh current measurement measurement range just by having that one extra pin on the micro controller there. Fantastic! So we've got now this huge five spand current measuring capability from 1 amp down to 10 microamps resolution with just a Um current, uh 1 Ohm current Sh resistor, an Ina 219 and a Rough and Ready Uh differential amp here. Brilliant! And of course we have to feed our voltage reference into our Uh microcontrol as well. So we do that in on Pin 21. It comes directly from our 2.04 voltage reference here that that hasn't changed since uh, we first originally uh since our first design.
so that Um reference Powers the DAC and the analog to digital converter as well. Uh, we still got our 0.1 uh, 0.1% uh Precision resistors in our voltage set capabilties so we shouldn't have to trim. any of that in software may have to do a little bit of current trimming in. Um, oh sorry, we've got .1% in our Uh Rough and Ready I guess uh, differential amplifier over here and uh, the current sense over here and we've now got a gain of Uh 10 instead of a gain of five.
So our 0 to 2.8 048 Vol output from our digital to analog converter get multiply that by a gain of 10. we've got 0 to 20.48% M Vols Not a problem, so I'm pretty happy with that. I'm pretty happy with that. We've only got uh, 10 bits um.
output measurement range. We were guilding the Lily before as I said with 12-bit analog to digital converters and 12-bit dacks. Crazy stuff. but uh, hey, it was fun at the time, but now we've Consolidated that into this microcontroller.
Use the internal Adc's We've got five devices hanging off our I Squar C bus. and of course, the more devices you have hanging off your I Squar C bus, the lower values you've got to have in your pullup I C pullup resistors here because every device you add to the bus adds capacitance to the bus. Which changes the I Squ C slew rate which uh, means that you can miss uh data bits so you can't have like a 10K pull up anymore. With five devices on there, that might be a bit dodgy.
so we dropped it down to 2k2. Um, and uh, really? I've added a reset switch here. We've still got our spark Fun! Uh, Ftdi Arduino Compa will interface so that also frees up. You remember how we're talking about removing the heat sink on the back? So now on the back panel connector.
We've actually got room to put the Arduino interface on the back panel of the PCB so you don't have to open the case anymore to get in there to hook on your programming cable to program your Arduino device in there. And that brings us to our ethernet uh capability which I um Wanted serial but uh capability from uh, the very early uh get-go but uh, sort of that sort of morphed into pretty much ethernet only uh capability. although you could actually hook on because we're having expansion sockets. this is not a Um chip, this is actually a module. So we've got uh, a 12 pin um jeel in line interface there and pretty much we've had to dedicate all a whole bunch of pins all these pins down here from 14 through to 19 there through to the for the ethernet interface. But it's worth it cuz we are able to um, uh, consolidate all the other pins onto there. So we were able to free up these pins to dedicate to one of these. uh whis net.
um a Whiz 820 IO uh ethernet module. Let's take a look at it. it's really quite nice. It's uh, pretty new.
It's only been out for a couple of months and it's under $20 or something like that, so it's pretty much one of the cheapest Solutions on the market. Dual in line 0.1 in header, it's all integrated. It uses one of the Wisnet um the Wisnet uh w5200? um uh, actual device on it with a MAG Jack and everything and it's 3.3 volt powered. Perfect.
Um, it's a SPI interface. Of course it's got a power down pin which is excellent because this our design is a battery powered power supply. so if you're not using the Ethernet, you want to power the thing down in the the maximum uh power consumption down here when it's doing 1000 Bas T maximum speed is 120 milliamps A It's not too bad at Uh 3.3 volts. It still, uh certainly allows us to battery power the thing.
It will actually chew extra power when you got if you got the ethernet capability, but it's still not crippling. Um, so the power supply is able to use one of these modules and it's optional extra if you don't want it. don't plug it in if you want it, pay your extra 20 bucks and you plug it in. and uh, add some software and bingo, you've got Ethernet capability on your power supply.
So I I Love that it's it's I think it's well worth. uh, just slipping in that capability and it can go directly on the back panel. now that we don't have that big heat sink on the back, just a cut out on the back Ethernet straight in. We've got room for our uh Ftdi, uh serial programming interface over here and uh, we've got room for our DC input jack and anything else we want to add on there.
It's great I Love it! So really, they're the major um changes to this rev C circuit and hopefully you like it. I'm not going to, uh say this is the final one I Just love tweaking designs like this. That's half the fun. It's just mucking around and you know, optimizing stuff, changing your mind.
There's nothing wrong with doing that, but I think this is a really quite a neat solution I'm pretty darn happy with this one. and uh I don't think I've missed any extra capability in there. all the um, all this operates the same. all the uh voltage regulation and current regulation and stuff like that.
and but uh, We've added. um, we've not only increased our output voltage range from 0 to 20 volts, we're powering from 2 uh, 18650 um cells we've got. It's much more efficient now so we can get a higher output current capability at uh, lower uh voltages and and and it, uh, we extract greater capacity out of the batteries and it's got and we can switch it off low or high noise uh output. With our Um regulator we can enable disable and ah, it's just really quite neat. It's not quite as precision as the Uh previous version I don't think but I think it's a very good tradeoff and it should be a very neat, handy, and novel power supply. So I haven't actually built this thing up yet and uh, tried it out, but uh, it should work a treat. I mean uh, the the battery charging should uh work first. go.
that's not rocket science and the DC to DC converter straight out of the appnotes that should work the es squ pot uh, changing of the um uh feedback voltage there I've done that in uh, other other designs and it does, uh, actually work. Not a problem, but I haven't actually done it with this particular chip. We'll see if that capability works. and once again, um I won't go through like choosing Uh Dodes up here.
It's a um, it's an SK 33a. it's a 3.5 amp or 3 amp. um, shocky. uh, diode there rated to 30 volt.
So hence the number SK 33a 30 volts, 3 amps and our inductor has to be Uh three. You know, at least say three times our output Uh current, uh capability. The Um Mikel 2253 support up to uh I think well, it's a 3.5 amp 3 amp switch switching device, but that doesn't mean you can get 3 amps output capability from it. but we should be able to get one amp out of it.
But that's probably the only major thing which really needs to be uh, tried. But apart from that, I'm pretty confident it should work I Haven't used the In 219 before, but it looks you know I Squar C interface. You got to believe the data sheet can do what it can do and it should be sweet. So I'm probably going to lash up a board for this one and uh, go straight to BCB cuz a lot of these SMD devices real bit of a pain in the ass to Cobble it together I might take a risk and just uh, go straight to the PCB for this one and give it a go.
So uh, there you go. can't guarantee it'll be the final one but I like it. um and I had fun doing it which is the main thing so I'll keep you uh posted on any uh further updates to the design and the PCB when I finally get it done. but let me know your feedback.
Um, if you got any comments whether or not this was a good change or a bad change whether you preferred the previous one or whether this one's um, awesome and you didn't like the last one, let me know or if I've missed something uh, before I go to the PCB please bit of uh, crowdsourcing, uh, engineering design Ru check in here I may have missed something if I've done something dumb on the schematic. uh, let me know. I'll post the schematic. uh, it'll be linked on the website so you can download it as a PDF So until then I hope you enjoyed it.
Catch you next time.
Bad change Dave
where can I download the firmware of your project
How does U12A work as a voltage follower? U12 pin 8 is tied to V+ and when there is no current or very little current through the 1 ohm sense resistors pin 3 will also be V+. The LM358 is not a rail to rail op amp so pin 1 will only go to Voh. I understand why the voltage follower is there but I don't see how this current sense circuit could possibly work.
Dave. You disappoint me. In one of your videos, you criticize the schematic designers for putting their ground all over the place. Here you have drawn a diagram and you have your ground pointing in every direction. Come on dude???? I know you can do better than that. And you forgot to add an LM555. The flashy lights always make a circuit more impressive. I just had to give you some "negative feedback"😝
I’m trying to do something similar with an lm317 just because that is what I have, but I cannot get the lm358 to work as a differential amplifier like shown, anyone else have any luck with using the lm358 as a differential amp?
Where in Jupiter's name is part 13? All this and we are yet to see the final version, such disappointment 🙁
i found it amazing how one little change leads to an whole new design, i like that mentality
@EEVBlog: Hi Dave, always love your video's! Will there be a part 13 for this project? I Really would like if you share the gerbers files and Arduino code for this project.
This project would be so great if it used USB PD today (8 years later :P)
Hi Dave, many thanks for this content. What program did you use to draw the schematic and test? Much appreciated.
I would also love to see a really high power variant of this, as yes there are those you can buy, but not an open source design you can modify and build upon.. Say 0-15V, 0-200 Amps. I loved this series as it really helped understand the design of it, design choices etc. But delivering 100Amps at 5V and still have good control would most likely hit other problems…
High Dave, loved the video. I see someone asked for the code. Is it proprietary? Thanks, Brian
You still could use four 18650 batteries. You would charge them each with a TP4056 controller. The output of the batteries could just go to a boost converter to whatever voltage.
I liked the power supply scheme and the narration in the video is very nice.
I think it would be better if this power source could be made with discrete components
When are we going to see the uSupply come back to life? I want one but years later and the project as stalled. Please bring back the micro supply!!! I really would like to see this completed. This is a treasure for us beginner makers and electronic hobbyists. Thank you very much 😀
could you post arduino code
I am a bit confused, maybe someone can help. The "Sense" is for sensing the output voltage, but as far as I see, it runs directly to the Controller, which would fry it, wouldn't it?
Since you dropped the through-hole requirement, it seems like rather than measuring the current in two different ways, it would be cleaner to use the old MAX4080 and switch the Atmega out for an Xmega, which has 12-bit ADC/DAC built-in. A shame XmegaDuino is still missing analogReference and the Ethernet library (and it was no doubt much further behind three years ago when this video was posted).
Revisit on 2016, have the same idea for bloody bench power supply is too bulky. Design a portable power supply, switch model regulator is better in size and power lost and step down is better for battery supply!
Dave, It's great watching all this I am learning so much from it and the other videos.. I am just a hobbyist to this and am working on my first power supply from coil winding a multi tap toroidal transformer to microcontrolled PSU.
Your talking about going CORDLESS but want to hook into a Ethernet cable.. Found a WIFI I2C on digikey free up 3 pins I think and cut that cord. Why not ditch those round batteries as well and go with Li-Polymer 3.7V 10000mAh or two maybe three for more power.
Hope the surprise secret project is you've finished this project because I think your last video rant was you changed the AVR to PIC. Cheers
Dave, It looks great as a field work power supply. Did you make a kit out of this design? would love to get one. Alex
Its awesome…but i saw your schematics and you have used a digital pot with MIC2253 boost regulator. Just wanted to know whether that works out well for you . why did you connect 820ohms resistor in series with it? also the entire digital pot resistance is in parallel with 2k2ohms resistor which reduces it even further.why did you need to do that? Also the inductor you chose must have been selected for a particular output voltage how does it work well with all the other voltages(dont you face any problems regarding higher ripple)? ….can similar methods be used with a Buck converter like LM2596 or the fav MC34063?