ATtiny85 + 433 MHz receiver problem

Hello,
I am trying to interface ATtiny85 with the cheap 433 MHz radio receiver & transmitter pair:


The ATtiny is connected to receiver, Arduino UNO is connected to transmitter.
The problem is:
Arduino transmits the data, but ATtiny isn’t responding to it (the led doesn’t light up). I tried to use the newest version of VirtualWire library, but ATtiny doesn’t have Timer1. The older version of VirtualWire compiles fine. The newest version of Manchester library too. But any of them doesn’t work for my ATtiny receiver. Can anybody help me with the problem?

The code I use for VirtualWire:
Transmitter:

#include <VirtualWire.h>
#undef int
#undef abs
#undef double
#undef float
#undef round
void setup()
{
    Serial.begin(9600);	  // Debugging only
    pinMode(13, OUTPUT);
    pinMode(3, OUTPUT);
    // Initialise the IO and ISR
    vw_set_tx_pin(3);
    vw_setup(2000);	 // Bits per sec
}

void loop()
{
    char msg[2];
    msg[0] = 0x00;
    msg[1] = 0xFF;

    digitalWrite(13, true); // Flash a light to show transmitting
    vw_send((uint8_t *)msg, strlen(msg));
    vw_wait_tx(); // Wait until the whole message is gone
    digitalWrite(13, false);
    delay(200);
}

Receiver:

#include <VirtualWire.h>
#undef int
#undef abs
#undef double
#undef float
#undef round
void setup()
{
  // Initialise the IO and ISR
  pinMode(0, OUTPUT);
  pinMode(1, OUTPUT);
  pinMode(3, OUTPUT);
  pinMode(4, INPUT);
  vw_set_tx_pin(4);
  vw_set_rx_pin(2);
  vw_set_ptt_pin(3);
  vw_setup(2000);	 // Bits per sec
  vw_rx_start();       // Start the receiver PLL running
}

void loop()
{
  uint8_t buf[VW_MAX_MESSAGE_LEN];
  uint8_t buflen = VW_MAX_MESSAGE_LEN;
  if (vw_get_message(buf, &buflen)) // Non-blocking
  {
    digitalWrite(3, true); // Flash a light to show received good message
    if (buf[0] == 0x00) {analogWrite(0, buf[1]);}
    if (buf[0] == 0x01) {analogWrite(1, buf[1]);}
    digitalWrite(3, false);
  }
}

Manchester Transmitter:

#include <Manchester.h>
#define TX_PIN 3  //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);
}

Receiver:

#include <Manchester.h>
#define RX_PIN 4 //= pin 6
void setup()
{
  pinMode(0, OUTPUT);
  pinMode(RX_PIN, INPUT);
  man.setupReceive(RX_PIN, MAN_1200);
  man.beginReceive();
}
void loop() {
  if (man.receiveComplete()) {
    uint16_t m = man.getMessage();
    digitalWrite(0, HIGH);
    delay(100);
    digitalWrite(0, LOW);
    man.beginReceive(); //start listening for next message right
  }
}

Can you help me ASAP (I must have that done this Monday)??? Thanks in advance!

kuba2k2

libraries.zip (29.6 KB)

VirtualWire has to be built specifically for the ATtiny85 but the details aren't given in the library.

You need to do some more googling.

From the VirtualWire docs:

Also compiles and runs on ATtiny85 in Arduino environment, courtesy r4z0r7o3.

The older version of the library compiles for me, but isn't working. The same for Manchester library. People in Internet say that these libraries work with Attiny.. What about Manchester library?

Define "isn't working".

but ATtiny doesn't have Timer1

Yes, it does have Timer1.

Okay, now i have changed the ATTINY_X5 to ATTINY_85 in manchester.cpp file and when the transmitter sends data without any delay the led on receiver sometimes lights up... The transmitter is about 2 centimeters from the receiver, so it should work even without antennas (the transmitter has 20cm antenna). What am I doing wrong?

Always use antennas.

Hehe, I soldered the antennas, nothing has changed. Any other ideas?

Hi,

well I had the same Issue with arduino nano and 433Mhz and the issue was only the power supply not stable enough that it fluctuates the signal abit causing miss firing for the reciever module .. check your power voltage up and if it is not stable enough (as sooth as it could be) just add some 10-220uF capacitor between Vcc and GND. or a voltage regulator (depends on your power distribution circuit)
best of luck.