iPhone Controlled Traffic Light – BLE Shield
I’ve had this traffic light sitting in the corner of our apartment for a while now – I’ve been meaning to do a traffic light project for a long time and I finally got one as a gift, so naturally it came out to Cali with me when I moved. But until now it’s just sat nicely in the corner, all lights on when plugged in and all lights off when not. Well, I just got my Bluetooth Low Energy shield from Seeed Studio in the other day, so naturally it was time for that to change.The BLE shield is super simple in its demo operation – you can download an app to control all its pins, and read values from analog pins configured as inputs. Couldn’t be easier. The only real challenge here is making a quick interface between the arduino and the HV side of things. I could have used a relay shield, but I don’t have one, and I DO have a lot of spare parts and a radioshack nearby. So I made this:
Again, pretty simple. It’s got three DPDT relays picked up from Fry’s around the corner (DPDT just because, for some reason, that’s the only 5V relay Fry’s has, and RadioShack only had two of their 5V relays in stock) and a couple of transistors to drive them. I could draw up a schematic, but frankly, it’d take longer than it took me to put the whole thing together. The header on the right has 5V, ground, and control signals for the 3 relays. These controls drive the NPN transistor bases through 1k resistors, and the transistors ground their respective coils (the other sides are tied to 5V). The common and NO (normally open) terminals on the relays are connected to the screw terminals. Here’s the underside:
The only thing novel here is that I’ve used some copper foil to make traces on the bottom rather than soldering everything pad to pad, which is a huge pain. But then other people have done that too, kind of. Anyway, it gets the job done, and conveniently, the relay Fry’s carries has the coil pins neatly isolated far from the switching pins, so the HV stuff is nicely air gapped from the 5V stuff. It could be better – those pads in between effectively short portions of the airgap, but whatever. When I make a PCB it’ll be better isolated. For protoboard, sue me.
You’ll notice I did take the extra precaution of wrapping the relay board in a healthy coat of electrical tape. Since the bulbs are 60W (i.e. half an amp is flowing through each channel, no more), none of the components should dissipate much power at all and the tape wrap should be fine. Otherwise, one might epoxy coat the bottom and leave the top open to air circulation.
The next step in the project will be integrating everything onto a single PCB and getting it professionally fabbed, probably with OSH Park (I’ve just been loving my boards from Laen!). Cool as the BLE is for use with any iPhone that wanders in the house, I’m thinking my next iteration will actually be powered by a Hope RF RFM12B. I never like the idea of integrating a whole shield into a project, and integrating the BLE chip onto my own board is a project unto itself for a later date. And besides, I think the added flexibility of running the show from a real computer (my bench computer is always on, serving backups and a few other things) will be welcome. And an iPhone app can always be made, perhaps even a nice web app. The next step after that is much more ambitious – replacing the bulbs with LED panels offering graphic display.
Anyway, here’s a video. My roommate’s more impressed than he should be, considering everything took maybe an hour and a half including time to go out and buy the relays.