Master
Overview
The Master device is the main piece of hardware that ties the entire remote endpoints together. It contains a radio-frequency (RF) receiver and transmitter and can hence send commands to remote devices and receive commands and data from remote sensors.
Currently the designed hardware connects to an off-the-shelf Arduino using two pins (Analog 4 and 5, to be exact). The Arduino can then in return connect the entire solution to a computer via the USB port. There is no standalone version of the master yet. The Catrpillr software provides APIs and firmware to tie all of these pieces together.
The RF receivers and transmitters are, however, not directly connected to the Arduino. As I noted here, the Arduino’s ATMEGA168 or 328 micro-controller contain one hardware serial port (UART). While numerous software serial port implementations exist, I have found none of them to work with the RF receiver modules (they work fine with the transmitter). The reason being that the RF receiver outputs a lot of noise. The standard SoftSerial library built into the Arduino IDE has the major weakpoint that is uses delays to provide the correct timing, which gets out of sync as soon as you do any processing on the Arduino (such as parsing the incoming packets and performing checksum calculations). The interrupt-based software serial libraries such as NewSoftSerial suffer from the problem that the RF modules change the state of the input pins so often that the Arduino gets flooded with interrupt calls and can’t catch up with processing.
To the rescue comes a $2 piece of hardware: An Atmel attiny2313 microcontroller with 2k of program space and luxurious 128 bytes of memory. It is connected to the Arduino via TWI, using only two pins. The RF receiver and transmitter modules are hooked up to the hardware serial ports of the attiny controller — which provide accurate hardware-based timing when sampling the data on the input port, hence not running into any of the problems the software solutions run into. The site sometimes refers to the attiny as the “backpack module” — my prototype is strapped onto the Arduino with a prototype shield.
Another benefit is that the small micro-controller fully encapsulates the wireless protocol, leaving the Arduino with a small RfLink library to control it.
There is currently no way to hook the attiny directly up to the USB port (without Arduino), this should, however, be a good future enhancement.
Required Hardware
The circuit uses the following hardware (links go to Sparkfun, you can also easily get this from Digikey, Mouser, etc):
- (1) USB-based Arduino such as the Duemillanove
- RES1: 16MHz Resonator
- MCU1: ATTiny2313-20, 5V
- R1, R2: 470Ω
- R3: 1kΩ
- T1: NPN transistor such as 3904
- RFTrans: 2400 MBps SAW transmitter module
- RFRecv: 2400 MBps SAW receiver module
All of the components can easily be mounted on a breadboard for prototyping.
Circuit
In summary this circuit
- connects the Arduino shield to the attiny2313 via the TWI pins
- The attiny PB4 connects an LED which briefly lights when a command is received
- The attiny PB3 controls the transmission circuit – it is only enabled when commands are sent. Without this, the transmitter would hog the airwaves (really, my Oregon Scientific weather station stopped working, it uses the same frequency)
Grab the Eagle schematic or an image thereof.
Getting the Firmware on It
You will have to flash the attiny controller with the master firmware and then put the appropriate Arduino libraries into place. Jump over to the software section for details.