Dave has changed a few things in the Rev B schematic of his power supply design. Talk on opamp specifications, I2C I/O expansion and AVR microcontroller pin usability.
Hi, it's the next installment in the Power Supply series. Last time we looked at the revision a schematic and I mentioned uh, you know a few things on there I could uh, possibly change and well I've done just that. So let's take a look at Rev B and see what the changes are. And here's the old Rev: a schematic you've seen before and Tada here is Rev B uh one of the major changes, the formatting of the schematic.
uh really, this is now an A3 uh format sheet cuz I really was trying to cram a lot of stuff onto this A4 sheet and I was just able to do it and I've added a couple of extra chips so it wasn't really possible to keep that um, you know, single A4 sheet and I didn't want to split it up. so I've put it onto an A3 I've made it a bit modular and uh, there's a few changes, couple of extra chips and we'll go through them. uh one by one, see what the changes are and why I did them. This modular aspect to the schematic just makes it uh, a bit nicer because it's Adc's separate.
Over here the microcurrent part, the uh USB interface, the uh, the new I squ C uh IO section the power supply I've integrated with the Dack here I could have made the Dack as a separate module like I did the ABC but it's all sort of part of the same one and the Arduino compatible AVR microcontroller plus a few miscellaneous things here I could tidy it up, but uh, now this is the Arduino controller from the previous rev a schematic and uh, as it turns out, I was trying to drive the lead uh on the reset line there and as it turns out, that's uh, not a good thing to do on these AVR microcontrollers because you have to burn the fuse which then means you can't do in system serial programming. so uh, while I could use this as a lead output to drive there, I would only have a one shot deal of programm this micro and that's no good at all and you know you don't know those things unless you read the uh the detailed parts of the data sheet. So I had to free up that uh reset pin there and uh and also I was sharing um part of the ISP interface down here with the Uh SPI bus uh for my Um ADC and Dack or the Uh Dack actually. so I decided Ed to uh, change that around free up I had to free up that reset pin and uh, that really started a whole Cascade of changes cuz as you can see, every single pin was actually used on there.
So just that the act of freeing up that one pin meant it drove me into various design design decisions that um, forced me into using uh, external Iqu C IO devices over here and we'll take a look at those later. But um, basically I didn't have enough free pins. but with those external Uh chips dedicated to IO I freed up a few pins. but um, as you can see, I'm still using all of the pins and as I mentioned previously, I wanted to use an external Uh oscillator as well cuz the internal one uh, wouldn't have been accurate enough for uh, Rs232, uh serial coms, especially over temperature.
So I'm using an external resonator here. it's going to be 8 MHz Um, it's an 18, Mega 168 Stiller it could be a 328, whichever Uino compatible one you desire. But basically I have uh, freed up the Uh ISP interface here which also goes off to a secondary connector which we'll look at I've added a Um cap here to the reset pin I've totally, uh, separated that out and I've decided to drive the Uh RGB leads directly from Uh pulsewidth modulation outputs. We'll probably take a look at that as well. but uh, yeah, there are a few changes and there are a few things I had to keep on the microcontroller as opposed to dedicating them to these IO here. so let's discuss that and you'll notice I've also freed up the ARF pin as well and added some bypassing to ground just if you happen to use the internal reference reference which we're not actually using it because we have external Adcs and decks, but this project is designed to be uh expandable so you can use it. Beyond Its original scope so there's quite a lot of functionality in this circuit now. So how do you decide what things to drive directly from the micro and what things you put on your external IO chips over here? and well, in this case, I've dedicated one IO chip to outputs you can.
These are actually uh, bidirectional. Uh, we'll have a look at these uh in more detail later, but these are bidirectional. IO I squ C interface. they're on the same I Squ C bus different programming address down here I Guess we're having a look at it now, aren't we? So there you go.
You can actually, um, have eight of these chips on the same bus by actually programming them with the three address pins there. So I've dedicated one to uh input switches. so I'm using four of still got four input switches like I used before, but I've got room for four more. So if you're expanding this project um, and you want to add like a a keypad Matrix or something like that, you've got eight Um key Swit inputs.
Or you know you can use them as outputs as well if you really want to. And but I've dedicated one chip to I up here. and because actually this one down here that is inputs, um, it's You know, it's fairly important to be able to interrupt from those. so it it actually has an interrupt output pin here.
So I've taken that back to the micro. so I obviously had to use one of the pins over here for the interrupt input. But because I dedicated this one over here to outputs um, then I didn't need to hook up that uh interrupt output pin back to the micro there. So in terms of these output pins here, which ones have I chosen to actually be on the I Squ C chip instead of the microcontroller? Well, you have to remember that the I Squar C chip once you, um H once you hook things onto here, you lose some Uh capability like pulsewidth modulation and things like that.
You can still do it, but you got to do it via the I Squ C bus doesn't have any internal capability to do uh, Pwm, or other uh, fast stuff like that. So really, um, you only want to put your noncritical output uh signals on here. and that's exactly what I've done. I've put the ADC chip select over here. the DAC uh chip select I've put the Uh range uh IO which actually selects the microcurrent uh range up here. so that's you know that only switches once every blue moon. And lastly, I've got the LCD reset here. so uh, that's a non-critical signal as well.
So and I've got four spare so if you want to hook on any external circuitry you can, you've got those four lines available. So the ones I've actually put on the micro here. let's have a look at them now. Of course, the fast stuff.
like the SPI interface you want to put directly on your micro even though I'm not using the internal Hardware SPI capability which is actually multiplexed um onto these Um ISP pins which I want to free up. so I'm not using the hardware um uh SPI uh interface I'm using just a regular IO So I'm just going to What's called bitbang the Uh SPI interface. but that's no problems at all. But you want it because you want that to be reasonably fast.
You're always sampling that Adcn Dack via the Uh. You know you might sample it at 1 khz or a couple hundred Herz or something. You're always doing it via that. So if you put on the I Squ C interface H there's just overhead there you don't want.
So um, sure enough, I've got the Um SPI uh D in there which is the data comes from the ADC, the ADC data uh out and sorry, the data in which goes to both the Uh DAC and the Uh ADC and then the data output from the ADC there, and um, the interrupt um input. uh coming from the I Squ C device and there's the Um SPI clock as well. So that's the Um SPI interface. That um, interrupt reset pin has nothing to deal with it, so it's only those three pins there, data and clock and the chip select Um is a little bit slower.
so I decided to put those over to the I Squar C because uh, some of the other pins I have to dedicate onto here like there's the I Squar C bu I'm using the internal I S C Uh in inside here see SDA and there SDA and here that means I'm using the internal Hardware I C interface and you want to do that I don't want to have to bitbang that one as well. Um I've got the reset pin totally separate and I've also got the Uh serial the hardware uart output as well and once again, you can tell it's a hardware device because the pin label is Rxd and Txd. There's a hardware art inside there so we're using that and they go off to a generic IO connector or just a header connector we can use for Um serial expansion and these are rotor encoders. Once again, I've got the four signals a B uh phase coming from the two rotary encoders down here and I could have put those on an I Squ C input but I would have had to put it on.
uh, this one here which actually um had the interrupts. um coming back cuz you want to be able to interrupt when you turn the actual knob so it was. It just didn't work out just the way I configured these chips so it was better uh to put those directly onto The Uh, micro controller pins here. and uh, the good thing about the AVR Or you know, a lot of good. um, modern microcontrollers will have this, but they will have um interrupt capability on all the pins. you can see it there. PC interrupt. You know, 18 and so forth.
so 19, 20. So almost virtually every pin has interrupt capability. so we've got interrupt capability on those four uh, rotary encoder inputs there Now before I had a just one LED for indication, but I decided oh, what the hell, I'll Guild the Lily again and I'll use the RGB uh backlight capability in my LCD display. So why not drive them with the pulse width modulator and then you can vary the brightness of those uh three? RGB LEDs So once again, you can't put Pwm on the output of your I Squ C here.
It's just not going to be pretty. It's not going to work. You're better off using the internal Pwm capability of this device. And here's the three here: Uh L, Uh, B, LG and LR.
So they're the red, green, and blue and they're connected through to the pins which have OC or an output compare module OC uh, B and OC A. so you have to make sure you get these on the right pins, otherwise you won't be able to use the internal Um Pwm capability which uses the output compare module. You have to go into and look at the AVR data sheet if you want to understand how all that sort of works, but PW uses the output compare module so there's only a few pins available I think there's only five or six total on this device, so you have to connect those LEDs through to those pins with OC capability and then the entire AVR ISP capability including the Uh select pin. SS there goes up to an expansion or I've got a couple of expansion connectors up here, so that's my generic Um serial interface connector which you can hook up to probably you know, Ethernet, Rs232, isolated Rs232, USB Uh, Wireless Whatever you want to do some sort of Zigby module or something, you can hook it up and it's got full capability interface through to the SPI bus and uh, why not? While I'm at it, make that compatible with those Uh Ftdi, uh Arduino serial programming boards.
So not only can you program the Uh D not only program the micro through the Reg ISP interface, but you can do it through the TX and RX Uh pins which use the internal bootloader in the AVR micro. So these, uh, the bottom five pins here. um, 10 through to six. there are the same pinout as the Ftdi, those generic Ftdi boards you can buy for 5 or 10 bucks or something like that.
So there's a couple of ways that you can program this board and as you can see, I've thrown on the other SPI pins up there as well as the Rs232 hardware uart the reset pin for good measure just in case you need that. for some reason I needed to fill up an extra pin um I was going to put 5 volts on that connector but it on the layout of the board it wasn't that great I got it was like the last pin I wanted to connect and it was just I don't know it it was just in the middle of nowhere and I couldn't get it through. Ah it was a pain in the butt so I decided nah, bugger it I'll put the reset pin anyway and this extra IO one over here is for the key switches. My four switches are already hooked onto there. but uh, you can hook on your own or you can use them for Io or anything you want and that has um uh, 3.3 volts and ground as well. So um, and this has 3.3 volts as well. so you can power external boards straight from those IO connectors and why not just for good measure. I've added an I Squ C bus expansion just a four pin uh seal header there that has SDA and and power and ground.
So if you want to hook on other uh Iqu C devices, you can do that and when it comes to choosing one of these I Squ C serial expansion iOS Once again I did the parametric search on Digi Kean and pretty much for a dip device I wanted and microchip came up again. It's the mCP Uh 238 and it's just an SPI interface. It's got programmable address lines and eight Uh user definable input and output lines. You can software configure them, you send data through and you set them up first and then you can use them as IO just like on a regular microcontroller.
it's great. As I mentioned, it's got an interrupt uh output capability, can actually uh reset the things if you need to and power and ground and that's it. And they're pretty cheap. They're only like a$1 20 and one off or less than 80 cents um in volume.
So pretty much a uh, no-brainer in terms of uh choosing these devices. As for the microcurrent circuit here, uh, it's the same as before except I have changed the gain it was 200 before I've now upped it to Uh 500 so that I can get one microamp bit uh resolution for a 12bit uh converter and that was just nicer than 2.5 microamps I Like that nice round number so that your Uh ADC can read each bit equals 1 microamp and on the output here. I've replaced the reverse uh shocky Diode with an Sa 12 AG uh TVs which is a Um transient voltage suppressor or a transorb or whatever you want to call them. They go under various names and uh, this is a 12volt Xena so it will actually clamp any overvoltage Um on the output, as well as offering Uh reverse diode protection as well.
And because I'll get complaints of throwing in the option of the reverse protection Dio between input and output on the voltage regulator there, if you want to use it, put it in, if not, leave it out. One of the key aspects with choosing an Op Amp for this particular design is is that it must have Um capability to have the input pins go down and sense near zero. So it's got to have an input common mode range that includes Zer volts and most Uh single Supply Uh Opamps will usually Um have this sort of thing and it also must be able to go down to Uh Zer volts or near ground on the output. Now if it's a regular dual Supply opamp like the Um Njm Uh 14 58 that I thought from my rusty memory that it actually had that capability. It turns out that it doesn't because um, the outputs from the Uh deck. Here they can go between you know, 0 and 2.04 eight volts and that goes directly into the input of the Opamp there. so it must be capable. The inputs must be capable of going down the ground and likewise the outputs.
Because our output voltage can go down to zero uh volts of our power supply, we need output to go down to zero as well. So we need a good single Supply opamp. And here's the Njm 1458 Uh device and my rusty memory was no good at all. Uh, while it had the Uh input offset I didn't uh bother to check um that it was actually uh single Supply uh capable and it turns out it's it's not.
If we actually go down here and take a look at um, this bit here, the input mode, voltage range Vicm there it is there. then it's only plus - 3 or typical plus -4 vs from a plusus 5V Supply up around here up there. so uh, really, you're um, it's it does not have that capability for the inputs to go down to the negative rail because it's plus - 5, it only goes down to uh, say plus -4 Typically it only does a Vault um above and below the rails. and if you're using it as a single Supply op amp like we are in this um situation here.
As you can see, we've got V+ there and we've got ground. Um, it's a single Supply upamp so it's not going to do uh, what we want there, it's no good. So we had to choose another Op amp. So I went through the parametric searches and all that sort of stuff and bingo um I came up with the TLC uh 272 which should uh, do the job for us.
Let's take a look at this one. Now if we look at the top level specs up here, it says 500 uh microvolts maximum there uh offset voltage at Vdd 5 Vols great Uh, it looks pretty stable. It's power supply capability very important. Uh 3 Vols to 16 volts so that's our maximum input that covers our maximum and minimum input range.
No problems at all. And Bingo single Supply operation. When it says that, then you know, um, that you're in with a shot of this thing having um, you know the output is going to sense ground and it's going to uh, go um to ground on the output as well And it says, look at this common mode input voltage range extends below the negative rail, so your inputs can not only go to zero, they can go a little bit negative as well and some opamps have that capability. We don't really need it here, but if you need that sort of capability, then this thing can do it.
And this chip actually has four different grades available. And the different grades uh determine what the maximum output offset voltage is. So it says here: uh, four output offset grades are available. Um from the Cni I suffixes ranging from the low cost uh TLC 272 with no letters afterwards, which is 10 molts not suitable for us. We went better than 10 molts to the high Precision TLC 277 which does 500 microv volts. Well, let's take a look at um, the various other, uh, the various devices and see which one we need to choose. And by the way, here's that bell-shaped characteristic uh, curve of the input offset voltage. plusus 400 microvolts there for the high Precision TLC 277.
So that's what you can typically expect. Most are going to appear. In fact, in their batch testing, there most appeared um in the center here, which is slightly offset from zero. It's offset by about 150 microvolts or 200 microvolts or thereabouts.
On the positive side, but that's the sort of spread that you can expect. Uh, if if you're really going for some sort of really high Precision application, um, that's where they can fall. Your chances of getting one right out here. right at the spec.
Windows is quite small, but odds are the bulk are going to sort of fall within that margin in there. And here you go. This is the table which uh shows the Uh different offset voltages for the different part numbers from the very high precision TLC TLC 27 CP So it's not the 272, it's the 277. Um, and that's 500 microv volts up there.
So uh, let's uh, take a look and it's available in plastic dip as well. So really, you know, ideally we'd want that 500 microvolts one. but the 277 is quite expensive compared to the 272. So let's see if the Uh 272 in the Uh B grade? There you see how it's got the B after the letter.
there's a C and B. They're kind of out of order. It's weird. you would think that the A would be 10 MTS the B would be 5 and the C might be 2 molts or the other way around.
but no, they've sort of got them all muddled up. Eh, who knows what they'll thinking there when they actually did that. Um, maybe it was an afterthought. they uh, did A and B And then they decided, ah, we'll do a real cheap, crappy C version as well and just mudded the waters.
Anyway, that's from a temperature range of 0 to 70. We're not going to need that full rain, so let's go check out the Uh temperature specs of this thing cuz this is going to be a maximum see Vio Max So let's check out what a, uh, typical value is. And here's the internal circuitry and you'll notice that yes, it's actually Seos. It uses mosfets instead of uh, traditional bipol uh transistors and uh, this is using the Uh Lin Seos process which is a Um silicon gate uh, proprietary Texas Instruments one.
But this is a Seos device and the advantage of using a SE device instead of a more traditional uh BJT uh type device. is that um, generally they're going to be uh, much lower power. They're going to be single Supply you know, input rail to rail input to Output things like that. so uh, sort of. Seos devices are in general going to be a better choice for an application that we're doing here. There's something else interesting in a data sheet. You can see the Uh layout of the die. You can see the Uh output uh, that'd be the output trans resistors there I'm assuming they even marked it on the Uh silicon D I'm assuming that's an accurate Uh implementation of the Dy that they've actually uh using in this device.
And with regards to the common mode input voltage here, you can see let's say at Vdd uh 5 Vols it can actually go negative to down to -0.2 Vols and it'll go as high as 3.5 Vols. So not quite a railto rail input. And here's our guaranteed and uh, typical and Max input offset voltages for the different grade devices a and CG grade devices. So let's take a look at uh say the B-grade here, which is the uh best one out of the in the 272 you've got to go to a 277 to get better and the typical is roundabout look.
It's very similar to the C uh to the 277 Uh model. so the 272b is around 230 microvolts typical so that's going to be typical at 25 see or over the full temperature range. you know it's guaranteed uh to be uh, less than Um 3 3,000 microvolts, 3 molts. Um, so you know it's sometimes it's not good design practice to in general.
You could say it's not good design practice to design around a typical figure. but in our case, because that is much lower than what we need, it's going to be good enough. Uh, don't want to, you know, spend the extra money for the TLC 277. It's like 2 or three times the price or something.
It's not like 10 or 20% extra. It's a significant price jump between that device and that device. So um, really, you know. and there's a big jump between the B version and the next best, which is the A version here.
230 microv volts typical Uh offset at 25 to .9 So that's a big jump there. So you know you probably could get away with the A version, but the B version is probably the Go I think. And as for power consumption in the device, uh, for two amplifiers, a total total of uh, you know, at 25 1.4 milliamps maximum for both amplifiers, it's not the lowest power device uh on the market. but it's good enough for our purposes.
And if you look at uh V here, the lowlevel output voltage. um, if if you drive the input atus 100 molts, um, the output will actually, uh, go down to zero. Typically, that's a typical figure or a maximum of 50 molts. Well, I think we're going to get.
you know it's going to be a lot better than 50 I think. But technically, if you're designing around maximum uh variation specs and it's critical, then you'd have to take that 50 MTS into account. And in theory it won't get down to uh Zer volts output. but you know we don't care if our uh power supply can only get down to 50 molts output.
whoopy do So there you have it. That's uh revb of the schematic and uh, some thoughts into uh why I went into uh changing things and how you saw how just changing that one little uh reset freeing up that one reset pin you know changed drove all my extra design decisions I went to external um forc me to use external iqu C devices I could Guild the Lily with Rgbs and add a few other things and add some more serial output capability. and you know and this is all part of our system engineering. When you're doing this sort of thing which I'll have to do some more uh system engineering stuff in a future video in this power supply series When we start talking about the case and the PCB design and things like that so all that's uh coming up hopefully I've got some PCB uh layout videos on how I laid out the board and I'll talk about system engineering with the case and how that drove some of the design factors and things like that. so there's more to come. Um, if you want the uh PDF of this uh schematic, just go to uh the blog website and it'll be there for download. so I'll catch you next time.
I first watched this build series back in 2013, and at least once a year, I come back and watch the entire series again. Why? When I feel like I am in a slump, this series reminds me why I started doing this. Attention to detail, on the fly problem solving, and pushing the limits of what can be done on a budget. Still love this series on the PSU. Happy Thanksgiving 2018 from the U.S.A..
why you did not used a very cheap(2$) stm32f103c mcu it has a lot of 12bit adc and 16bit pwm and it is an arduino ide compatible and it has a lot of good Features in you project
can I get the full schematic with the code for the IC ๐ would be really helpful
Regarding the TLC277 variants. The C version are rejects from the A and B versions. If the part fails specification testing but passes functional testing then brand it with a C and still sell it.
Where is the link to the schematic? not in part#8 or this one.
can you have the Altium Design original file of this schematic?
I guess this design has a big weakness. You have the current sensing with those 4 resistors. They equal 1 Ohm. So if you drive your Power Supply with 1A load the output voltage does not really equal what you have set it for. Because of the voltage drop caused by the current shunt. So in worst case (max load 1 A), there will be U= R * I = 1V difference. Pretty much if you ask me.
Output Voltage = R_load * I + R_shunt* I
I don't get why you want to bitbang SPI rather than use the hardware SPI port. The chip specifically handles sharing SPI and ISP because ISP is only active when the chip is in RESET mode. It's quite safe to mix the two on the same pins.
Why use two MCP23008 and not one MCP23017?
Beauty!
How on earth can you make a half-hour video of a piece of paper — the same piece of paper –, and make sure the video is not boring?
what approach would you adopt if you wanted a cc/cv power supply to go up to 100v and 10 amp or more? looking for ideas please.
Been watching this from #1, talk about feature creep.. ๐ Well done though, you sir should change profession to teaching professionally, you are quite effective at presenting information in a way people can follow.. Or maybe make a few DVD's teaching electronics for hobbyists to buy that can be more complete and structured than a blog..
what's the software you use sir to plot your circuit & convert it to a pdf file?
thanks in advance
I want to thank you very much for encouraging us, teaching us, give us what you know. The words of gratitude that we use in this way are not enough to thank you a thousand thanksยกยกยกยกยก
@electrodacus same goes with DAC and ADC
i think you should have no trouble sharing the ISP and SPI pins, ISP is simply SPI with RESET acting as a chip-select
just take care to make sure the programmer floats the master out when its idle, and the other chip-select lines are inactive when programming
Watch about these TLC272's I've spend a bit over 200 now and about 2% just burns out with no apparent reason :/, and in the circuit (so it is not ESD)…
If you want to pull it down to 0V for sure, load the output a little (resistor to ground) but you will test that.
In my experience they were all under a mV offset on the output in my circuit (the cheapest ver.) so that is really not needed.
I used them because of really low input bias current that i needed, and single supply operation.
@electrodacus I'm very well of the countless alternatives available, thanks.
@PetrFM 5V is no good when you need >10V :->
For those looking, Dave has made the schematic available on his website.
Dave, don't you just love your project being designed by committee? LOL. Keep up the good work and don't get discouraged!