I'm sending some data by 433Mhz transmitter using manchester.h library from here https://github.com/mchr3k/arduino-libs-manchester and I'm trying to wrap my head around message format. In manchester.cpp it is described very poorly.

I'm sending number 1. Here is the code for that:

#include <Manchester.h>
  Manchester Transmitter example
  Try different speeds using these 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 4  //pin where your transmitter is connected

  uint8_t transmit_data = 1;
  void setup() {
  man.setupTransmit(TX_PIN, MAN_4800);
  void loop() {

Here is the screenshot from oscilloscope: Manchester.h message sending '1'

And here is the message for sending 0: Manchester.h message sending 0

In manchester.cpp you can find message format:

    format of the message including checksum and ID

    [    ID    ][ checksum ][         data         ]      
                  checksum = ID xor data[7:4] xor data[3:0] xor 0b0011


But when you look at the actual oscilloscope readings it does not fit at all! Maybe I'm missing something? I'll be very grateful for any help in understanding this topic:)

  • Looks correct according to the code. The format above is not used for transmit. It is 4-bit sync, 16-bit data, and trailing 3-bit sync. Total 23 bits. May 22, 2017 at 10:13
  • 1
    @MikaelPatel But if I'm sending 0, then all 16 bits of data should be 0, which is not the case, Or maybe I'm not seeing something?
    – Em Ka
    May 22, 2017 at 10:15
  • 1
    The data is xor'ed with a decoupling mask (0b11001010 in this library). github.com/mchr3k/arduino-libs-manchester/blob/master/… explained here github.com/mchr3k/arduino-libs-manchester/blob/master/… May 22, 2017 at 11:50
  • The data is sent MSB first with least significant bit first per byte. May 22, 2017 at 12:02
  • 1
    An explanation for this design is available in the header file; "it's common to zero terminate a string or to transmit small numbers involving a lot of zeroes those zeroes may be mistaken for training pattern, confusing the receiver and resulting high packet lost, therefore we xor the data with random decoupling mask". This can be avoided by a start symbol in the preamble. Please example in github.com/mikaelpatel/Cosa/blob/master/libraries/…. This is the Ethernet preamble. en.wikipedia.org/wiki/… May 22, 2017 at 13:13


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.