Raspberry Pi: reset external I2C devices (not only I2C)

Electronic, and specially computerized, devices likes to hang from time to time. There are many reasons: software bug, hardware error, voltage drop, interference, too long wire, random incident. I’ve learned this hard way during work on my Raspberry Pi based weather station. From time to time external DTH22 temperature/humidity sensor refused to work. Only solution was to cut power to DHT22 for a second (or less). It was kind of irritating to go the attic, unplug sensor and plug in again. Later on I had similar issues with HD44780 LCD display over I2C bus. Device was hanging and only solution was to cut power. So, I’ve found a solution: as a prevention cut power for a second every 30 minutes with a simple electronic device I’ve called “Power Cutter”.

Raspberry Pi power cutter

What is does? Not much. Long story short, it’s a 3.3V power regulator that when there is no input, it is just providing GND and 3.3V voltage. But when HIGH state is applied on input, it “disconnects” GND and shuts down all devices that are using this GND line. Not only powered via LM2950 3.3V (or LM7833 or any other) linear voltage stabilizer. All using this specific GND line.

LM2950 Raspberry Pi Power Cutter

In my application there is cron job executing simple python script every 30 minutes.

Simple and efficient. All external sensors are reseted every 30 minutes. Just in case. Since I stared using this device DHT22 sensor did not hanged even once. And that was the goal.

One thought on “Raspberry Pi: reset external I2C devices (not only I2C)

Leave a Reply

Your email address will not be published.