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.
Finally the bulb housings on my light are big cast aluminum cans so I used the sandwich bag you see there to wrap the whole arduino affair, just to make sure the pins don’t short against it at all.
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.
In Spock Talk, “Fascinating.” Hope your leg’s feeling better. Puleeze get pix. of your new wheels to me soon.
Yrs.,
Timothy
I’m wondering if you’d help me out with something. I’m interested in having a bluetooth device that, upon being in proximity of my iphone, will send an electrical signal to my car alarm remote . Essentially I want to “trick” my remote into thinking the disarm button has been pressed. Conversely, I’d like it to arm when I walk away from the car. Ideas? Thanks.
Jeff – I’ve actually given a bit of thought to this, I’d like to try something like that. Ideally for both my car and my front door. As far as lock actuation, your options are direct CAN bus interface where the primary difficulty is finding the appropriate message and destination address. It might also be tricky to find the right bus – I know in my car there are 4-5 of them, and the one that lock messages go out on isn’t exposed on the OBD-II port. Or you can do what you suggest, wire either transistors or relays up to the buttons on your spare remote and actuate that way. That’s almost certainly fastest and easiest – this guy did something similar: http://hackaday.com/2013/09/05/custom-car-keypad-entry/ Basically, he used a keypad to handle the authentication, but otherwise the same as you propose.
As for making the bluetooth link itself, I don’t have much experience with proximity-based BLE, but there are a few similar projects kicking around to pull from. I’d search for proximity door unlock ble – I want to say I’ve seen this on hackaday too. Combining the two should get you what you want.
That said, BLE is tremendously, catastrophically insecure. Check this video out: http://www.youtube.com/watch?v=0FfvLxW_cZg I have some ideas for what could be done to prevent this being a problem in a car/door application, but suffice it to say using BLE without any kind of additional security layer is a bad, bad plan. You have some security through obscurity, but that shouldn’t be relied on.
This is an interesting enough topic that I think I want to do a full blog post exploring options, perhaps even trying to implement some.