RFM12B library

I’ve been using the RF12 library from Jeelabs for some time for my Moteino testing. This worked just fine and it was a great starting point. However some things were really confusing and I spent a lot of time redoing the same thing over and over again (eg. copy paste from known working code) just because there was a lot of code-overhead to do simple things like sending, receiving, and ACK management, and of course I couldn’t remember any of the functions or macros. Right from start, the need emerged to tweak it into a more flexible and more configurable library, so I kept hacking and modding it until it dawned on me… a new library had to be born. So I decided to completely rewrite it, and wrap the useful functionality in a dedicated C++ class. I modified some of the core features of the Jeelabs version, like adding another header byte to allow 7-bit source and destination addresses (Jeelabs only supports either source or destination in an attempt to save 1 byte), and allow low level configuration of the radio. This yielded a clean and easy to use, yet powerful library (at least it made my life easy). Here’s a summary:

  • easy API with a few simple functions for basic usage
  • 127 possible nodes on 256 possible networks
  • 66 128 bytes max message length
  • customizable transmit power (8 levels) for low-power transmission control
  • customizable air-Kbps rate allows fine tuning the transmission reliability vs speed (transmitting slower is more reliable but takes more time which implies more power usage)
  • Sleep/Wakeup functionality for power saving
  • Low battery detector with customizable low voltage threshold
  • Interrupt driven
  • Support for targeted ACK instead of broadcasted ACK (possible because of the new source byte in the header)
  • encryption with XXTEA algorithm by David Wheeler, adapted from http://en.wikipedia.org/wiki/XXTEA
  • Support for these chips: ATMega8 family (ATmega168, ATMega328) ATMega2560, ATMega1280, ATMega644P, ATTiny84, ATTiny44, ATMega32u4. So far only tested on ATMega 328/P
  • The source code and examples are on GitHub: RFM12 Library

Continue reading

Moteino – the wireless low power low cost arduino clone

This is and introduction to Moteino, a low cost wireless Arduino clone that I designed for my own projects, but since some people started asking about it i decided to try to make it available to others.

Some time ago I started to think of how I could build a simple network of arduino nodes for environmental data harvesting and home automation, but I wasn’t very happy with the existing solutions because they were either not the right size, not battery friendly, I had to hand solder the kits to keep cost low, etc. Ethernet shields  are also expensive and running wires around the house was out of the question.

So that’s how the Moteino concept was born. It’s based on the ATMEGA328p and has all the pins exposed, runs at 16Mhz, 3.3v. On the bottom it has a footprint for the RFM12B transceiver which is an excellent alternative to XBee radios, which are at least 3 times more expensive.

UPDATE: There’s now a dedicated All-About-Moteino page.

UPDATE: I posted some details about a Leonardo version of Moteino (based on ATMega32u4). For more details about MoteinoLeo click here.

I know there’s many other arduino clones out there that have similar specs. However most of these arduino clones are either somewhat overpriced, they are bulky, or you have to hand-solder them, which if fun for learning how to solder but is time consuming when you just need a bunch of these assembled. If you need 20 or 30 wireless arduino nodes, the time and money you spend can pile up.

So here are the highlights of Moteino:

  • Low cost Arduino clone fully compatible with the Arduino IDE
  • Designed for very low power battery operation
  • The Wireless version includes an onboard RFM12B transceiver and wire antenna
  • Very small size – 1.3 x0.9 inch
  • Breadboard friendly header layout allows you to attach female/male header pins on the top or bottom and make shields for it or just use it on the breadboard for prototyping
  • FTDI programming header
  • Optiboot bootloader for fast programming and no delay startup
  • Onboard LED for debugging or visual indication
  • Standalone version cost is around $10-12 and wireless version about $16, fully assembled

The onboard radio can act as a transmitter or receiver, and I prefer the 434Mhz version because it has longer indoor range and very good wall penetration, but nothing stops you from using a 915Mhz version.  Also if you’re in Europe the 434Mhz and 868Mhz bands are legal, not the 915Mhz.

This is my first revision and I still have some minor tweaks I want to make. But i’ll post updates as soon as i have them.

UPDATE: see my other Moteino posts, including Moteino based projects. Example code and RFM12B library at my GitHub repository.