Using RF Modules with Raspberry Pi Pico

902 Views Asked by At

I have 2 Raspberry Pi Picos running MicroPython. I am trying to use a 433 MHz RF transmitter on one Pico and a 433 MHz RF receiver on the other Pico. I am currently using UART to transmit and receive data:

# Receiver

import os
import machine
from time import sleep

uart = machine.UART(0, 4800)
print(uart)

led = machine.Pin(25, machine.Pin.OUT)

b = None
msg = ""

while True:
    if uart.any():
        b = uart.readline()
        try:
            msg = b.decode('utf-8')
            print(str(msg))
        except:
            print("Failed (" + str(type(b)) + "): " + str(b))
            pass
        
    led.toggle()
    sleep(1)

and

# Transmitter

import os
import machine
from time import sleep

uart = machine.UART(0, 4800)
print(uart)

led = machine.Pin(25, machine.Pin.OUT)

while True:
    sleep(5)
    led.toggle()
    uart.write('Hello, World!')

But the receiver prints stuff like this even when the transmitter is not transmitting. (I can't paste it here as it messes with the formatting)

As an experiment, I connected the TX on one Pico to the RX of the other pico, and it was able to send the data successfully. Therefore, I believe it is the transmitter and receiver getting interference from other signals.

My Question:

Arduino has libraries for packet radio. (see this) Is there anything similar in MicroPython or for the Raspberry Pi Pico?

Thanks.

0

There are 0 best solutions below