esp-idf-rc-switch
esp-idf-rc-switch copied to clipboard
315/433MHz ASK RF driver for esp-idf
esp-idf-rc-switch
315/433MHz ASK RF driver for esp-idf.
There are several repositories available for esp-idf, but I couldn't find a submittable library.
This repository can send and receive.
I ported from here.
Software requirements
ESP-IDF V4.4/V5.x.
ESP-IDF V5.0 is required when using ESP32-C2.
ESP-IDF V5.1 is required when using ESP32-C6.
Hardware requirements
315MHz/433MHz ASK Wireless transmitter/receiver like this.
-
Transmitter
H34A-433/H34A-315
SYN115
STX882 -
Receiver
H3V3/H3V4/H5V3/H5V4
SYN480R
LR43B/LR33B
SRX882/SRX887
I used this:
Note
As far as I know, there are 5V module and 3.3V module in the receiving module.
Only 3.3V modules can be used with the ESP32.
Installation
git clone https://github.com/nopnop2002/esp-idf-rc-switch
cd esp-idf-rc-switch
idf.py set-target {esp32/esp32s2/esp32s3/esp32c2/esp32c3/esp32c6}
idf.py menuconfig
idf.py flash
Configuration
On the transmitting side, you can choose the protocol and the number of data bits.
The available protocols are:
static const Protocol proto[] = {
{ 350, { 1, 31 }, { 1, 3 }, { 3, 1 }, false }, // protocol 1
{ 650, { 1, 10 }, { 1, 2 }, { 2, 1 }, false }, // protocol 2
{ 100, { 30, 71 }, { 4, 11 }, { 9, 6 }, false }, // protocol 3
{ 380, { 1, 6 }, { 1, 3 }, { 3, 1 }, false }, // protocol 4
{ 500, { 6, 14 }, { 1, 2 }, { 2, 1 }, false }, // protocol 5
{ 450, { 23, 1 }, { 1, 2 }, { 2, 1 }, true }, // protocol 6 (HT6P20B)
{ 150, { 2, 62 }, { 1, 6 }, { 6, 1 }, false }, // protocol 7 (HS2303-PT, i. e. used in AUKEY Remote)
{ 200, { 3, 130}, { 7, 16 }, { 3, 16}, false}, // protocol 8 Conrad RS-200 RX
{ 200, { 130, 7 }, { 16, 7 }, { 16, 3 }, true}, // protocol 9 Conrad RS-200 TX
{ 365, { 18, 1 }, { 3, 1 }, { 1, 3 }, true }, // protocol 10 (1ByOne Doorbell)
{ 270, { 36, 1 }, { 1, 2 }, { 2, 1 }, true }, // protocol 11 (HT12E)
{ 320, { 36, 1 }, { 1, 2 }, { 2, 1 }, true } // protocol 12 (SM5212)
};
//{pulseLength, {syncFactor.high, syncFactor.low}, {zero.high, zero.low}, {one.high, one.low}, invertedSignal}
Wirering
Radio Module | ESP32 | |
---|---|---|
DATA | -- | GPIO4 |
GND | -- | GND |
VCC | -- | 3.3V |
You can change data pin to any pin using menuconfig.
Communicat with Arduino Environment
I used this library on Arduino environment.
The sample code for the Arduino environment can be found in the ArduinoCode folder.
From ESP32 to UNO
From UNO to ESP32
Using garage door 315/433MHz Remote
You can control ESP32 using garage door 315/433Mhz remote.
You can buy it on AliExpress or eBay for about $3.
Build the firmware as Receiver.
Fire the RF using the RF remote control.
Reference
https://github.com/nopnop2002/esp-idf-web-rc-switch