Alright, I think it’s about time for this silly article on plasma arc waste disposal to get knocked off the top of my site, don’t you? It’s just fluff, honestly. Filler. And I’m tired of looking at it. So how about a post on a real project for a change? Sound good? Great.
First though, a quick gripe. I hate waiting for parts to arrive. Specifically “last” parts. Like that final DigiKey order, or in my case, a shipment of PCBs from Advanced Circuits. You see, I now have everything I need to complete this really exciting new device I’m designing at work, except for the PCBs.
And not having boards is kindof a show-stopper. So I’m crossing my fingers and hoping that Advanced Circuits gets them shipped out early, as they so often do (because they’re totally awesome).
But let’s get down to business. If you happen to have been reading my blog about six months ago, you may remember that I recently moved to the middle of nowhere Waterloo, Iowa to start working for John Deere. Now prior to moving here, finding a place to live has been, for me, frustrating. “Oh, here’s a place that’s nice, but it’s too far away,” or, “That’s way too expensive,” or, “Uh, what’s that growing on the ceiling?”
Not so this time. Deere actually provided a relocation assistant to show me several nice places around town. All I had to do was tell her what I was looking for and BAM, there we were. Plus, the cost of living in Iowa is virtually zero. So here I am, renting a lovely townhouse, about ten minutes’ drive from work.
Now, nothing’s ever perfect, and this place is no exception. For instance, it’s got a nice single-car garage with an opener, but there are two problems. First, the remote control has terrible range. My landlord warned me about this, but explained that I just needed to find that “sweet spot” for it in my car. But this thing is kindof a brick and looks rather like some RadioShack project box.
The second problem is lighting. The garage door opener does have a single light bulb which comes on when the unit operates, but it’s pretty anemic. This isn’t helped by the fact that the inside of the garage is almost all dark wood, either. Plus it seems to take a few seconds for this light come on, and it only stays on for a few seconds afterwards.
So in Iowa, winters are long, dark, and cold. Not unlike a mine shaft, I imagine. But I like light. So I took a trip to Home Depot one weekend, and for about $50 (those motion-detecting switches are kindof steep) solved problem number two quite simply.
Yep, that’s a Lutron motion-sensing light switch, wired into an extension cord, and a simple reflective lamp fixture. And it’s all just clamped to the top of a set of shelves I already own. Easy peasy. And it works like a charm. The switch has two little pots to control sensitivity and on-time. Which is great, because I love adjusting things. So now I can pull into the garage, catch those last few minutes of Wait Wait, Don’t Tell Me, and then hop out and voilà, let there be light. And I saw that it was good (enough).
Now for a while, I lived with problem number one without much complaint. I had to be in my driveway before the remote would trigger the opener, but it wasn’t a huge deal. Then for some reason, it routinely started failing me. My car actually had to be within a few feet of the door for it to open. And more than once I had to get out of my car (heaven forbid) and wave the remote around in front of it. I replaced the battery, but this made no apparent difference.
So again, one weekend I decided I’d had enough and sat down at my workbench to sort out the problem. I popped the project box remote open and started probing.
To make a long story short, I discovered that the transmitter was simply broadcasting a repeating pulse train via (I believe) amplitude modulation. Somewhere in the 800kHz range, although I don’t have equipment capable of measuring such high frequencies with any sort of precision. I can tell you that the DIP switches you see control the sequence of the transmitted pulses to match a particular receiver.
Since I know virtually nothing about RF amplification, and didn’t want to risk damaging the remote, I decided to piece together my own remote from components I had lying around. Here’s what I used:
- SparkFun 315Mhz ASK transmitter module ($4)
- AVR ATTiny13 8-bit, DIP8 microcontroller ($2)
- 5V Regulator
- 9V Battery
Now the precise components specified here aren’t really too important. I used what I had. I would recommend the RF transmitter and receiver though (except that the receiver has been discontinued). These are both pretty amazing for the price; I got them a number of years ago and haven’t yet put them to much use. But they’re fantastically simple. Just apply TTL-level serial data to the input of the transmitter, and watch it appear at the output of the receiver. That’s it. No configuration/setup required. The only complication is that there is no error checking. So you’ll need to be clever about dealing with the occasional garbage data.
So how does this all work together then? Well, when you press the button on the prototype remote, the 9V battery is then connected to the transmitter module and the MCU (via the 5V regulator). The MCU then sends out a slew of bit-banged (since the ATTiny13 has no hardware UART) serial data to the transmitter, which then sends it wirelessly to the receiver.
The receiver then sends this data to the ATMega128 (on the AVR-MT-128 dev board), which does have a hardware UART. If the received data is correct, a relay on the dev board is quickly closed and then opened again. The relay terminals are wired up in parallel with the door open/close button inside the garage. Thus, the action of the relay simulates a real button press and causes the garage door to open/close.
That’s it. Again, pretty simple, right? The receiver, since it’s got an LCD display, also indicates how many times the door has been actuated (either opened or closed). This was a comforting feature during initial testing, because it allowed me to determine whether or not my garage had been opened at any unexpected time.
Well I’ve been driving around with this silly protoboard taped to my center console for about two months now. It’s been working great; I can now operate my garage door reliably from the street (a distance of probably 50′), and this little gadget has made for such a nifty conversation piece that I might just leave it in protoboard form. I mean, a small enclosure would be nice and stuff, but…
Seriously though, if you have any cheap and cheerful ideas for housing the transmitter in a more elegant and robust manner, do let me know in the comments. By the way, at this point in a post I’d usually provide links to my code, but I’m not going to do that this time. I’d rather not make it too easy for the tech-savvy thief to break into my garage, you know? Yea, I’m probably just being paranoid, but still. Lots of crime in Iowa you know. 🙂
Now ultimately I’d like to extend the functionality of my device so that it automatically opens and closes the door when I come and go. If you’re curious about how that might be done, take a look at one of my older posts on the subject. Thanks for reading though, and feel free to pose any questions below!