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
-
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.
-
(Optional) Power the ESP32 shield with an external power supply through the type-C USB cable connector.
-
Connect the ESP32 to the computer through a micro USB cable.
Software Instruction
-
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.
-
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
-
Purchase your Gorillacell ESP32 development kits: https://gorillacell.kr/
-
Video showing the use of RF433 transceiver modules without an MCU: https://www.youtube.com/watch?v=98tYLEnevfA/
Posts in this series
- 049 - MicroPython TechNotes: MP3 Player
- 048 - MicroPython TechNotes: Analog Touch Sensor
- 047 - MicroPython TechNotes: E108 GPS
- 045 - MicroPython TechNotes: Infrared Transmitter
- 044 - MicroPython TechNotes: Infrared Receiver
- 043 - MicroPython TechNotes: ESP12E WiFi | External WiFi module
- 042 - MicroPython TechNotes: JDY-32 | Bluetooth Low Energy BLE
- 041 - MicroPython TechNotes: Bluetooth HC-06
- 040 - MicroPython TechNotes: Relay
- 039 - MicroPython TechNotes: Electromagnet
- 038 - MicroPython TechNotes: Buzzer
- 037 - MicroPython TechNotes: Servo Motor
- 036 - MicroPython TechNotes: Stepper Motor
- 035 - MicroPython TechNotes: Dual Motor Driver
- 034 - MicroPython TechNotes: DC Motors | Gear Motor and Fan Motor
- 033 - MicroPython TechNotes: TCS34725 RGB Color Sensor
- 032 - MicroPython TechNotes: BMP280 Sensor
- 031 - MicroPython TechNotes: TOF Distance Sensor
- 030 - MicroPython TechNotes: DS3231 RTC
- 029 - MicroPython TechNotes: HC-SR04 Ultrasonic Sensor
- 028 - MicroPython TechNotes: DHT11 Temperature and Humidity Sensor
- 027 - MicroPython TechNotes: Rotary Encoder
- 026 - MicroPython TechNotes: Light Dependent Resistor (LDR)
- 025 - MicroPython TechNotes: Joystick
- 024 - MicroPython TechNotes: Slider Switch
- 023 - MicroPython TechNotes: Continuous Rotation Potentiometer
- 022 - MicroPython TechNotes: Potentiometer | Reading an Analog Input
- 021 - MicroPython TechNotes: Color Touch Sensor
- 020 - MicroPython TechNotes: Touch Sensor
- 019 - MicroPython TechNotes: Switch Module
- 018 - MicroPython TechNotes: Button | Reading an Input
- 017 - MicroPython TechNotes: LASER Module
- 016 - MicroPython TechNotes: RGB LED Matrix
- 015 - MicroPython TechNotes: Neopixel 16
- 014 - MicroPython TechNotes: 8x8 Dot Matrix Display (I2C)
- 013 - MicroPython TechNotes: 8x16 Dot Matrix Display (SPI)
- 012 - MicroPython TechNotes: 8x8 Dot Matrix Display (SPI)
- 011 - MicroPython TechNotes: 1.3 OLED Display
- 010 - MicroPython TechNotes: 0.96 OLED Display
- 009 - MicroPython TechNotes: 7 Segment Display
- 008 - MicroPython TechNotes: 16x2 LCD
- 007 - MicroPython TechNotes: RGB LED
- 006 - MicroPython TechNotes: Traffic Light LED Module
- 005 - MicroPython TechNotes: Gorilla Cell LED | MicroPython Hello World
- 004 - MicroPython TechNotes: Gorilla Cell I/O Devices
- 003 - MicroPython TechNotes: Gorillacell ESP32 Shield
- 002 - MicroPython TechNotes: Introduction for Gorillacell ESP32 Dev Kit
- 001 - MicroPython TechNotes: Get Started with MicroPython
- 000 - MicroPython TechNotes: Unboxing Gorillacell ESP32 Development Kit
No comments yet!