We soldered a Teensy 2.0 to a 240V relay then attached a wig wag light to the relay in order to create a nice and noticeable way to alert anyone at the shop for various reasons.  One plan is to eventually hook this to our doorbell whenever we get one of those installed for visitors so we know to open the door for them.  Right now you have to knock really loud and hope someone is in the office to let you in.

The interface is very simple.  Hook a USB cable to the Teensy and any computer.  Then connect through the USB serially and just send it a “1” to turn the light on.  Send it a “0” to turn it off.  It couldn’t be simpler!  Here’s the arduino sketch code we used to make it work:

/* USB Relay

 This is for a teensy connected to a relay on PIN 1.
 Send it a "1" to turn it on (HIGH)
 Send it a "0" to turn it off (LOW)

*/

int pinNum = 1;
int input = -1;

void setup()
{
    Serial.begin(9600); // USB is always 12 Mbit/sec
    pinMode(pinNum, OUTPUT);
    digitalWrite(pinNum, LOW);
}

void loop()
{
    if(Serial.available())
    {
        input = Serial.read();
        if(input == 1 || input == '1')
        {
            digitalWrite(pinNum, HIGH);
        }
        else if(input == 0 || input == '0')
        {
            digitalWrite(pinNum, LOW);
        }
    }
}

Here’s a link to more pictures with more detail:

http://plus.google.com/photos/116575142518321294189/albums/5705228437791855137

Leave a Reply

Your email address will not be published. Required fields are marked *