<![CDATA[Wow! I've been blown away with the amount of interest in my wee Space Invaders alarm clock modification. Thank you everyone!
Four days on from my original blog post my YouTube video has been viewed over 11,000 times and details of my project have spread right around the globe, translated into German, Spanish, Portuguese and French… and others I'm still finding!
I've posted the code and the circuit online for anyone else who'd like to try it, but I've had a lots of first-time Arduino users asking for a complete "from scratch" guide via Twitter, email and in the online comments.
I guess from a standing start – without experience of coding and/or electronics – there's quite a lot to it, so I'll make a start for anyone who wants to have a go themselves. Click the link to read more…
Where to start
Before opening up the alarm clock (or even buying one) I’d recommend getting familiar with Arduino and the basic circuit. To get all that working you will need:
- An Arduino (a Nano model if you want to eventually fit it inside the clock). For regular Arduino projects I’d recommend buying an official Arduino Uno, but when space is tight pretty much any Nano clone will do. You can usually pick one up on eBay for around £10.
- A solderless breadboard – around £2 – something like this.
- Some LEDs – pennies each – any old kind… like these.
- Some 330? resistors – pennies each when bought as a bag – any kind… they don’t need to be as fancy as these.
- Some jumper wire – any old solid wire will do, but if you’re planning to get into it, invest in a £10 kit like this.
Getting the Arduino set up
Visit arduino.cc and download the latest version of the software, then install it. If you’re using an Uno you’ll be able to start testing it right away, but if you’re using a Nano you’ll also need the FTDI drivers. It’s well worth following this guide to get started.
If you’ve followed the getting started guide linked to in the last paragraph you should have the Arduino environment running and the blink example running on your Arduino board. Congratulations – you’re half way there.
Wiring it all up
To put the circuit together, simply follow the layout in the diagram below. If you’re using a Nano, make sure to leave the bottom row of pins off the breadboard (otherwise the two sides of pins will short together). Make sure the resistors straddle the gap in the middle of the breadboard. You won’t yet have the little white chip at the left of the diagram, and you won’t need the ‘battery terminals’ lines coming off the bottom, but that’s fine for now…
Testing the program and circuit
At this point you can upload the Arduino sketch from my original post. If successful, you shouldn’t really see much of anything happening.
Now the fun bit – open the serial monitor in the Arduino software and type the number 3, then press return. If everything works, 3 of your LEDs should light. Now type 1, 2, 4, 5 or 6. Each time the relevant number of LEDs should light.
The next step is to run the Python script that will drive those numbers – 1, 2, 3, 4, 5, 6 – from your email inbox rather than directly from your keyboard. Download the Python environment and the pySerial serial port extensions and install both following the instructions. Then simply run the Python script from my original post (you may have to change the COM6 value to another number depending on your PC, and you’ll have to enter your Gmail user and password) and, with a bit of luck, you should have the LEDs updating directly from the number of unread emails in your inbox. It’ll probably take a bit of fiddling to get it working, but if you get stuck please feel free to ask me in the comments.
Congratulations, if you’ve reached this point you’ve got the project 90% working. The chip we left out earlier is called an Optocoupler (aka Opto-isolator) like this and it’s job is to basically switch other stuff on and off. It does this using light, so there’s no electrical connection between the two devices (so, in theory at least, the clock can’t blow up the Arduino or vice versa).
If you want to finish the project, just pop in this chip where shown on the diagram and hook up the switch you want to open/close to the other side. In my case I used the wires going to the ‘demo’ button on the clock, but you could just as easily control a button/switch on almost any low voltage (battery powered) device.
Good luck, and please share your results!!!