2

On Attiny85 I'm using Manchester encoding library with code

#include <Manchester.h>

#define TX_PIN 1

uint8_t transmit_data = 123;

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

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

On Arduino I'm receiving 123 by using serial monitor

#include <Manchester.h>

#define RX_PIN 2

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

void loop() {
  if (man.receiveComplete()) {
    uint8_t m = man.getMessage();
    Serial.println(m);
    man.beginReceive();
  }
}

On Pi I'm using Python library with code

#!/usr/bin/env python

import sys
import time
import pigpio
import _433

RX=23

def rx_callback(code, bits, gap, t0, t1):
  print("code={} bits={} (gap={} t0={} t1={})".
     format(code, bits, gap, t0, t1))

pi = pigpio.pi() # Connect to local Pi.

rx=_433.rx(pi, gpio=RX, callback=rx_callback)

time.sleep(60)

rx.cancel() # Cancel the receiver.

pi.stop() # Disconnect from local Pi.

I'm expecting to receive 123, but nothing happens. I've also tried different MAN_ values with no luck.

Second test

On Arduino I'm using RCSwitch library with code

#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();

void setup() {
  mySwitch.enableTransmit(7);
  mySwitch.setProtocol(1);
}

void loop() {
  mySwitch.send(2222, 24);
  delay(2000);
}

Same setup on Pi and I'm receiving correct code.

The author of Python library believes it should work with Manchester, so there is definitely issue with Pi receiving configuration, as Arduino receives message, but Pi doesn't.

Video while testing using receiver and transmitter

Update:

By reading through source code of all libraries, I'm pretty positive these are not compatible.

Manchester is generating this wave form using phase-shift

enter image description here

And RCSwitch is using pulse length technique generate this wave

enter image description here

I don't have oscilloscope so can't test my theory and assume this is how it works by reading comments in source.

In case Manchester encoding is happening somewhere behind the achene, the other issue could be sync transmission during which receiver adjust to transmission. These are completely different in two classes from looking into source.

  • Two things. 1. The Pi's GPIO are all 3V3 safe only. Make sure you don't feed a 5V Arduino pin directly into a Pi GPIO. 2. Have you connected the grounds? – joan Feb 22 '18 at 18:31
  • Yes both powered from same power supply. The setup doesn't change, only sketch on Arduino: RCSwitch works, Manchester doesn't. Also tested with transmitter and receiver attached - same results – goodevil Feb 22 '18 at 19:33
  • 1
    I've also added link to YouTube, showing how I test setup. Please ignore 4315513 message in a video - this is my other project. – goodevil Feb 22 '18 at 20:22
  • I've managed to transmit and receive data between Attiny85 and Arduino, still no luck on receiving data using Python library. – goodevil Feb 28 '18 at 22:03
  • Have you used (my) piscope or similar to capture the signal received from a good source and compared it with the signal you are transmitting? – joan Mar 1 '18 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.