Go Down

Topic: Manchester encoding library for RF links. (Read 26945 times) previous topic - next topic




This was discovered by mchr.

I wont update my code because mchr has done a great job on improving the library.

I would now direct anyone using this code to use his modifications:



The latest version of this library is now available from the GitHub repo linked from my latest blog post: http://mchr3k-arduino.blogspot.com/2012/01/wireless-sensor-node-code-management.html


I have now added interrupt driven message reception to the Manchester library. Full details are available here: http://mchr3k-arduino.blogspot.com/2012/02/wireless-sensor-node-part-6.html


Can you show us an example of the hardware?  Which RF module?
If you fall... I'll be there for you!

Skype Brighteyes3333
(262) 696-9619


I'm using the following RF components:


You can find similar parts on many sites. There is a picture of my breadboard setup in the blog post which I linked.


Feb 07, 2012, 10:49 pm Last Edit: Feb 07, 2012, 10:55 pm by tytower Reason: 1

These run at 12 V and I get 2 miles
A little higher in frequency but getting the antenna the right length is critical to reduce noise in all of these devices and not enough emphasis is placed on this.

The louder the signal the less the noise in radio . You can always add a signal adjustment pot to turn it down !
Governments should do what they were designed to do only.
Manage the larger issues best done by Government.
My Family and my Property are no


The original code works for RX and TX on ATTiny85.
The new library doesn't work for RX under ATtiny85.

The only issue I had with the previous library the that the timeout didn't work on the receiver and it would block.

Anders 2009

Great work!

This is gold to me. I have been considering rolling my own Manchester encoding library and was quite puzzled that there wasn't one available already.

A little bit unfortunate that it seems to have split/forked into two (carl47 original and mchr3k streams).

Am I right to assume that the preferred version if the new mchr3k version on Github? (as you seem to suggest in you comment above regarding the bug carl47).

Thanks for putting together and sharing!



yes, at this time I would recommend mchr3k version.

Anders 2009

I figured so.

Have the new mchr3k version running now. Had some trouble getting it to work as his example code does not compile... :-/

On the other hand, most of them were minor errors.

Have put together a rig with a laser and a photodiode and sending Manchester encoded data across. Too bad it doesn't decode at this point. Need to do a whole lot of debugging now.




And thank you very much for your work on maintaining this library.

I needed to use the library on an atmega8 but it didn't compile. So I tried changing the MANCHESTER.cpp file to add support for the Atmega8.

I have tested it as a transmitter at 8 and 16Mhz, transmitting about half a meter.

Warning: I am not a programmer, and this is the first time I have messed with timers and such. I just thought it would be nice to at least try to fix it myself instead of just adding an issue and waiting for others to fix it... I know nothing about github, sorry, so I don't know how to do push requests (or is that pull requests) and such. So I post it here instead.

I guess what it needs is a changed timer/interrupt settings to suit the Atmega8, but timers/interrupts/clocks and all that is very new and confusing to me. However, after a couple of hours studying the source code and the datasheet for the Atmega8 I came up with this addition to the .cpp file:

Code: [Select]

#elif defined(__AVR_ATmega8__)
  TCCR1A = _BV(WGM12);
  #if F_CPU == 8000000UL
TCCR1B =  _BV(CS12);
  #elif F_CPU == 16000000UL
TCCR1B =  _BV(CS12) | _BV(CS11);
#error "Manchester library only supports 8mhz, 16mhz on ATMega8"
  OCR1A = 4;
  TIFR = _BV(OCF1A);
  TCNT1 = 0;


I just added it above the definition for the Atmega328, and to my big surprise, it seems to work.


I know this is an old thread.

I was wondering, has anyone done any recent work on this? Is this still the prefered library to use when usinging multiple micro controllers and possible varying speeds?

Is there a way to send a string litteral with this library?


i am currently trying to find a way to communicate with a attiny 45 wirelessly from a arduino uno and cant seem to find any code that works i have tried Manchester but it does not compile it just keeps spitting out erros can anyone help me


hi diasr, im having problems too........im using attiny85 as tx  and arduin uno as rx................ im confused as how to burn 8mhz bootloader?     do use the high-low tech blog method or must i use daemillis core according to mch3k's blog


Hello World,

i want to connect between two arduinos, connected with a wire, per manchester code. Can anyone help me out what is wrong with the code?

Code for recieving:

int homo=13;
boolean empfangen;

void setup() {

void loop(){
  empfangen = false;
 /* do{
   if(Serial.available() > 0){
     homo = Serial.read();

Code for sending:

int incomingByte = 0;     //einkommende Daten

void setup (){
    //initialize serial
   Serial.begin(9600); //definiert einen seriellen Port, Baudrate = 9600

void loop () {
  if(Serial.available() > 0){
    incomingByte = Serial.read();
   /* incomingByte = incomingByte + 1;

Thanks for your help :D  :D  :D  :D  :D  :D  :D  :D  :D  :D  :D  8)

Go Up