The Wall Street Journal has another article on open source hardware and Arduinos up today.
The palm-sized Arduino serves as an electronic brain running everything from high schoolers’ robots to high-end art installations. But perhaps the oddest thing about the device is the business model behind it.
Worth re-posting. The rxtx lib shipped with the 64bit Koala seems busted. Thanks!
The Wall Street Journal has an article today about tinkering, real hardware, and Arduinos. It’s trying to link it to the financial crisis, more power to them. I started playing with light bulbs and batteries when I was 7 (or was it 8? ;-) and the Arduino is the microcontroller electronics kit I never got in the 80s (right here, I feel old). Has nothing to do with the crisis :-)
I got a pair of these extremely cheap RF Link receiver and transmitter pairs for under $5 each. They operate at 434 MHz and supposedly can transmit at up to 2400bps. I was hoping to be able to build some nifty firmware which allowed these things to flawlessly communicate bidirectionally (well, one at a time), essentially making them into a cheap variant of the XBees. It turns out, these little devices are not quite as stable as I hoped they would be. But there’s still a lot of cool stuff that can be done with them.
434 MHz Transmitter
434 MHz Receiver
They can easily be hooked up to the Arduino data pins. If you want to boost the transmitter’s power, hook the third pin (Vcc) to more than 5V. It can take up to 12V and the more juice you give it the more power it has to transmit, the less dropped data.
Here is where all the fun started. Hooking it up was easy, using the Arduino software serial library to establish the communication is also a no-brainer. Yet if the receiver finds no signal for 10ms, it automatically turns itself into an auto-sensing mode in which is cranks up the antenna gain and starts just outputting noise. This is not only annoying, but also very counterproductive when trying to get a clean transmission. Also keep in mind that these modules are really bare-bones. They send and receive data. There’s no automatic receipt acknowledgement, no automatic resending of packets, nothing. That’s especially hard considering that these devices only provide a one-way communication path.
The easiest way to go around this is to just have the transmitter continuously transmit data, even if it’s just empty bytes. While I got this to work just fine, I didn’t think this was very practical.
My second attempt created an elaborate packet structure around the data and the receiver software parses the packets that come across the wire and rejects them if it can’t parse them. I also ended up having to prepend the packets with a number of unused initialization bytes just to get the receiver to listen again. And since there’s no way to know whether the package made it, I ended up re-sending them a bunch of times to actually get the receiver to acknowledge. From a software perspective that means you have to make sure the commands you send are idempotent.
With all this error correcting logic and re-sending I can easily transmit across the entire room, probably further than that.
I am getting pretty good results with this, but the main takeaway is really already written into the data sheets. The manufacturer outlines that the main application for these modules are remote controls. For anything more advanced which includes multiple transmitter/receiver endpoints and clean easy data communications, XBees are really the way to go (and they’re only around $20).
Feel free to grab the source code .
The Entire Thing in Action
Watch the top Arduino’s built-in LED go on and off and the bottom one follow (top – transmitter, bottom – receiver).
Finally having re-submerged from project chaos, I finally have a little time to spend playing with circuits again. While I’m toying with pieces to ultimately automate the entire house, like an RFID-based garage door opener. I figured I might as well post about individual pieces along the way.
The first one is a relay driving circuit. The goal is to simply drive a single relay (for now) from one of the Arduino data pins. Since I want to use the built-in 5V power, I opted for a simple 5V relay. It’s powerful enough to drive 5 amps on 220V, so that should be enough for most applications. I can’t recommend you hooking up 110V or 220V to a breadboard though! Getting circuit boards printed for this will be my next undertaking, but let’s dive into the circuit a little first.
- A 5V Relay like the Omron G5SB ($1.95 at Sparkfun)
- 470Ω, 1kΩ, 10kΩ resistors (one each)
- A NPN resistor capable of driving the relay (2n2222 or these do the trick)
- A diode such as a 1N4001 or 1N4148 (like this one or this one)
- An LED (every circuit needs LEDs!)
- A breadboard and some cables
The circuit itself is fairly simple. The signal from the Arduino data pin goes into pin 4 via the resistor R1 to the transistor which switches the relay on and off. Notice R3 which is pulls the data line to ground (reduces unwanted triggering of the Relay while the Arduino is not initialized). The diode is also required as it protects the circuit and ultimately the Arduino from so-called back EMF current.
Fun stuff, but all it really does it go click-click-click. But it is controlled via C-code! I omitted the code here because it’s as simple as 1-2-3. If needed, go to the Arduino site and read about how to make an LED blink.
Stay tuned for a write-up about getting the RF Link transmitter-receiver pairs going and hooked up to this.