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.

Comments

author
Sam1ive made it! (author)2017-01-28

Hi guys! help please, can't send the code for the button with the Attiny 13. what did I do wrong, the code compiles but no action happens(( how can I improve? is it possible to feed from the batteries with sleep mode attiny to last longer worked?
Here is the code for the Arduino and it works great:

=====================================
#include <RCSwitch.h>

int button = 12;

RCSwitch mySwitch = RCSwitch();

void setup() {

Serial.begin(9600);

// Transmitter is connected to Arduino Pin #10

mySwitch.enableTransmit(10);

pinMode(button, INPUT);

}

void loop() {

if(digitalRead(button) == HIGH){mySwitch.send(11235377, 24);}

delay(500);

}

============================================
And this is the code for Attiny 13, the code is loaded but no action, help to fix the problem

===============================================

#include <RCSwitch.h>

#include <avr/io.h>

#include <util/delay.h>

int button = 3;

RCSwitch mySwitch = RCSwitch();

int main( void ) {

// Transmitter is connected to Arduino Pin #0 (PB0)

mySwitch.enableTransmit(0);

pinMode(button, INPUT);

}

void loop() {

if(digitalRead(button) == LOW){mySwitch.send(11235377, 24);}

_delay_ms(500);

}
===============================================

2017-01-28_115047.jpg
author
Thijxx made it! (author)2016-09-26

I only put these two lines in the Loop to actually see the data on the serial monitor, took me a day or two to figure that out! Not sure why it fixed anything..

unsigned int data = man.getMessage();

Serial.println(data);

2016-09-26 21.42.35.jpg2016-09-26 21.42.30.jpg
author
LightningLion (author)2016-09-15

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.

author
ZenoM1 made it! (author)2016-07-19

Hello Guys, I see that comment still be recent so I'll post my problem.

It's the second day that I'm not able to make the Arduino read the signal coming from ATtiny85. So with the last try I made the Arduino send an Manchester data to himself and it works. The picture show two signal (sorry for the delay and the low quality), the yellow one is the one generate by the Arduino and the violet is the one from the Attiny. The yellow is maybe a little cleaner but they are the same (no?), well the Arduino read the yellow one but not the violet, any suggest ?

Foto del 19.07.16 alle 12.24.jpg
author
stercenio (author)2016-07-08

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.

author
RobertoM64 (author)2016-03-06

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

author
DiegoP71 (author)RobertoM642016-05-20

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?

author
diy_bloke (author)RobertoM642016-03-09

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

author
DiegoP71 (author)2016-05-20

Uff...Arduino Uno can't receive!

author
newSogn (author)2016-03-06

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?

author
diy_bloke (author)newSogn2016-03-08

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

author
diy_bloke (author)diy_bloke2016-03-09

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

author
luisfranco1990 (author)2016-02-16

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)

author
Carlos_delValle made it! (author)2015-10-28

I love you guys, it works perfectly. I am using the arduino-libs-manchester-master.zip libraries from the refered blog (thus, Manchester with an Uppercase M) and 1.50 version of the cores from here: https://code.google.com/p/arduino-tiny/

My Arduino version is 1.6.5

Tx_RF_AtTiny85.jpgRx_RF.jpg
author
tdoyle308 (author)2015-09-13

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!

author
tdoyle308 (author)2015-09-13

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

Thanks!

author
akommina (author)2015-04-01

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

author
diy_bloke (author)2015-03-03

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

author
diy_bloke (author)diy_bloke2015-03-04

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

author
finlander912 (author)diy_bloke2015-03-04

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

author
diy_bloke (author)finlander9122015-03-04

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

author
diy_bloke (author)diy_bloke2015-03-19

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

author
diy_bloke made it! (author)2015-03-09

OK, I know this doesnt show much, more a proof of concept. The Attiny transmitter is on breadboad and the Arduino is the receiver. Once I have it in a more permanant setting, I will upload that

P1060009.JPG2761.png
author
mchetan (author)2014-11-17

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)"

author
diy_bloke (author)mchetan2015-03-09

I may have something on this as well. I have the updated manchester
code, but on one computer that code compiles without problems while on
the other computer it does not, Giving the same errors you mention. Both are Arduino 1,06, be it that the
one working is with Ubuntu and the other with Windows 8.
The difference might be in the tinycore.
The core that is working for me, presents itself with: Attiny85 8MHz internal oscillator (BOD disabled)
The one that is not compiling has a core that just says: Attiny85 internal 8MHz clcok, like you have.
Problem is that I am not exactly sure anymore where my cores came from, the one working may have been from MIT

author
diy_bloke (author)2015-03-09

OK this worked very well. Had to initially struggle a bit to get the right updated library and I forgot to first set the correct fuses by burning the bootloader (wrongly presuming the "8 MHz internal clock (BOD disabled)") setting would take care of it,
But now it works.
Great, made my day, finally can set up some remote sensors if i can get the coverage (a few meters).
next step, trying the reverse, sending some commands to an attiny from an arduino.

Great work writing this up man. Very happy with it

author
finlander912 (author)2014-11-17

Before posting this tutorial I spent some time trying out different versions of the Arduino software and had some trouble with the newer versions.

The errors you listed below usually all come together and mean that the Manchester library doesn't support the Attiny 85. The compiler is giving you this error because the variables (TCCR2A, WGM21, TCCR2B...) are not defined for the software.

To fix these problems and make working with this a little easier I would recommend:

1. Download Arduino 1.0

2. Re-download the Manchester library

3. Re-download and install the support for Attiny 85

4. Make sure you have "Arduino as ISP" selected under the Arduino programming tab

5. Make sure "Attiny85" is selected under the Arduino programming tab

author
ibenkos (author)2014-10-18

Smart idea! I really like this project. Thanks for shearig :)

author
mfaber1 (author)2014-09-01

Nice job. Will this library work with "key-fobs" ?

author
finlander912 (author)mfaber12014-09-01

It should work. I just looked them up briefly, but I'm not totally sure what they are. The example program can send any number to the reciever

About This Instructable

40,575views

93favorites

License:

More by finlander912:Attiny85 RF Transmitter to Arduino Uno Receiver (Manchester library /w Arduino 1.0)
Add instructable to: