Saturday, April 26, 2014

Power works in mysterious ways

The GPS reverse geocache boards arrived, and unfortunately will require a revision.

Removing the $30 GPS module to re-use it is the biggest issue, but that's going to be a whole 'nother can of worms.

Anyway.

The system is designed to run off two AA batteries. Measurements of the current draw with the system operating are around 150 mA and with it off the meter shows 1 mA. If you do the math, a 2000 mAh AA battery will be able to supply a milliamp for almost 3 months, or around 10-12 hours of power-on time - that's just fine.

The difficulty is that when I put the board to sleep... it wasn't going all the way to sleep.

To recap, here's the schematic again:

The GPS Pack v1.0 schematic

The controller is directly connected to the LCD data pins. The subtle issue is that the LCD apparently has pull-up resistors on the data lines. That is, a resistor from the data line to power. If you apply a high logic level to the data pin, you're applying power. That power will attempt to flow through the pull-up resistor and power the LCD and the whole rest of the switched circuit!

This also had the distressing side effect of fouling up programming the chip. The programming signals were attempting to "power" the LCD, which was loading them too much. In past projects, I shared programming and LCD data pins, but had never attempted to de-power the LCD, so it worked. Forcing the power pin to on allowed programming this board to work even with the LCD attached.

The fix is two-fold. First, when putting the system to sleep, before turning the power off, you have to set all of the LCD lines manually to low. That will cut off the source of parasitic power. Then switching off the power pin will function as intended. Secondly, unlike past projects, protection resistors will need to be placed between the shared programming pins and the LCD. Hopefully that will be enough to allow programming to work. The only other way to go would be to force the power circuit on when RESET is held low (which it would be during programming). I'm somewhat less satisfied with that, though. I'd rather the protection resistors just do the trick.