Hardware Setup

Author Gravatar Image PHILLIP BURGESS
If starting from scratch, you’ll begin by loading up the Linux operating system on a 4GB or larger SD card. We’ll not go into lengthy detail on this, as it’s already covered well in other tutorials:
For this project, we recommend using the latest Raspbian “Wheezy” distribution. Also, when configuring the system it’s very important to select the proper time zone — this project is time-sensitive.

Before continuing, get your Raspberry Pi to a state where it’s booting, connected to the local network (either wired or wireless) and reliably communicating with the outside internet.

Connecting the Pieces

Plug your sign/light into a wall socket and confirm that it works.

The Raspberry Pi at this point is assumed powered and networked; we’ll leave those elements out of the remaining explanation.
Plug “On Air” sign (or other indicator) into PowerSwitch tail. If your light has an on/off switch, leave it in the “on” position. Depending on the type of lamp used, there might be an AC adapter brick involved; this isn’t shown in the diagram, but would plug into the PowerSwitch Tail the same.

Connect Pin 1 on the PowerSwitch Tail (labeled “+in”) to GPIO 24 on the Raspberry Pi GPIO header. Connect Pin 2 (“–in”) to the adjacent ground pin on the GPIO header. Pin 3 (Ground) isn’t used. You don’t necessarily need a Pi Plate or Cobbler, though those may make wiring easier depending what you have on-hand. A pair of female-to-male extension jumper wires may be all you need.

The two pins on the header are outlined in red here:
Any of the GPIO pins labeled in green can be used instead of #24, just be sure to update the code to match the GPIO selection. Likewise, any other GND pin may be used.

Finally, plug the PowerSwitch tail into a wall outlet or power strip. Nothing should happen yet; that will require software. But if you’d like to test it, try moving the GPIO 24 wire to either a 3.3V or 5V pin. The light should come on.

At first thought it might seem “cleaner” to hide the Raspberry Pi inside your lighting fixture, but this may actually create an awkward jumble of wires. The Pi needs to remain powered on, it can’t be switched with the light. Merging the two would likely involve either a lot of cabling inside the box, or wires leading in and out for the Pi, PowerSwitch Tail, etc.

We felt it was easier just to keep the Pi outside the box, down by the outlet along with the PowerSwitch Tail, then run a single slim power cord to the light:
Last updated on 2014-04-17 at 04.15.18 AM Published on 2013-08-11 at 12.03.13 AM