An Even Newer, Even More Improved V2 Power Supply
I suppose that there was nothing wrong with the first version of the new SheevaPlug power supply, but since when has something like that gotten in the way of progress?
The new version was driven by the idea that I could have wireless network during a power failure. Along the way, a few other features got thrown in. The final change set ended up like this:
- Added a +12V output to drive a router, switch, and DSL modem during a power failure
- Added an Arduino (ATMEGA328) CPU for some local intelligence on the power supply board itself
- The CPU can measure the voltage on all 3 power sources, as well as the input to the DC-DC converters
- Added an LCD display so that the CPU can display all the voltage information, as well as fault information generated by the FET/Diode controller
- Added a dedicated power input for a solar panel
- Added a MOSFET power relay to the DC input coming from the mains AC so that the CPU can force the system to work off battery or solar, even if AC power is present
Here is what the topside of the new board looks like:
The new board is about twice as big as the old one. There is a good reason though. If you look closely, you can see a skinny white rectangle almost as big as the complete board with 4 screw holes in the corners. The rectangle covers most of the board, but leaves the left edge uncovered, along with another two screw holes in those corners. The interior rectangle marks where the LCD mounts, using the 4 holes in its corners. There are a pair of pushbuttons that poke out underneath from the LCD over on the left edge. One is to reset the CPU, and the other is just a general input to the CPU. Also exposed on the left side are one CPU-controlled LED (a project is nothing without at least one LED), and a 6-pin connector for the CPU's programmer/debugger port.
This time, I used a bunch more of the screw-terminal wire connectors so that it is easier to attach the DC-DC converters. They worked so well on the first board that I am using them all over the place now. They make it really easy to attach wires to a board, and they are really cheap.
There is one digital output that is meant to drive a tiny 'beeper' speaker just in case I decide that I need this thing to sound an alarm. Finally, there is one spare CPU connection that could be an analog input, a digital input, or a digital output. Basically, in case I forgot something, I could wire that last remaining connection somewhere. And it really is the last connection: all the new features use every single IO on the processor. Any more features, and I'll need a larger processor.
One other major change: I got rid of all the fault LEDs from the first version. The 'perfect diode' controller uses LEDs that go dark to indicate fault conditions. In this new version, I wired those same LED signals to input ports on the CPU. I will write some firmware to make the CPU watch for changes on those fault inputs. The CPU will use the LCD display to indicate the exact nature of the fault in English. That is way better than six LEDs mounted close together, where you have to remember what each LED means. I would much rather see a specific fault message like "+5V Fuse Fault" instead of just a dark LED.
It took three days for the board to get back. The soldermask and silkscreen make it look slick:
While waiting for a good time to fab the board, I started developing the software using AVR Studio 4. Since the board was not built, I used the AVR simulator as the back-end for the project. It works pretty well, except for the problems that all simulation systems have when the IO connections and activity becomes more important than the software problems being solved. In any case, I got a bunch of stuff debugged and working: LED driver, LCD display driver, analog converter inputs, and the speaker driver. I wrote everything in C++. In some ways, C++ seems kind of an odd choice for an embedded platform, but I'm happy with the result.
I got the board built up under a stereo microscope. That is the easiest way to solder the small surface mount components. After a while, you get used to it and things go pretty quickly.
It took a bit of fussing to get the debugger board (the board on the left, below) to connect properly, but I finally got it sorted. I had used the Atmel software simulator to get a lot of the basic code functionality working before I soldered up the board, so the software came up really fast:
I only have the +5V DC-DC converter hooked up at the moment, since that one powers the LCD and CPU. You can see from the LDC that the board is showing lots of signs of life. The power coming from the AC line is sitting at 16.3V, while the battery input (actually an adjustable power supply at the moment) shows as 12.0V. There is no solar panel, so the solar input is 0.0V. Besides, it was past sundown when I took the photo, so it probably would have read 0.0V even if it was connected. The little black thing just below the SheevaPower board is a speaker. The CPU can make the speaker 'beep' at arbitrary frequencies and durations when circumstances demand.
The input to the DC-DC converter will always be the highest available voltage source, so you can see from the LCD that it is the AC mains laptop power supply that is currently supplying the power to the DC-DC converter. The other interesting thing is that the voltage to the DC-DC converter reads 0.1V less than the AC supply. That is probably a combination of measurement error in the different voltage divider circuits going into the ADC, or it could be the voltage drop across the MOSFET used to combine the voltage sources.
I have not soldered on the USB interface chip yet. That's the last thing to try out. I'm not worried about it since I have used them before, and it should function just fine.
It turns out that one of the minor flaws with the Rev2.0 board was that I forgot to put pin1 indicators on the silkscreen for the two ASIC on the bottom of the board. I noticed that as I went to solder the USB interface, so I looked up the data sheet on the web and determined the proper orientation by matching the pins it to the wiring on the PCB. I made a mental note of the proper orientation, went upstairs, and carefully soldered it on upside down. Of course, I didn't notice until I powered the board up and was surprised to see it draw 800 mA instead of the more typical 30-40 mA.
Well ^*#@!! I had to get an expert unsolder the ASIC.
Next up: More software...
It will be worth it in the end.