046 - MicroPython TechNotes: RF433 Transceivers

Introduction

In this article, I will tackle how you can use an RF433 transceiver modules with ESP32 using MicroPython.

RF433 transmitter and receiver modules uses a radio frequency of 433 MHz which is under the Industrial, Scientific, and Medical bandwidth or ISM band for short.

How does it works?

The RF433 transmitter and receiver module both have 3 pins which are (1) G for the ground pin, (2) V for the supply voltage, and (3) S – for the signal pin or data pin. In receiver module, S pin serves as the receive data pin while in transmitter module, S pin serves as the transmitter data pin.

What you will need? To follow this lesson, you will need the following: 1. An ESP32 development board, 1 for the transmitter side and another 1 for the receiver side. 2. A Gorillacell ESP32 shield, 2 pieces for both side of the circuit. This component is optional, you may use a breadboard instead if you want. Gorillacell ESP32 shield simplifies circuit connection. 3. A 3-pin dupont jumper wires, 2 pieces for both side of the circuit. 4. The RF433 transceivers, the receiver and the transmitter module.

Side-trip: Since I don’t have prior knowledge in using an RF433 transceiver modules so I did some quick research in the internet. I found this video https://www.youtube.com/watch?v=98tYLEnevfA where he demonstrates the use of the module without using any microcontroller. You might want to jump to 2:23 timestamp to just watch the demonstration.

I have the exact components, so I followed the circuit but it is a bit clunky. It easily picks interference and it is not working properly.

I have a spare components from Gorillacell for RF433 transceivers which produces a functional circuit.

Hardware Instruction

  1. Attach the RF433 transceiver module to ESP32 as follows: RF433 Rx/Tx G pin to ESP32 ground pin. RF433 Rx/Tx V pin to ESP32 5V pin. RF433 Rx/Tx S pin to ESP32 GPIO 23 pin.

  2. (Optional) Power the ESP32 shield with an external power supply through the type-C USB cable connector.

  3. Connect the ESP32 to the computer through a micro USB cable.

Software Instruction

  1. Copy the source code and run source code to the assigned ESP32, 1 for the transmitter side and another 1 for the receiver side circuit.

  2. Feel free to modify the source code and please let me know if you made progress or you have any concern.

Video Demonstration

Call To Action

If you have any concern regarding this video, please write your question in the comment box.

You might also liked to support my journey on Youtube by subscribing on my channel, TechToTinker. Click this to Subscribe.

Thank you and have a good days ahead.

See you, – George Bantique | tech.to.tinker@gmail.com

Source Code

1. Example # 1, blinking an LED, transmitter:

 1# More details can be found in TechToTinker.blogspot.com 
 2# George Bantique | tech.to.tinker@gmail.com
 3
 4from machine import Pin
 5from time import sleep_ms
 6
 7transmit = Pin(23, Pin.OUT)
 8sw = Pin(0, Pin.IN)
 9
10while True:
11    transmit.value(not transmit.value())
12    sleep_ms(50)

2. Example # 1, blinking an LED, receiver:

 1# More details can be found in TechToTinker.blogspot.com 
 2# George Bantique | tech.to.tinker@gmail.com
 3
 4from machine import Pin
 5from time import sleep_ms
 6
 7receive = Pin(23, Pin.IN)
 8led = Pin(2, Pin.OUT)
 9
10while True:
11    led.value(receive.value())
12    sleep_ms(50)

3. Example # 2, sending message through RF433 modulated serial UART:

1# More details can be found in TechToTinker.blogspot.com 
2# George Bantique | tech.to.tinker@gmail.com
3
4from machine import Pin
5from machine import UART
6
7tx = UART(2, baudrate=9600, tx=23, rx=25)
8
9# tx.write('This is a test messagern')

4. Example # 2, receiving message through RF433 modulated serial UART:

 1# More details can be found in TechToTinker.blogspot.com 
 2# George Bantique | tech.to.tinker@gmail.com
 3
 4from machine import Pin
 5from machine import UART
 6
 7rx = UART(2, baudrate=9600, tx=25, rx=23)
 8
 9# print(rx.read())
10while True:
11    if rx.any():
12        print(rx.read())

5. Modified # 1, toggling the state of the receiver on-board LED, transmitter:

 1# More details can be found in TechToTinker.blogspot.com 
 2# George Bantique | tech.to.tinker@gmail.com
 3
 4from machine import Pin
 5from time import sleep_ms
 6
 7transmit = Pin(23, Pin.OUT)
 8sw = Pin(0, Pin.IN)
 9var_sw = 1
10
11while True:
12    if sw.value()==0:       # means, sw is pressed!
13        var_sw = not var_sw # toggle the state of variable
14    transmit.value(var_sw)  # send it to the radio
15    sleep_ms(50)

6. Modified # 1, toggling the state of the receiver on-board LED, transmitter:

(use the same source code in # 2)

References And Credits

  1. Purchase your Gorillacell ESP32 development kits: https://gorillacell.kr/

  2. Video showing the use of RF433 transceiver modules without an MCU: https://www.youtube.com/watch?v=98tYLEnevfA/



Posts in this series



No comments yet!

GitHub-flavored Markdown & a sane subset of HTML is supported.