The PIC24F04KA200 is much better suited to the task. It still is something of an overkill. Although 4K of flash is pretty tiny for a PIC24, the application ended up taking less than a tenth of that. Still, it's 14-pin package and low price make it a better choice.
After some experimentation, during which I got concerned about the base current, I decided to put each of the relays on their own output. The PIC24F04KA200 can source 18 mA per output pin, and the final base current was measured at slightly over 4 mA so there is plenty of headroom.
Basically, the board is supplied with 5 volts which is needed for the relays. The relays are operated by transistors so the PIC doesn't need to see the full current of the relays which it would not be capable of handling. A regulator supplies 3 volts for the PIC, chosen because the PI outputs are 3 volts.
On a signal from the Pi, the PIC waits long enough for the Pi to shut down, interrupts the power for a short time, then re-applies the power which causes the Pi to reboot (the Pi is powered by the repeater).
The final circuit looks like this:
Power Controller Schematic |
A printed circuit board was laid out, the layout looks like:
PCB Layout As Designed |
The "realistic" view of the PCB is:
"Photo-Realistic" View of Printed Circuit Board |
The actual board is not expected to arrive until November 15. I selected the high-priced spread (Accutrace) because they are about two weeks faster than my normal supplier (MakerStudio). They are also extremely diligent. I covered some of the microUSB pins with solder mask because that makes it easier to solder by hand. They immediately emailed me with a PDF showing the issue and asking if that is what I really wanted. That isn't normal but I'm surprised they picked up on that.