User avatar
jefferson_palheta
Posts: 8
Joined: Thu Apr 27, 2017 8:22 pm
Contact: Twitter

Raspberry and Arduino RF Communication range problem with rc-switch

Wed Oct 25, 2017 4:53 pm

I'm communicating an Arduino and a Raspberry Pi 3 using 433MHz RF modules (https://goo.gl/r33Gxi) with rc-switch library. I was trying to send data from a RP3 for a Arduino Nano in 5 meters away and it worked but not so well, sometimes it didn't receive data then I replaced it for a Arduino Uno and it's receiving data from RP3 very well but the opposite doesn't work in this distance. So when I send data from Arduino to RP3 it doesn't work fine, just in close distance like 20 centimeters and even so it loses some data sent from Arduino.

Interesting, with virtualWire (arduino/arduino) it works like a charm. Other interesting thing, it works a few better when I used a external power to supply the modules but still not well. May you help me?

User avatar
OutoftheBOTS
Posts: 396
Joined: Tue Aug 01, 2017 10:06 am

Re: Raspberry and Arduino RF Communication range problem with rc-switch

Wed Oct 25, 2017 8:17 pm

I think 3 things for you to think about.

1. ensure that the both the Ardunio and RPi r using same protocol (speaking the same lanuage)

2. the antenna on the modals will greatly govern the clarity of the transmission see http://www.radiometrix.com/uhf-helical-coil

3. the power output (how many watts i.e volts x amps) will also govern how strong a signal is sent out so both the volts and amps of the power supply will affect the signal strength

User avatar
jefferson_palheta
Posts: 8
Joined: Thu Apr 27, 2017 8:22 pm
Contact: Twitter

Re: Raspberry and Arduino RF Communication range problem with rc-switch

Thu Oct 26, 2017 7:56 pm

Until this moment the only solution that worked a fell better for me was to supply the RF emitter from Arduino directly to a 6v 300mA power supply. I still lose data packages, one to each three but it's better. They are in 5 meters of distance.

User avatar
joan
Posts: 12778
Joined: Thu Jul 05, 2012 5:09 pm
Location: UK

Re: Raspberry and Arduino RF Communication range problem with rc-switch

Thu Oct 26, 2017 8:11 pm

pigpio has a Virtual Wire module which should be worth trying.

User avatar
jefferson_palheta
Posts: 8
Joined: Thu Apr 27, 2017 8:22 pm
Contact: Twitter

Re: Raspberry and Arduino RF Communication range problem with rc-switch

Fri Oct 27, 2017 2:29 pm

joan wrote:
Thu Oct 26, 2017 8:11 pm
pigpio has a Virtual Wire module which should be worth trying.
It didn't work for me. When I run the code to read on gpio it doesn't read anything.

User avatar
jefferson_palheta
Posts: 8
Joined: Thu Apr 27, 2017 8:22 pm
Contact: Twitter

Re: Raspberry and Arduino RF Communication range problem with rc-switch

Tue Nov 14, 2017 5:21 pm

I've been working for a long time into this issue and I get a great conclusion. It's not about protocol, antenna or the signal itself. An external power supply improves the signal on transmit and emitter but it's not enough, and I got it analyzing the communication between the RF modules using a professional oscilloscope and making a lot of tests. So the problem is that the Raspberry Pi doesn't catch the signal in some moments (yeah! even if a increase the priority of the process). If you don't know the rc-switch and another RF libraries use interruptions to catch the pulses (code) and in this case the RP doesn't make this work fine. I mean that in some case the signal is sent from Arduino (or another transmitter) but the RP doesn't catch it.

User avatar
OutoftheBOTS
Posts: 396
Joined: Tue Aug 01, 2017 10:06 am

Re: Raspberry and Arduino RF Communication range problem with rc-switch

Wed Nov 15, 2017 3:44 am

Try lowering the rater at which you send data then.

I have just begun to play with 433mhz RF and when hooking up my receiver to the scope I found a lot of noise from ambient white noise and think that I need to sit down and write a filter to filter it out.

If your using a pre written library then it is possible they have filter written in to them and the filters maybe filtering out the signal that you want.

btidey
Posts: 1368
Joined: Sun Feb 17, 2013 6:51 pm

Re: Raspberry and Arduino RF Communication range problem with rc-switch

Wed Nov 15, 2017 9:05 am

OutoftheBOTS wrote:
Wed Nov 15, 2017 3:44 am
Try lowering the rater at which you send data then.

I have just begun to play with 433mhz RF and when hooking up my receiver to the scope I found a lot of noise from ambient white noise and think that I need to sit down and write a filter to filter it out.

If your using a pre written library then it is possible they have filter written in to them and the filters maybe filtering out the signal that you want.
Seeing a lot of noise from a receiver is quite normal. They have automatic gain control so that in the absence of any real transmission the gain goes to maximum and you get random output. Once a transmitter starts to send then the receiver gain goes down and you should get a clean output for the duration of the transmission (assuming distance and antennae are OK).

The background noise does pose an extra challenge to the receiving software logic. The first stage is to ignore pulses with a duration significantly shorter than expected as will be the case for much of the background noise. pigpio has a function to do this. The second stage is to search for a valid characteristic of a real message and to restart the search if this doesn't happen. For example, some message protocols have a lead in training sequence of a set of square wave pulses of a particular period.

btidey
Posts: 1368
Joined: Sun Feb 17, 2013 6:51 pm

Re: Raspberry and Arduino RF Communication range problem with rc-switch

Wed Nov 15, 2017 9:09 am

jefferson_palheta wrote:
Tue Nov 14, 2017 5:21 pm
So the problem is that the Raspberry Pi doesn't catch the signal in some moments (yeah! even if a increase the priority of the process). If you don't know the rc-switch and another RF libraries use interruptions to catch the pulses (code) and in this case the RP doesn't make this work fine.
Using pigpio can help quite a lot here. Also any decent communication protocol should have methods in to handle the loss of message packets which can happen for a variety of reasons not just receiving software. One way protocols can use packet repetition to increase the reliability. Two way protocols can use ack and resend.

User avatar
OutoftheBOTS
Posts: 396
Joined: Tue Aug 01, 2017 10:06 am

Re: Raspberry and Arduino RF Communication range problem with rc-switch

Wed Nov 15, 2017 10:08 am

@jefferson_palheta

Based upon some of the advice in last couple of posts it might pay to sit down and write your own protocol to transmit and receive over RF. This is what I did with my son when we made a remote controlled car using and IR LED and receiver. We made our own protocol similar to NEC. We made a start sequence then an address byte (sort of like I2C protocol) then we sent the inverse of the address byte as a check then we sent each data byte followed by its inverse as a check then when finished all the bytes we sent a finish sequence. Then we wrote a decoder at the other end. We didn't use an ack or resend but this would be a much better improvement to what we did.

grahamed
Posts: 268
Joined: Mon Jan 30, 2012 7:01 pm

Re: Raspberry and Arduino RF Communication range problem with rc-switch

Wed Nov 15, 2017 5:13 pm

I use 433MHz a lot.

I send the packet maybe 10 times to ensure it gets through at least once. Like the shop-bought remotes and sockets do. My antennae a better than the bitty things within the units. I actually use a PIC micro so timing is not a problem.

It's just not terribly good. And that's only 3 bytes, any more, forget it.

I now await tales of sending the whole of Hamlet at 9600 baud, over 3 miles, with walls in between, no error correction and no errors.

davef
Posts: 17
Joined: Wed Feb 20, 2013 8:39 pm

Re: Raspberry and Arduino RF Communication range problem with rc-switch

Wed Nov 15, 2017 11:58 pm

Preamble is a keyword that will help your searching.

btidey
Posts: 1368
Joined: Sun Feb 17, 2013 6:51 pm

Re: Raspberry and Arduino RF Communication range problem with rc-switch

Fri Nov 17, 2017 8:35 am

Couple of things when using 433MHz for its normal use of transmitting simple control around a house.

Many of the TX units allow for a supply voltage of 3 - 12V. The power is significantly boosted when using 12V and can help increase range. The logic data can still be controlled with low level logic but some TX have a resistor on the input (~18K) which is too high for good modulation when using 3.3V logic and 12V power. I lower this to 4K7 to avoid this problem.

Most of the receivers work best when modulation rates are kept below 1KHz, e.g. with pulse widths in the 500 - 2000 uS range. Packet lengths are best kept short (< 80 bits) to minimise the chance of interference or overlap from other transmitters.

Return to “Automation, sensing and robotics”

Who is online

Users browsing this forum: Pawel77 and 27 guests