“Traffic lights” for my home office

This content is 12 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

It’s the school holidays, which means that working from home can be a little… noisy… at times.  Earlier today I saw a blog post from Scott Hanselman where he had hooked a light up to his instant messenger status to tell his family when he was on a call, or otherwise busy with work – and that gave me an idea…

Scott’s solution uses something called a Busylight but a) I’m too tight to spend €49 on this and b) the geek in me thinks “surely I can rig up something using a few LEDs?”. One of the comments on Scott’s post led me to an open source project called RealStatus but that uses an expensive USB HID for the LEDs so doesn’t really move me much further forward…

I decided that I should use my Arduino instead… with the added bonus that involving the children in the project might get them “onboard” too… the trouble is that my electronics prototyping skills are still fairly rudimentary.

As it happens, that’s not a problem – I found an Arduino traffic light program for beginners and, as I don’t have a yellow LED right now, I adapted it to what I do have – simple red/green status (my son and I had fun trying different resistors to adjust the brightness of the LEDs)

You can see the breadboard view here (generated with Fritzing – I’m still working out how to make this into a schematic) and below is my Arduino code (which is also available on github – although I might have worked on it a bit by the time you read this):


// Pins for coloured LEDs
int red = 12;
int green = 13;

void setup(){
// Set up pins as output devices
pinMode(red,OUTPUT);
pinMode(green,OUTPUT);
}

void loop(){
// Change the lights
// turnLightRed();
turnLightGreen();
}

void turnLightGreen(){
// Turn off the red and turn on the green
digitalWrite(red,LOW);
digitalWrite(green,HIGH);
}

void turnLightRed(){
// Turn off the green and turn on the red
digitalWrite(green,LOW);
digitalWrite(red,HIGH);
}

It’s pretty simple really – I just call the turnLightRed() or turnLightGreen() function according to whether I am ready to accept visitors. In itself, that’s a bit limited but the next step will be to work out how to send commands to the Arduino over USB (for some integration with my instant messaging client, perhaps) or even using a messaging service (Twitter?) and some network connectivity… more research required!

4 thoughts on ““Traffic lights” for my home office

  1. Any pictures of it complete/wall mounted?

    … FYI, for network stuff, I have been using the Raspberry Pi combined with a webserver/php and shell executes… Works surprisingly well and easy… so impressed with it…. I have never used an Arduino and not sure if you can do anything similar here.

    (and… been a while since I have been here… Nice (but scary) comment script! Clicked on the comment box and it filled it out with my info… a bit confused how!)

  2. @Wil – no pics yet – it’s a bit ugly right now (a breadboard with some raw components on it) but I’ll post some pics if I ever get to the stage of “prettying up”!

    Could probably do the same with my RasPi, but I’m saving that for another project. Arduino is perfect for this sort of simple stuff (having said that, a RasPi costs about the same as an Arduino Ethernet shield…)

    Comments on this site are standard out of the box WordPress, I think… maybe with some additions via the JetPack plugin. Remembering your details may have been a cookie (left a long time ago, of course!) or your WordPress login? To be honest I’m not sure – it’s all standard stuff…

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.