Adding a power switch

In the last step, we added in a knob to control your internet radio volume. Now, let's add a switch so you can turn your radio on and off.

The code for the power switch is just watching digital pin 4 and if sees line voltage, it turns on, and if it goes to ground it turns off. Unplug your radio and wire the switch up like this:

Power up your radio and flip the switch to the power side to turn it on. Try flipping the switch once the radio starts playing to see if it shuts off.

This guide was first published on Jun 21, 2017. It was last updated on Jun 21, 2017. This page (Adding a power switch) was last updated on Nov 15, 2019.