Following on from parts IIa, and IIb, this should be the final part about the actual electronic design. All that’s left to cover is the switching voltage regulator and the EEPROM for HATS compatibility. Luckily, these are actually both just stock designs. In the same way that software can (and often should) be written with libraries, these are essentially copied designs. I’ll cover the basic parts of the regulator first, then the EEPROM.
Switching voltage regulator – IC4
As we have two power supplies which are both above the 5 V the RPi requires, we need a method of taking the voltage we have and regulating it down to 5 V. The choices are: a shunt regulator (similar to what has been implemented before), a linear voltage regulator, and a switching regulator. Both the shunt and and linear regulators drop the voltage by literally burning away the extra energy. This imposes two problems. Firstly, you’ve got to deal with the heat. Secondly, it’s very inefficient, something that’s important for a UPS as we want the battery to last as long as possible. In the, not unreasonable, case where your device is consuming 1 A at 5 V. For a simple linear LM7805 regulator, the minimum dropout voltage is around 1.25 V, and as a designer you’d be
brave stupid to go to that precise a margin. So, let’s say as a safety requirement, that the input is 7 V. Now, using , we can work out the power dissipation required: W. Given that the device is only consuming 5 W, gives an efficiency of %. In the worst case scenario of a 15 V power supply, those numbers become 10 W and 33% respectively. This requires both a large heatsink, and also some way of getting all that extra heat out of what is likely to be a small enclosure
To avoid this problem we can use a switching buck converter to take down the input voltage with efficiencies in the 90% region across a wide voltage range. I chose to use a TI LM22670 chip as it comes in a space efficient but easily soldered SO-8 packages. Increasingly, control chips are coming in QFN packages, which are much trickier to solder and more difficult to inspect. The values and layout for this design were done using TI’s excellent WebBench design software. To run through them briefly, C6 and C7 are bypass capacitors. Without going into switch mode design too deeply, these see a large ripple across them and need to be specified accordingly. R25 turns on the controller IC. R26 serves to limit the speed of the controller. Generally, as low a speed as possible is desirable as it will be more forgiving of layout and less likely to act as a radio! They values of R25 and R26 are the same – R26 was specifically chosen, whereas R25 just needs to be pulled up to a high voltage. L1, C5, and D3 form the heart of the converter, and I suggest you read up outside about how they work. Switch mode design is not for the feint of heart, but is well worth it!
EEPROM – IC5
The design for the EEPROM is specified in the HATS standard, and there’s very little to add to that. It will contain information which tells the RPi what the board is, and to download any required software. I’d originally powered it from the 3.3 V supply used as the reference for the comparator in part IIb, but user mahjongg on the RPi forum pointed out this could be powered from the RPi’s internal 3.3 V supply. Much better! The values are close, but not precisely, those on the specification sheet. As these are simply acting as pull-up resistors, their value isn’t too critical and as we’ve already used these values before, from a manufacturing prospective, it makes more sense to reuse them.
So – that’s the full design gone through. I hope you’ve enjoyed and learnt some things from it. Next up, the boards will be ordered and built! As ever, any questions or ideas are more than welcome, either here or on the forums.