In parasitic power supply mode, a device sucks its juice from a data line instead of from the power rail. This can be intended or unintended. In the latter case, all sorts of funny things can happen.
Together with a Geocaching friend, who is a carpenter, I have designed a number of caches in the vineyards nearby, which pay homage to early video games. These geocaches are not hidden under a root or a stone, but they are there in broad daylight for everybody to see.
The cache boxes are interpretive signs that provide information about the grapes in the vineyard. The interesting thing is that the boxes have a secret opening mechanism, and inside the boxes, you find a few interesting things, such as a sort of “Game Boy” (upper right in the picture below).
On these “Game Boys”, I have implemented simple variants of video games such as Pong, Tetris, Space Invaders, Super Mario, and Mine Sweeper. You have to solve these games to a certain extent in order to get further information, such as part of the code to open the lock. In addition, you also have to deal with a practical challenge, e.g., solving a real puzzle.
Let us take a closer look at the “Game Boy,” which consists mainly of the box itself, a TFT display, and some buttons.
Opening up such a “Game Boy” reveals that there is not much going on inside the box. In the picture below, you see a 9 V battery, a Nokia 5110 display, and a few cables. Below the display, an ATmega328P MCU is located.
The Nokia 5110 display is very popular since it is so cheap, in particular when directly bought in the Far East. However, it is not very reliable and there is a lot of variance over the exemplars you can get. For this reason, I switched a few years ago to the DOGS102N-6 display, which is more reliable, it is sharper, does not need any background illumination, is very tolerant with respect to the supply voltage, and displays more pixels, namely, 102×64 instead of 84×48. It is a tad more expensive, though. Below, you see an exemplar mounted on an adapter board that makes it pin-compatible with the 5110 display.
Over the years, I replaced all the 5110 displays by DOGS102 displays, which implied that I also had to adapt the firmware. One puzzling observation was that for some “Game Boys,” the displayed image was sometimes turned upside down. I attributed this to cross-talk because the SPI lines were very close to each other on the PCB. And cross-talk is indeed something that is not unheard of in this context. Interestingly, the phenomenon vanished when the supply voltage was raised to 3.6 V. So, I bought voltage regulators for 3.6 V and used 9 V block batteries instead of relying on my favorite 3.6 volt Li-SOCI2 batteries.
Recently, I decided to redesign the baseboard with the SPI bus lines not running close to each other, hoping for a solution to the above-mentioned problem. Well, it turned out, I was completely wrong. Cross-talk was not the reason for the upside-down display.
Supplying power in a parasitic way
The temperature sensor DS18(B)20 communicates using the one-wire protocol. This protocol allows explicitly to power of a sensor over the data line, which is an open collector line that is most of the time in a high state, charging a capacitor in the sensor. This charge is used to receive signals from the master. Using this parasitic power supply mode is a very clever way to reduce the number of required wires since one can do away with the Vcc wire.
The above example is an intended usage of a parasitic power supply. However, there are also unintended ways. When you have tried to minimize power consumption, you may have come across the problem of switching off a peripheral device, which after being switched off still consumes some power. In particular, when we are talking about I2C devices, it is not enough to switch off the power rail. You also have to disconnect or ground the data and clock lines. Otherwise, the device still sucks up power and actually may still be active and functioning.
The best explanation for such a behavior I have found in an Arduino forum thread. Tom Carpenter pointed out that the protective diodes on CMOS input lines are enough to provide power to the CMOS circuits, as illustrated in the picture below.
So, if you want to power down a device, you should either disconnect the power rails and all inputs (and outputs) or put them all on the same voltage level, preferably ground.
Back to the Game Boy
As mentioned above, I checked out the cross-talk hypothesis using my newly designed PCBs. And it turned out that the erroneous phenomenon was still observable. So what next? Although the display is supposed to be not power hungry, I checked the voltage of the power supply pin of the display, which is controlled by a GPIO of the MCU. It turned out to be only 2.5 V. Given that the entire board is sourced with 3.3 V, this was quite surprising. While the GPIO pins may not deliver Vcc, they should be close to it (see the following figure).
The DOGS102N-6 display typically uses 250 µA. So the voltage should be very close to 3.3 V. Inspecting the source code, it turned out that the power supply pin for the display is correctly switched off (as all other display pins), when the system is put in sleep mode. However, the power supply pin is never switched on! In other words, the display ran in a parasitic power supply mode all the time. The box worked nevertheless for 7 years.
I do not have a good explanation for why I forgot to put the code that switches the display on, given that in other games I had correctly done it. But then, one never checks something when it appears to work. The 5110 displays apparently did not have a problem with it at all. With the DOGS102 displays, I experienced the occasional upside-down issue when the supply voltage was below 3.4 volts. In any case, by now I can again use the 3.6-volt batteries and the display works robustly down to 2.5 volts.
A parasitic power supply mode can be intended, as in the case of the DS1820 sensor. However, it also can happen accidentally. In the case of low-power applications, it may lead to excessive power drain. So, if one wants to power down a device, one always should disconnect all connections. A parasitic power supply can also partially hide a forgotten connection to a power supply pin. In this case, the affected device will work less reliably. In other words, when one of the devices shows erratic behavior, it is always a good idea to check the voltage level of the supply pins.