Thursday, 19 January 2012

Wireless sensor node - rf link working (2)

Good news! I have managed to get my RF link working! (Part 1 of this series)

Here are the pictures:

1) The RF base station receiver.

2) The RF transmitter - powered by 3x AA batteries.

OK, so what did it take to get this working?

0) You may wish to read my previous post about getting started with ATtiny85.

1) Two versions of the Arduino IDE.
  • Arduino 0022 - I use this for programming the Arduino and ATTiny
  • Arduino 1.0 - I use this to set the clock on the ATTiny
2)  The config files to add support for ATTiny. I used a combination of 3 distributions.
  • - This adds support for ATTiny85 to Arduino 1.0.
  • - This adds support for ATTiny85 to Arduino 0022.
  • - This contains the RF link library along with some modified attiny45_85 files which need to be extracted and used to overwrite the files from This file is from this thread.
NOTE: Combining the last two of these is a bit awkward so I have combined them into a new zip file which I have hosted here. The contents of\manchester\hardware should be unzipped into your <sketchbook-location>\hardware folder.

EDIT (29/01/2012) - The latest files are now available here.

However, you will still need to get the damellis file to get Arduino 1.0 support.

3) Use Arduino 0022 to program your Arduino as an ISP using the ArduinoISP example.

4) In Arduino 1.0 select the correct ATTiny board and programmer.

Tools -> Board -> ATtiny 85 (internal 8Mhz clock)
Tools -> Programmer -> Arduino as ISP

Set the clock speed by choosing Tools -> Burn Bootloader.

5) Use Arduino 0022 to program your ATTiny. Remember to choose the correct board.

Tools -> Board -> ATtiny85 (/w Arduino as ISP)

Here is the ATtiny85 project which I programmed my ATtiny with:

The only interesting point with the main .pde file is that the #include of the MANCHESTER.h file uses "" instead of <> (#include "MANCHESTER.h"). I had to change this from the example included with the file.

6) Use Arduino 0022 to program your Arduino. Remember to choose the correct board, "Arduino Uno" in my case.

Wiring up the actual circuits was straightforward.

The result of all of this was an ATtiny85 which was able to send a count back to the base station over the RF link. I carried the transmitter around the house and the link mostly worked great. Some numbers came through wrong but the vast majority came through fine and the link recovered after each transmission error.

Next steps? I think it's time to write some code to add error detection and possibly correction to the link.