logo elektroda
logo elektroda
X
logo elektroda
Dostępna jest polska wersja

Czy wolisz polską wersję strony elektroda?

Nie, dziękuję Przekieruj mnie tam

BK7231 RF receiver driver tutorial - how to use SYN590R or similar to control multiple devices

p.kaczmarek2 1944 33

TL;DR

  • OpenBeken RC driver tutorial for a Tuya 4-channel 433 MHz relay switch module built around a CB3S BK7231 and SYN590R receiver.
  • It sets the RCRecv pin, starts the driver with `startDriver RC`, then maps remote codes in `autoexec.bat` using `addEventHandler2` to toggle relays or send HTTP GETs.
  • One example handler maps RF code 591946 to `http://192.168.0.58/cm?cmnd=Power0%20Toggle` for external device control.
  • The same RF remote can control the relay board itself or other LAN devices, turning cheap 433 MHz hardware into a local automation gateway.
  • Home Assistant support is still pending, but the published RF format is expected to match Tasmota’s standard.
Generated by the language model.
ADVERTISEMENT
📢 Listen (AI):
  • #31 21834108
    DeDaMrAz
    Level 22  
    p.kaczmarek2 wrote:
    Hey aren't defines fixed by @DeDaMrAz in Docker PR?


    No I didn't touch anything outside of the docker folder. I saw the mentioned defines but worked with them rather than trying to change anything.
  • ADVERTISEMENT
  • #32 21834262
    p.kaczmarek2
    Moderator Smart Home
    Ok then we can remove them and introduce proper #define for each driver.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #33 21834266
    DeDaMrAz
    Level 22  
    p.kaczmarek2 wrote:
    Ok then we can remove them and introduce proper #define for each driver.


    Well that would be nice to have, unified looking #define for all availabe drivers, I'll adapt local build to that no problem, and it will help to keep code standardized and future proof - so I agree on the change :)
  • #34 21834480
    max4elektroda
    Level 24  
    p.kaczmarek2 wrote:
    Ok then we can remove them and introduce proper #define for each driver.

    In this case I can't see a problem with defines.

    It's simply the fact that the identical driver and command names are used for two drivers.
    So the user in best case knows, which define is set in his build to find the matching name.
    In both cases for the end user the usage is most important, so if it's equal, this might be acceptable.
    If call is different, e.g. with different arguments, this might be misleading, but given the define the user should be able to get some help...
    Not a big deal, but resolving would be nice to have.
📢 Listen (AI):

Topic summary

✨ The discussion focuses on using the BK7231-based Tuya 4-channel 433 MHz RF Wi-Fi relay module flashed with OpenBeken firmware to create a versatile RF control hub for multiple devices including relays, smart bulbs, and LED controllers. The OpenBeken RC driver supports Princeton and Roger RF protocols, with ongoing testing for broader compatibility. Users report successful configuration of RF input pins (e.g., remote_io on P8) and integration with Easy Flasher and JSON device templates. The Bingoelec W601 T34 5V/7-32V relay board with RF receiver connected to GPIO pins is confirmed compatible, with updated templates available in the OpenBeken webapp repository. The discussion also explores hacking older switches where the 480RA RF receiver is connected to a button controller MCU, suggesting direct connection to the Wi-Fi module for enhanced functionality. The RC driver implementation requires a 50 µs timer similar to the IR driver, with calls for Timer HAL support to facilitate development.
Generated by the language model.

FAQ

TL;DR: Flash a Tuya 4‑channel (433 MHz) relay with OpenBeken, map RCRecv, run startDriver RC, then bind button codes—“all basics covered.” [Elektroda, p.kaczmarek2, post #21781577]

Why it matters: This turns a cheap RF relay into a local, cloud‑free RF hub that can trigger Wi‑Fi devices, scenes, and Home Assistant automations.

Quick Facts

What is OpenBeken and why use it here?

OpenBeken is open firmware for BK7231 modules. It adds an RF driver so the SYN590R receiver connects directly to the Wi‑Fi chip. You read button codes, then trigger relays or other devices over HTTP/MQTT. It avoids vendor clouds and works as a flexible RF-to‑Wi‑Fi bridge. “RF buttons can trigger virtually any action.” [Elektroda, p.kaczmarek2, post #21781577]

How do I flash the BK7231 (CB3S) module and detect the device template?

Use the BK7231 GUI Flash Tool from the OpenBeken project. The tool flashes the CB3S module and can auto-detect configuration. Import the detected template into OBK, then proceed to RF setup. Keep the console open to capture RF codes during testing. [Elektroda, p.kaczmarek2, post #21781577]

How do I enable the RF receiver and start seeing codes?

Trace the PCB to find the RCRecv pin, assign it in OBK, then run startDriver RC. Press a remote button and watch OBK’s console to see the decimal RF code and the held-state flag. Use those values in event handlers. [Elektroda, p.kaczmarek2, post #21781577]

What’s the quickest way to bind a remote button to a relay?

Three steps: 1) Capture the button code in the console. 2) Add to autoexec.bat: addEventHandler2 RC <code> 0 ToggleChannel <n>. 3) Save and re-run autoexec to test without rebooting. Map channels 1–4 as needed. [Elektroda, p.kaczmarek2, post #21781577]

Can I control other devices (like smart bulbs or LED strips) from this RF hub?

Yes. Use event handlers to send HTTP commands directly to device IPs, or publish via MQTT. The example shows an RF button toggling a Wi‑Fi LED strip at 192.168.0.58 using SendGet. This provides local, low‑latency control with no cloud. [Elektroda, p.kaczmarek2, post #21781577]

How does held vs. single press work in OBK’s RC driver?

OBK exposes a held-state parameter in events. First press sets the third argument to 0. Holding the button generates repeats with the value 1. Use addEventHandler2 to branch behavior by that flag. This enables press-and-hold actions. [Elektroda, p.kaczmarek2, post #21781577]

Does this approach work if the RF receiver is behind an external MCU?

If the SYN590R output goes into a separate MCU, the Wi‑Fi chip will not see raw RF data. OBK’s RC driver needs the receiver wired to a BK7231 pad. In MCU‑mediated designs, use the MCU’s protocol or modify hardware. [Elektroda, p.kaczmarek2, post #21781577]

How does OpenBeken compare to Tasmota for 433 MHz remotes?

The demo feeds the same RF signal to OBK and a Tasmota ESP32. After converting OBK’s decimal code, both match. This means remotes and automations are interchangeable. Upcoming HA support will follow Tasmota’s RF format. [Elektroda, p.kaczmarek2, post #21781577]

What is the SYN590R and why was it chosen?

SYN590R is a 433 MHz RF receiver used on the Tuya 4‑channel board. It connects directly to a BK7231 pad, making it ideal for OBK’s RC driver. This eliminates a middle MCU and reduces latency and complexity. [Elektroda, p.kaczmarek2, post #21781577]

What is Tuya in this context?

Here, “Tuya” refers to the showcased 4‑channel 220 V AC Wi‑Fi relay module sourced from AliExpress. It ships with one RF remote, and you can add more. The board carries a CB3S (BK7231) module and a SYN590R receiver. [Elektroda, p.kaczmarek2, post #21781577]

How do I structure an autoexec.bat for multiple buttons and scenes?

Use one line per button code. Example shows mappings for channels 1–4, plus all‑on and all‑off. Add HTTP calls to control other IP devices. You can re-run autoexec without rebooting for fast iteration. Keep codes readable and documented. [Elektroda, p.kaczmarek2, post #21781577]

Is there a Home Assistant integration?

Yes, support is being finalized. The published RF format will match Tasmota’s documented standard. That ensures simple pairing with existing RF automation flows in HA once released. Watch for builds in the coming days. [Elektroda, p.kaczmarek2, post #21781577]

What failures should I expect, and how do I debug them?

If no codes appear, verify the RCRecv pin mapping and that startDriver RC ran. Check whether the RF path goes through an external MCU, which OBK cannot read. Use the console to confirm codes and the held-state flag. [Elektroda, p.kaczmarek2, post #21781577]

Can one RF hub trigger multiple Wi‑Fi devices at once?

Yes. Use multiple addEventHandler2 lines for the same code to call several actions. You can toggle relays locally and fire HTTP/MQTT commands to other devices for scenes. This scales from one relay to whole‑home actions. [Elektroda, p.kaczmarek2, post #21781577]

Do I need internet or cloud accounts for this to work?

No. All examples use local networking. OBK handles RF reception on‑device, and actions run via local HTTP or MQTT. This yields privacy, resilience, and fast response even if the internet drops. [Elektroda, p.kaczmarek2, post #21781577]

What concrete example stats should I copy from the guide?

The sample uses RF codes like 591944–591950, mapping to four channels, all‑on, and all‑off. First press=0, hold=1. Reuse this structure with your own captured codes for consistent behavior. [Elektroda, p.kaczmarek2, post #21781577]
Generated by the language model.
ADVERTISEMENT