Go Down

Topic: 433mhz receiver works on the Uno but not Yun (Read 2540 times) previous topic - next topic

heyphi

Hi,

I have a strange problem with the receiver part of the cheap 433Mhz RF kit.

Now, my sketch is currently a big bunch of spaghetti code mixing various tutorials for different sensors (it's a home automation project and my first one) so it would only confuse any one who can help me.

Basically, the same problem exists in the most simple example which is the RC-Switch ReceiveDemo_simple. This works on the Uno but the same code doesn't on the Yun. I'm only use 3 wires (Power, Ground and interrupt 0 (pin 2) and have tried all the other pins to rule them out.

I modified the demo to log to the Console because I have to upload my sketches to the Yun via Wifi but that's the only change I have made to the demo.

Code: [Select]

/*
  Simple example for receiving
 
  http://code.google.com/p/rc-switch/
*/

#include <RCSwitch.h>
#include <Console.h>

RCSwitch mySwitch = RCSwitch();

void setup() {
  Serial.begin(9600);
  Bridge.begin();
  Console.begin();
 while (!Console){
    ; // wait for Console port to connect.
  } 
  Console.println("You're connected to the Console!!!!");
 
  mySwitch.enableReceive(0);  // Receiver on inerrupt 0 => that is pin #2
 
}

void loop() {
  if (mySwitch.available()) {
   
    int value = mySwitch.getReceivedValue();
   
    if (value == 0) {
      Console.println("Unknown encoding");
    } else {
      Console.println("Received ");
      Console.println( mySwitch.getReceivedValue() );
      Console.println(" / ");
      Console.println( mySwitch.getReceivedBitlength() );
      Console.println("bit ");
      Console.println("Protocol: ");
      Console.println( mySwitch.getReceivedProtocol() );
    }

    mySwitch.resetAvailable();
  }
}



The transmitter runs fine on the Yun and Uno but I need to have both receiver and transmitter connected to yun. Obviously, when I try to get the basic demo running I only connect the relevant wires so there's only the 1 receiver component connected and no interference.


What am I doing wrong? Can anyone recommend a RF library that works?

Thanks in advance,


heyphi

I should also note that the ReceiveDemo_simple also works on 3 different nano's I have. One official and two different compatible boards.

It just doesn't like the Yun.

jremington

Study the Yun documentation carefully and compare it with the assumptions in your program.
Quote
External Interrupts: 3 (interrupt 0), 2 (interrupt 1), 0 (interrupt 2), 1 (interrupt 3) and 7 (interrupt 4). These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value. See the attachInterrupt() function for details.

clasan

Hi
I have exactly the same problem with exactly the same code.
I moved to pin 3 (interrupt 0) but it is not working.
Also other interrupts with other pins are not working.
Did you mange to get the code working on YUN?
Thanks

maxim1992

Hi,
I have exactly the same problem!
When I use the RF receiver on arduino uno or mega it works!
When I use the RF receiver on arduino yun, no values are logged to the Console.
What am I doing wrong?

Thanks in advance

ari_jasberg

#5
May 05, 2015, 09:59 am Last Edit: May 05, 2015, 03:41 pm by ari_jasberg
I have a problem that may be related to the one described above.

I am using RadioHead library version 1.41.

A run an example sketch ask_transmitter on a nano (transmitter connected to pin 12).

The receiver (example sketch ask_receiver) runs fine on an uno (receiver connected to pin 11), and 100% of the messages are received without errors even when there are two or three walls between the transmitter and the receiver. I have tested with two unos, and they both work perfectly.

When a connect the same receiver to a yun running the same sketch, the reception is far from good. Even when a keep the transmitter and the receiver in the same room (distance 1-3 meters), ca. 50% of the massages are never printed by the receiver sketch. This happens with two yuns that I own.


MrNurd

I have the same problem with the yun and the rcswitch.h as the origional post.

Has anyone have found a working solution in the mean time????????

Much appreciated!

MrNurd

https://www.arduino.cc/en/Reference/AttachInterrupt

For the Yun change to pin 3, not use pin 2. Thats all.

bjkellett

me too.   Can't get the rcswitch library to work on the YUN.  Must be the interrupts.

Bruce

Go Up