Attiny85 RF Transmitter to Arduino Uno Receiver (Manchester Library /w Arduino 1.0)

44,108

97

26

Posted in TechnologyArduino

Introduction: Attiny85 RF Transmitter to Arduino Uno Receiver (Manchester Library /w Arduino 1.0)

For this project you will need:

  • Arduino Uno
  • Attiny85
  • 315 Mhz Transmitter
  • 315 Mhz Receiver
  • 10uF Capacitor
  • Bread Board
  • Bread Board Jumper Cables
  • Wire Jumper Cables

Step 1: Download Arduino Software, Attiny Support, and Manchester Radio Library

  1. The Arduino software can be found at this link:

http://arduino.cc/en/Main/OldSoftwareReleases

Extract the .zip file so that "arduino-1.0" is in your C://Program Files

2. The Attiny support is a little tricky to install. Go to the link below, download the .zip file and view the "README" in wordpad for detailed instructions

https://code.google.com/p/arduino-tiny/

3. I would like to thank this tutorial for the Manchester library, look for "EDIT (29/01/2012)" and click the "available here" link.

http://mchr3k-arduino.blogspot.fr/2012/01/wireless...

Step 2: Programming Attiny85 With Arduino As ISP

Before wiring the chip as depicted in the diagram, open Arduino 1.0 and open the ArduinoISP example and upload it to your Arduino Uno.

Make sure the correct board (tools>board>Arduino Uno) and programmer (tools>programmer>AVR ISP) are chosen

Wire the Attiny85 to the Arduino just as in the diagram. Make sure the 10uF capacitor is placed negative side to ground and positive side to "reset"

Next, choose the speed at which to program your Attiny85

tools>board>Attiny 85 @ 8 Mhz (internal oscillator; BOD disabled)

Then, make sure programmer is set to "Arduino as ISP"

tools>programmer>Arduino as ISP

When you are ready, click "Burn Bootloader" (tools>Burn Bootloader)

You may see these errors:

avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny85

avrdude: please define PAGEL and BS2 signals in the configuration file for part ATtiny8

These errors are normal and the process worked


Now that your board is bootloaded, you may upload any programs you like.

Step 3: Transmitter and Receiver Code

This is the test transmitter code I used:

#include <manchester.h>

/*

Manchester Transmitter example
In this example transmitter will send one 16 bit number per transmission

try different speeds using this constants, your maximum possible speed will depend on various factors like transmitter type, distance, microcontroller speed, ...

MAN_300 0
MAN_600 1 MAN_1200 2 MAN_2400 3 MAN_4800 4 MAN_9600 5 MAN_19200 6 MAN_38400 7

*/

#define TX_PIN 0 //pin where your transmitter is connected

uint16_t transmit_data = 2761;

void setup() { man.setupTransmit(TX_PIN, MAN_1200); }

void loop() {
man.transmit(transmit_data); delay(200); }

This is the test receiver code I used:

#include <manchester.h>

/*

Manchester Receiver example

In this example receiver will receive one 16 bit number per transmittion

Try different speeds using this constants, your maximum possible speed will

depend on various factors like transmitter type, distance, microcontroller speed, ...

MAN_300 0
MAN_600 1 MAN_1200 2 MAN_2400 3 MAN_4800 4 MAN_9600 5 MAN_19200 6 MAN_38400 7

*/

#define RX_PIN 7

void setup() { Serial.begin(9600); man.setupReceive(RX_PIN, MAN_1200); man.beginReceive(); }

void loop() {
if (man.receiveComplete()) { uint16_t m = man.getMessage(); Serial.println(m); man.beginReceive(); //start listening for next message right after you retrieve the message } }

Step 4: Testing the Transmitter

First, program your Attiny85 with the transmitter code, then change the board setting to Arduino Uno and the programmer to "AVR ISP" then upload the receiver code to the Arduino.

Wire the Transmitter, Receiver, and Attiny85 so that they run off the Arduino's power. Then plug the Arduino into the computer and open the serial monitor. If the project is working correctly, you will see the code "2761" printed over and over in the window.

5 People Made This Project!

Recommendations

  • Spotless Contest

    Spotless Contest
  • Microcontroller Contest

    Microcontroller Contest
  • Space Challenge

    Space Challenge
user

We have a be nice policy.
Please be positive and constructive.

Tips

Questions

26 Comments

Hello,

I do pick up numbers on the receiver. But yeah... plural.

I get 2761, 52666, 12587. These three numbers, randomly. Has anyone experienced this?

I don't get any serial.println at all, yet if I wire the received DATA pin to a LED it blinks.

It's the same for the emitter, I can plug the pin 0 of the Tiny to a LED and it blinks.

Hi Guys, Its been an old project. Thanks for sharing. I wonder how did you guys manage to upload the sketch without serial error for the receiver.

I made it. Distance is not very hight, just 3/4 meters. I would try a different reciever

2 replies

Ciao Roberto! Il mio Arduino non riceve...o meglio...riceve 2 o 3 segnali ogni ora! Ho il dubbio se devo lasciare collegato il condensatore anche dopo aver programmato entrambi i controlli...puoi aiutarmi?

or a better antenna. I am using a similar receiver, albeit for 433MHz and indeed that is not a great one, but with a decent coil loaded antenna I can bridge about 15 mtrs

Uff...Arduino Uno can't receive!

So the attiny code used that works with the manchester library does not work with the 1.6.7 that I prefer running. does anyone know of attiny code programmer that will work with both the manchester library and the 1.6.7 ide?

2 replies

I see no reason why it wouldnt work with 1.6.7 other thanthat i had to change manchester.h into Manchester.h

Additionally, www.codebender.cc has the manchester library included and works well

hi, can i use the sprintf funcion in a manchester lib? and how?

i used in virtualwire lib, somthing like:

sprintf(transmit_data, "%d,%d,%d", id , tiempo , RG); // Generamos la cadena (STRING)

I figured it out using IDE 1.6.5...

Used the arduino-tiny 1.5 cores from here: https://code.google.com/p/arduino-tiny/

Added that tinyfolder to C:\Users\(username)\Documents\Arduino\hardware\tiny

Had to rename C:\Users\(username)\Documents\Arduino\hardware\tiny\avr\Prospective Boards.txt to Boards.txt.

Then the cores showed up in the "boards" pulldown list.

It actually worked! Compiled and uploaded Super excited!

The only error I got was:

Third-party platform.txt does not define compiler.path. Please report this to the third-party hardware maintainer.

But it doesn't seem to care!

Did anyone get this working? I've tried every combination/fix in the comments and keep getting the same errors as akommina.

Thanks!

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Arduino: 1.0.6 (Windows 7), Board: "ATtiny85 (internal 8 MHz clock)"
F:\Arduino\Libraries\libraries\arduino-libs-manchester-master\Manchester.cpp: In function 'void MANRX_SetupReceive(uint8_t)':
F:\Arduino\Libraries\libraries\arduino-libs-manchester-master\Manchester.cpp:390: error: 'TCCR2A' was not declared in this scope
F:\Arduino\Libraries\libraries\arduino-libs-manchester-master\Manchester.cpp:390: error: 'WGM21' was not declared in this scope
F:\Arduino\Libraries\libraries\arduino-libs-manchester-master\Manchester.cpp:395: error: 'TCCR2B' was not declared in this scope
F:\Arduino\Libraries\libraries\arduino-libs-manchester-master\Manchester.cpp:395: error: 'CS21' was not declared in this scope
F:\Arduino\Libraries\libraries\arduino-libs-manchester-master\Manchester.cpp:395: error: 'CS20' was not declared in this scope
F:\Arduino\Libraries\libraries\arduino-libs-manchester-master\Manchester.cpp:396: error: 'OCR2A' was not declared in this scope
F:\Arduino\Libraries\libraries\arduino-libs-manchester-master\Manchester.cpp:403: error: 'TIMSK2' was not declared in this scope
F:\Arduino\Libraries\libraries\arduino-libs-manchester-master\Manchester.cpp:403: error: 'OCIE2A' was not declared in this scope
F:\Arduino\Libraries\libraries\arduino-libs-manchester-master\Manchester.cpp:404: error: 'TCNT2' was not declared in this scope

every program I run that uses the manchester library tells me that it cant find WProgram.h. What did I do wrong?

4 replies

I found a solution already. updated the library. works on 1.06. not on IDE 1.0

Oh ok. That's awesome
I realize that this guide was made a while back and that's really cool if the library is updated.
Thanks for the fix

well to be complete, it compiles without problems... but i havnt put it in an attiny85 yet :-)

That took considerably more effort than I thought. The transmitter went well with the core mentioned, but the receiver didn't. Had to switch to another core. I wrote it all up for IDE 1.06

Have been trying this for a few hours have been getting this
warning please tell me whats going wrong here?

<File Source>\Manchester.cpp: In function 'void
MANRX_SetupReceive(uint8_t)':

<File Source>\Manchester.cpp:390: error: 'TCCR2A' was
not declared in this scope

<File Source>\Manchester.cpp:390: error: 'WGM21' was
not declared in this scope

<File Source>\Manchester.cpp:395: error: 'TCCR2B' was
not declared in this scope

<File Source>\Manchester.cpp:395: error: 'CS21' was
not declared in this scope

<File Source>\Manchester.cpp:395: error: 'CS20' was
not declared in this scope

<File Source>\Manchester.cpp:396: error: 'OCR2A' was
not declared in this scope

<File Source>\Manchester.cpp:403: error: 'TIMSK2' was
not declared in this scope

<File Source>\Manchester.cpp:403: error: 'OCIE2A' was
not declared in this scope

<File Source>\Manchester.cpp:404: error: 'TCNT2' was
not declared in this scope

I’m using an Arduino Uno Rev3 as ISP

Arduino: 1.0.6 (Windows 7),

Board: "ATtiny45
(internal 8 MHz clock)"