0
\$\begingroup\$

I've established an RF link using TWS-CS-2 as a transmitter and AM-HRR3-433 as a receiver.

The carrier frequency : 433.92MHz.

Modulation type : ASK.

ATtiny25 to generate and decode Manchester encoded signal.

The code was tested with two ATtinys directly connected and worked flawlessly.

Then I tried wireless communication and strange things started to happen.

I have two types of signal (two four digit numbers). One is always received and seen on a serial monitor, the other one can't be seen most of the time.

I would appreciate any help.


UPDATE

I used Manchester library from http://mchr3k.github.io/arduino-libs-manchester/

and Arduino Uno Rev.3 as ISP

Tx code

    #include <Manchester.h>

#define TxPin 2
short int switch_on = 1678;
short int switch_off = 8435; // !!!Signal that is not detected most of the time
short int flag;
short int ON_Button;
short int OFF_Button;


void setup()
{
  man.setupTransmit(TxPin, MAN_1200);
  pinMode(3,OUTPUT);
}


void loop() {
  ON_Button = digitalRead(0);
  OFF_Button = digitalRead(1);

  if(ON_Button==OFF_Button){digitalWrite(3, LOW);return;}

  if(ON_Button==HIGH) {flag=1;digitalWrite(3, HIGH);}
  if(OFF_Button==HIGH) {flag=2;digitalWrite(3, HIGH);}

  if(flag==1)
  man.transmit(switch_on);
  if(flag==2)
  man.transmit(switch_off);
}

Rx code

    #include <Manchester.h>

#define RX_PIN 2

void setup() {
  man.setupReceive(RX_PIN, MAN_1200);
  man.beginReceive();
  pinMode(0,OUTPUT);
  digitalWrite(0,LOW);
}

void loop() {
  if (man.receiveComplete()) {
    short int m = man.getMessage();
    man.beginReceive();
    if(m==1678){digitalWrite(0,HIGH);}
    if(m==8435){digitalWrite(0,LOW);} // !!!Signal that is not detected most of the time
    m = 0;
  }
}
\$\endgroup\$
1
  • 1
    \$\begingroup\$ Please specify the numbers, which work and which do not. Also source code would help. \$\endgroup\$
    – venny
    Commented Sep 2, 2014 at 22:44

1 Answer 1

1
\$\begingroup\$

Problem solved. It turned out the data rate was too high for my receiver.

I switched from 1200 bps to 300 bps.

Now everything works smoothly.

\$\endgroup\$

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.