Arduino AC Interface

I finally got around to throwing out a little proof of concept with my new toy. I managed to utilize a PowerSwitch Tail to gain control of 120V AC with Arduino…and I did it without electrocuting myself. Not getting electrocuted, FTW.

Long story short, the PowerSwitch Tail is a simple switch. 120V AC in, and either 0V AC out or 120V AC out, with the later being the case when a 5V DC signal is introduced to the unit. Here is what it looks like…

switch tail is switchy
Activity: locate brass monkey

I used some jumper wires I had sitting around “the lab.” You can feed anything into that sucker; speaker wire would throw the switch. Moving on…

Well, it turns out that the Arduino loves to dump 5V signals…like it was made to do so. So, this switch setup is perfect for my microcontroller projects…whatever they may turn out. Anyhow, all you need to do is pick a digital out and ground from the Arduino board, and hooks it up. Hooks it up like this…

bonus url
shameless plug

One of the best things (most handy?) is that the IDE makes pushing code to the unit quick. Plug a USB cable in, crank out some code, and there you go.

hook up them shits
hook up them shits

Good news.
It’s MF-ing snippet time!

Relay Switch proof o’ concept

// Assign digital pin 12 for chatting

int ledPin = 12;

// Define setup method

void setup() {

// Define pin 12 as output

pinMode(ledPin, OUTPUT);

// Define loop

void loop()
digitalWrite(ledPin, HIGH); // Switch on
delay(406); // wait
digitalWrite(ledPin, LOW); // Switch off
delay(406); // wait

That is all there is to it…signal for a while, no signal for a while. 406 is a random value, chosen because I like the 406.

I plugged one of Katie’s lamps into the switch…which was plugged into my “lab” power strip.

protip: use discarded tube TVs as experiment stations

Uploaded the code to the controller, and there you have it…

darkness was upon the face of the deep
darkness was upon the face of the deep

Survey says…

let there be light
let there be light, mofo

There it is. I shot a video, but YouTube puked during my upload. Not too upset, seeing as how it was just a video of a DIY strobe lamp. The cool part of this lies in the possibilities to extend upon the concept. Throw a web interface in the mix, and you can have a web-controlled lamp. Replace the lamp with something more useful, and you get the point.

EDIT: 1/24

I uploaded the video I snapped to YouTube…here is a hard-link, and I’ll toss the vid in a post shortly. I think I need to enable video embedding, but if you really have a hankering to watch the thing, knock yourself out.

Leave a Reply