Im using a attiny85 to send out a number via rf using the Manchester code. This bit works, i tested the receive on the uno and i can see the numbers im sending out.
Im trying to receive this to a raspberry pi using a rx chip connected to pin 7 on the attiny85 and pin 2 connected to the raspberry pi's rx pin.
#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 2
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
}
}
and the send code:
#include <Manchester.h>
/*
Manchester Transmitter example
In this example transmitter will send 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 TX_PIN 0 //pin where your transmitter is connected
uint16_t transmit_data = 1381717;
void setup() {
man.setupTransmit(TX_PIN, MAN_1200);
}
void loop() {
man.transmit(transmit_data);
delay(200);
}
and ive connected the serial pin to my raspberry pi rx pin with minicom running
minicom -b 9600 -o -D /dev/ttyAMA0
any ideas why i only receive the number 5461 on the pi no matter what numbers i send?
Thanks for reading, heres hoping someone can help me.
Why are you using an attiny85? There is no hardware UART in the device, so SoftwareSerial must be utilized or another library to support serial comm. attiny85-hints
Just use an atmega328P-PU and a decent 16MHz crystal, etc. Under $4 U.S. dollars. But even I do not do this because 328P Mini clones are available from China for under $3 U.S.
You are making things crazy hard on yourself. IF you must use an t85, look to Adafruit Trinket or Digispark for t85 compatible software libs.