Receive data with 433 Mhz receiver

Hello,

The target of my projet is rather simple :
Receive data from a 433 Mhz transmitter to control relays.

I use :
Arduino Uno
433 Mhz receiver (ref XL-R03A)
DfRobot Relay shield V2.1
RCSwitch.h library

The receiver is wired directly on the Arduino digital pin 2 without the shield :
It works fine : the codes from transmitter are received correctly.

Then I plug the relay shield on the Arduino and the receiver on pin 2 :
It doesn't work anymore.

I suppose that there is a conflict between the shield and receiver : they use both pin 2 ???

In the code for rcswitch it seems that the receiver can only be placed on interrupt 0, which corresponds to pin 2 :
mySwitch.enableReceive(0); // Receiver on interrupt 0 => that is pin #2
I have tried to connect receiver to pin 3 and adapt the code :
mySwitch.enableReceive(1);
but it doesn't work.

So my question :
Is there a way to make work together the relay shield and the 433Mhz receiver ?

Thanks for your help

:neutral_face: That's funny, I had the same issue with the exact same (XL-R03A)433MHz receiver module and a grove 4 digit 7 segment display.
The receiver just stops working when I add a display module to my Arduino nano.

Let me guess, are you using the VirtualWire library by any chance?

I took a look at the RCSwitch code, and it seems like what you did should work. I don't know why it doesn't.

According to the product page for the relay shield, the control pins are jumper-selected. Pin 2 is one of the defaults, so change that.

Thanks for your reply.

I'm actually using this 433 receiver with a 7 segment display but not the same as your and not with virtualwire. It works fine.

This is the display I'm using : Afficheur 7 segments blancs 4 digits Sparkfun - Affichage LED et drivers | GO TRONIC
I use the code coming with the display.

jremington,

First thanks a lot for your time :slight_smile:

I have changed the pin 2 to pin 4 on the Relay shield.
But the problem is still there : when I connect the shield to Arduino, receiver does not work any more.

I have the same problem when I plug the Ethernet Shield on Arduino.

That's why I would prefer to change the pin of the 433 receiver but I do not understand why I can not plug it on another digital pin like other devices.

Mario

The receiver requires an external interrupt pin and there are only two on the UNO (D2 and D3). The circuitry of that particular relay shield apparently interferes with the interrupt, so you will probably need to try another type of relay board.

I have seen that this receiver can be used on an analogic port.
I would prefer this solution. I will investigate.

I have already several relay boards and ethernet shields. I must use them.
Thanks again for your help.

Sorry, I should have said that the RCSwitch library uses the external interrupts. The receiver doesn't care!

That means that there is perhaps another library compatible with this receiver ?

jremington:
The receiver requires an external interrupt pin and there are only two on the UNO (D2 and D3). The circuitry of that particular relay shield apparently interferes with the interrupt, so you will probably need to try another type of relay board.

No. It uses a timer interrupt to poll an input pin of your choice. So the solution in this case, is to change the receiver pin to something other than D2, which is said to be in use by the shield.

Thank you for your reply.

Unfortunately I do not understand how I can change the receiver pin.

This is what is written in the Rcswitch sample :

mySwitch.enableReceive(0); // Receiver on interrupt 0 => that is pin #2

It expects an interrupt, not a pin ...

Then use RadioHead. It has no such limitations.

@aarg: If you want to be helpful you might at least read the posts. RadioHead does not decode RCSwitch transmissions.

@dakota99: if you want to use the RCSwitch library, it appears that you cannot use that particular relay module. There are other relay modules that should work with RCSwitch.

You should be able to use RCSwitch with digital pin 3 (interrupt 1) without the relay module. If it doesn't work on interrupt 1, post an "issue" on the Github site, ask the library author,or search for a solution.

jremington:
@anon57585045: If you want to be helpful you might at least read the posts. RadioHead does not decode RCSwitch transmissions.

The OP did ask for other libraries. VirtualWire was mentioned in reply #1. Also it seems to me that using either of those to control a switch would be a very straightforward project.

using either of those to control a switch would be a very straightforward project.

It would most most certainly not be straightforward, even for an advanced programmer.

The RCSwitch protocol is completely unlike either of the message protocols used by VirtualWire or RadioHead.

jremington:
It would most most certainly not be straightforward, even for an advanced programmer.

The RCSwitch protocol is completely unlike either of the message protocols used by VirtualWire or RadioHead.

So don't use the RCSwitch protocol! Unless the OP absolutely must use a handset transmitter. But I don't think that was stated.

I think this makes it clear that the OP wants to receive the transmissions from a commercial RCSwitch remote.

The receiver is wired directly on the Arduino digital pin 2 without the shield :
It works fine : the codes from transmitter are received correctly.

Of course it is possible for the OP to make his/her own transmitter and use any other suitable protocol.

Well, as you said, the relay shield is jumper configurable. I agree that it would be a far simple solution, if it can be done.

Hello,
Thanks for your comments.
As written before, I have tried to redirect the pin on the shield (pin 4 instead of pin 2) but the problem is still there.
Moreover I meet the same issue with the Ethernetshield. Without this shield, it works. With the shield, the receiver does not receive data.

Thanks.