Android 120V Controller

It was worth the wait…I now control 120V via my Android.

ioio android powerswitch tail 120V FTW

awesome project is awesome

I had a mostly sleepless night, again. I managed to figure out what I had been botching while trying to provide enough juice to my PowerSwitch Tail. Transistors and alligator clamps are out; extra pins are in.

Take a look at the (awful quality) video…on the main page, as the picture quality won’t grind loading to a halt.

I still need to toss some headers on the IOIO, and take some clips out of the picture for a better picture of what I did here. Look for that shortly, along with a snippet. Pretty straight forward, but we’ll have to see where this one ends up.

Arduino 120V AC Relay Example

I got tired of poking around with LCD drivers with my Arduino. Time for a quick project to mix it up…staring at a surge protector always puts 120V on my mind. As it turns out, I tore apart an old humidifier a while ago on my ‘workbench.’ Monday night is Katie’s reality TV night…time for something sweet.

Investigating duty cycles on this plastic fan:

fan hack

fan hack

I figured that I could horse around with my PowerSwitch Tail, and make it somewhat mimic a PWM 5V setup. I was curious how long I would have to ‘pulse’ the switch with juice to keep the fan constantly rolling. I started with it fully on, and kicked my ‘active’ duty cycles lower until I reached a nearly-continual state of motion. Pause for Arduino code snippet:

PowerSwitch Tail Template

120V AC Driver w/ LED indicator

Joseph Swanson
2011 |

void setup() {
// declare pins (13, 7) for writing
pinMode(13, OUTPUT);
pinMode(7, OUTPUT);

void loop() {
// Fire relay / LED
digitalWrite(13, HIGH);
digitalWrite(7, HIGH);

// Configure for “on” time
delay (50);

// Kill relay / LED
digitalWrite(13, LOW);
digitalWrite(7, LOW);

// Configure for “off” time
delay (950);

Pause for a small small-video break:

As that code and vid indicate, 1/20th of a second is all it took to keep the fan rolling, with 19/20th of a second idle. Not bad. Not sure what the takeaway is, but that is something to mention.

Put that knowledge somewhere safe, provided the question of humidifier fan duty cycles should spring up.

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.