Before beginning to look into driving the ALPHA Transceiver from scratch via the Arduino I thought it wise to browse around for some advice and sample code on implementation. Two particular sites stood out, the first being a library which was designed for use with Atmel AVR Controllers (what the arduino is based on). The second was almost exactly what I was looking for, an arduino ready library by Jee Labs.
Jee labs is a weblog maintained by Jean-Claude Wippler, an evidently talented engineer. He has an interest in Physical computing and has designed a very clever unit called the Jee Node. The Jee Node was born because he wanted to have an easy way of deploying sensors and communicating with them. The Jee Node (http://cafe.jeelabs.net/lab/jn4/)
The Jee node simply consists of an Atmel “ATmega328” which is the same as the Arduino enabled Micro Controller I have been using. The board contains the bare components required to run the Processor. On the end of the JeeNode is a HopeRF transceiver module the RFM12B, also identical to the one I am using which is simply a re branded copy by ALPHA.
Words from Jean himself in his readme file:
The code is fully open source – feel free to browse and make changes as yousee fit.
Most of the work shared on JeeLabs, Jean-Claude Wippler has made all available under “The MIT License”.
Copyright (c) <year> <copyright holders> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
As stated above so long as the notice is placed with the code there should be no issues using or modifying the code.
Jee Labs “RFM12B library for Arduino”
This library seems perfect for me. It sets the module up as required and allows for communication of data with acknowledgement and checksum all built in. It also allows setting of NODE ID’s and stores these to the EEPROM of the ATmega328 MCU. This means the ID is retained even after power down. The code makes very good use of the Interrupt pin provided by the ALPHA module to do much of the work in the background Key Benefits (Compiled from http://jeelabs.org/2009/02/10/rfm12b-library-for-arduino/):
- The node ID is stored in EEPROM
- Code uses interrupts to do most of the work in the background
- All packets verified with a 16-bit CRC.
- Packets can be sent to a specific node (ID 1..30)
- broadcast to all (ID 0)
+Library Commands of Interest
void rf12_initialize(uint8_t id, uint8_t band, uint8_t group=0xD4);
Needs to be called once with node ID, frequency band, and optional group.