Daily Archives: November 10, 2018

ATtiny Remote Power Switch for the Raspberry Pi

One of the shortcomings of most highly popular single board computers such as the Raspberry Pi (RBPi) is the lack of an on/off power switch. The board springs to life as soon as you insert the micro USB power cable into its socket. If you simply switch off power or pull out the micro USB cable off the RBPi, you stand the risk of not only losing data but also of corrupting the file system. Therefore, to shutdown the RBPi safely, you need to call a shutdown command, which closes down the file system and takes the RBPi into a safe state, allowing you to remove the USB cable.

The above has been the reason for several projects to incorporate a switch with the RBPi that will safely switch it off without corrupting the file system. Most of the projects incorporate a board sitting on the GPIO header of the RBPi along with a micro USB connector and a toggle switch to control the power supply for the RBPi. The entire control of the power supply comes from a tiny microcontroller on the add-on board, which monitors the state of the toggle switch and the RBPi. In turn, the microcontroller switches a MOSFET and an LED indicates the status of power. This also precludes the necessity of unplugging the RBPi from the power module after switch off.

This power switch from Nanomesher, using an Attiny85 microcontroller, adds a new dimension to controlling the RBPi—it has a remote that you can use to remotely control power to the RBPi. The entire arrangement comes as a kit, and you get a hack able and smart power switch for the RBPi that a removable Attiny85 microcontroller controls. There are also four jumper cables that allow the board to connect to the RBPi GPIO, a high quality micro USB cable 20 cm long, and an infrared remote control.

The project is hack able in the sense you can remove the ATtiny85 microcontroller and reprogram it to provide any type of functionality with the remote. Of course, reprogramming the ATtiny85 will require an Arduino-compatible platform such as the Uno. Other Arduino devices with switches are available, and you may already own some, or you may buy them for experimentation. The ATtiny requires wiring up with the Arduino on a breadboard for the programming.

You can use the included remote or any other remote already available with you. Since the kit is hack able and reprogrammable, you can make it recognize many more signals, changing the timings and functioning of the shutdown. For instance, you may add another button for a hard reset, and reprogram the Attiny85 to recognize it.

Although the kit does a fine job of shutting down the RBPi safely, the presence of the jumper wires to connect to the RBPi makes the kit somewhat cumbersome to use. The project would have been much more useful if the kit could be fitted onto the RBPi in the form of a HAT. Of course, the presence of jumpers does make the kit more flexible since one can select the GPIO pins for connection.