5

I have 3 Pi's and a transmitter and receiver on all of them. We are trying to just send a number from Pi 1 to Pi 2 and have Pi 2 send back a response. We followed the instructions in https://www.instructables.com/id/RF-433-MHZ-Raspberry-Pi/. Everything works fine if the 2 Pi's are really close to each other and all the transmitters and receivers have antennas.

Even though 433 MHz should have a range of ~10 meters they barely work within 30 cm of each other. If I don't put an antenna on the transmitter and receiver they cant even see themselves. We have bought 10 transmitters and receivers each and none of them can reach anywhere near 10 meters.

6
  • 1
    But 433M should do at least than 100m.
    – tlfong01
    Nov 26, 2019 at 5:56
  • Max baud of XY FST 433 is only 2.4k. I suggest to use 1.2k. Standard 9k6 should give out of sync errors.
    – tlfong01
    Nov 26, 2019 at 6:18
  • 1
    Barely work is meaningless. What do you mean? Photos of a typical set up please. I expect the problem is the software you are using.
    – joan
    Nov 26, 2019 at 7:48
  • are you using any decoder encoder for 433 MHz? Nov 26, 2019 at 15:08
  • The (default) pulse length appears to be 350 with unit microseconds (in tx_waveform()). That corresponds to 2900 baud (though the actual symbol rate could be 1/2 - 1/4 of that due to some encoding). Nov 26, 2019 at 16:26

3 Answers 3

3

You need to ensure only one device is transmitting at a time. You have not shown how you plan to achieve that.

Here is some code to test your set up. It is based on my pigpio library and requires the pigpio daemon to be running (sudo pigpiod).

It also requires my Virtual Wire module to be in your working directory.

http://abyz.me.uk/rpi/pigpio/examples.html#Python_vw

On one Pi run tx.py

#!/usr/bin/env python

import time
import pigpio
import vw

TX=20

BPS=20000

pi = pigpio.pi() # Connect to local Pi.

tx = vw.tx(pi, TX, BPS) # Specify Pi, tx GPIO, and baud.

msg = 0

start = time.time()

while (time.time()-start) < 300:

   msg += 1

   while not tx.ready():
      time.sleep(0.02)

   time.sleep(0.1)

   tx.put("{:04d}".format(msg))

   while not tx.ready():
      time.sleep(0.02)

   time.sleep(0.1)

   tx.put("Hello World #{:04d}!".format(msg))

tx.cancel() # Cancel Virtual Wire transmitter.

pi.stop() # Disconnect from local Pi.

On another Pi run rx.py

#!/usr/bin/env python

import time
import pigpio
import vw

RX=19

BPS=20000

pi = pigpio.pi() # Connect to local Pi.

rx = vw.rx(pi, RX, BPS) # Specify Pi, rx GPIO, and baud.

msg = 0

start = time.time()

while (time.time()-start) < 300:

   while rx.ready():
      print("".join(chr (c) for c in rx.get()))

   time.sleep(0.2)

rx.cancel() # Cancel Virtual Wire receiver.

pi.stop() # Disconnect from local Pi.

You will need to change the RX and TX constants to the (Broadcom numbered) GPIO you are using.

2

If you want to have a two-way communication, buy transceiver modules: you'll only need two of them while with separate TX and RX modules you will need 4. Moreover, transceivers are designed to cope with interference, while in your case you run two TX modules on the same frequency, so you can be sure to have interference issues: when you increase the distance, each RPi stops hearing the other side and hears only its own transmitter.

Finally, those modules are essentially bare OOK radios, and very poor ones. You need to roll some sort of line code to make them work. UART is a very poor choice there because it doesn't compensate for the DC component which these radio modules don't seem to like. Don't expect to make these work reliably without an oscilloscope.

1
2

Those 433 MHz modules use AM modulation, and when not in use the input to the transmitter must be driven to 0 V (to not output any RF energy). If it is not, interference may be the result.

For instance, if the digital port line is configured as input (default at powerup) and if there is a pull-up resistor, either on the Raspberry Pi PCB or internally in the chip, it may result in interference (depending on the value of the resistor).

This may be the case if the other Raspberry Pis are powered up, but the program or configuration command-line that change the configuration of the digital port to output has not been run yet.

Experiment

A system based on AmForth on an Arduino Uno (actual supply voltage 5.2 V) was used, and the same transmitter module as in the question was used (with the same supply voltage). It could successfully turn on and off an RC-controlled 220 V relay (brand name "Perel", but by now likely out of production or sold under a different name).

The digital port on the microcontroller was then configured to input, so the input to the transmitter was floating. This did not result in interference.

Then a pull-up resistor of 10 kΩ was connected. This resulted in an intermediate voltage of 3.7 V to the transmitter, suggesting the input impedance of the transmitter module is on the order of 10 kΩ (24 kΩ for a resistive voltage divider).

It also resulted in interference. The transmitter was located 80 cm from the relay, and the manual control had to be brought within 30 cm of the relay to overcome interference. This fits with what was reported in the question.

Possible remedy

With a multimeter, check the input voltage to the transmitter. It should read 0 V. If it reads 0 V, you can check if it is floating or driven by measuring to 5 V instead of GND - if it is not showing 5 V it is floating.

1
  • I did this experiment today, using a test setup based off a system "in production" (located somewhere else). Nov 26, 2019 at 21:43

Your Answer

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

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