logo elektroda
logo elektroda
X
logo elektroda

[Solved] Using Tuya Aubess Mini Smart Switch (Belon2028N) with 16-Channel Relay Board: Shift Register Method

smkassist 5712 33
Best answers LABEL_AI_GENERATED

Can I use OpenBK on a Tuya Aubess mini smart switch to drive a 16-channel relay board with chained 74HC595 shift registers, and how should I configure it?

Yes — OpenBK can drive a 16-channel relay board through chained 74HC595 shift registers, and the basic ShiftRegister driver was added and tested; two 74HC595 chips give you 16 outputs from three MCU pins [#20530051][#20530215][#20533505] Use the driver like `startDriver ShiftRegister [DataPin] [LatchPin] [ClkPin] [FirstChannel] [Order] [TotalRegisters]` and, in the later example, an extra invert flag is also shown: `startDriver ShiftRegister 24 6 7 10 1 1 0` [#20530215][#20533505] For a 16-channel setup, chain two registers and map channels 10–17, then set those channels to `Toggle` so they appear correctly in the HTTP panel [#20530215][#20533505] If your relay board is active-low, a global invert option was suggested as the simplest solution rather than per-bit flags [#20530381][#20530675][#20533505] The current implementation can handle up to 4 chained registers because the shift-out path is based on a 32-bit integer [#20530215][#20532809]
AI summary based on the discussion. May contain errors.
ADVERTISEMENT
  • Tasmota uses rc-switch, not IRLibrary

    #31 20533323
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14767
    Help: 659
    Rate: 12906
    I've did a little research and it seems that Tasmota is using this library:
    https://github.com/sui77/rc-switch
    So it's not IRLibrary, RC codes are different. They are similar, but different. But for that purpose I would need to get RF receiver... hmm.... maybe I will buy one and help you get that remote running.

    Right now, I am finalizing the clock:
    Using Tuya Aubess Mini Smart Switch (Belon2028N) with 16-Channel Relay Board: Shift Register Method Using Tuya Aubess Mini Smart Switch (Belon2028N) with 16-Channel Relay Board: Shift Register Method
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #32 20533340
    smkassist
    Level 4  
    Posts: 33
    I will look for some IR receiver in my shop tomorrow... Maybe I have one in my offscourings
  • ADVERTISEMENT
  • ShiftRegister autoexec.bat example and channel mapping

    #33 20533505
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14767
    Help: 659
    Rate: 12906
    Hmm you are right, we are far from initial topic. Please start a new thread about simulator and I will reply there.

    That one can be closed, the basic functionality of ShiftRegister seems to be working.

    To sum it up, here's example autoexec.bat for Shift Register:
    
    // startDriver ShiftRegister [DataPin] [LatchPin] [ClkPin] [FirstChannel] [Order] [TotalRegisters] [Invert]
    startDriver ShiftRegister 24 6 7 10 1 1 0
    // If given argument is not present, default value is used
    // First channel is a first channel that is mapped to first output of shift register.
    // The total number of channels mapped is equal to TotalRegisters * 8, because every register has 8 pins.
    // Order can be 0 or 1, MSBFirst or LSBFirst
    
    // To make channel appear with Toggle on HTTP panel, please also set the type:
    setChannelType 10 Toggle
    setChannelType 11 Toggle
    setChannelType 12 Toggle
    setChannelType 13 Toggle
    setChannelType 14 Toggle
    setChannelType 15 Toggle
    setChannelType 16 Toggle
    setChannelType 17 Toggle
    
    

    Connections should be obvious.. according to datasheet.
    Helpful post? Buy me a coffee.
  • #34 20533517
    smkassist
    Level 4  
    Posts: 33
    Closing as solved.

Topic summary

LABEL_AI_GENERATED
The discussion revolves around integrating a Tuya Aubess Mini Smart Switch (Belon2028N) with a 16-channel relay board using shift registers. The user successfully flashed OpenBK firmware onto the Tuya module but faced limitations due to the limited number of IO pins. Suggestions included using I2C port expanders or shift registers, with a preference for the latter due to local availability. The 74HC595 shift register was identified as a suitable component for expanding IO capabilities. The conversation included technical details on wiring, scripting examples for OpenBK, and the potential for chaining multiple shift registers to control more outputs. The user also expressed interest in exploring other communication protocols and automation possibilities for home systems.
AI summary based on the discussion. May contain errors.

FAQ LABEL_AI_GENERATED

TL;DR: Use 2 chained 74HC595 chips; “basic functionality” works for turning a Tuya Aubess Belon2028N with OpenBK into a 16-relay controller using only data, latch, and clock GPIO lines. This FAQ helps OpenBK users expand limited I/O safely and script it correctly. [#20533505]

Why it matters: A small Tuya WiFi module with about 9 I/O pins can control a full 16-channel relay board when outputs are serialized through shift registers.

Option OpenBK status Outputs discussed GPIO use Best fit
74HC595 shift register Driver added in thread 8 outputs per chip; up to 4 chips 3 GPIO lines Cheap local parts and relay expansion
I2C GPIO expander Already supported Up to 16 GPIO I2C bus Faster setup when parts are available

Key insight: The practical solution is to map OpenBK channels to 74HC595 outputs, then expose those channels as HTTP-panel toggles. For active-low relay boards, use the ShiftRegister invert parameter instead of rewiring every relay input.

Quick Facts

  • The Belon2028N Tuya module had only about 9 available I/O pins, so direct 16-relay control was not practical. [#20528489]
  • One 74HC595 provides 8 outputs, and chaining 2 chips gives the 16 outputs needed for the relay board. [#20530051]
  • The OpenBK ShiftRegister command uses 7 parameters after the driver name: DataPin, LatchPin, ClkPin, FirstChannel, Order, TotalRegisters, and Invert. [#20533505]
  • The implemented OpenBK driver can handle up to 4 chained 74HC595 registers, equal to 32 shift-register outputs. [#20532809]
  • For Windows simulation, the discussed setup used 2 GitHub repositories and required selecting a Win32 build in Visual Studio. [#20532101]

How can I use a Tuya Aubess Mini Smart Switch Belon2028N running OpenBK to control a 16-channel relay board with 74HC595 shift registers?

Flash OpenBK, chain 2 74HC595 registers, and start the ShiftRegister driver in autoexec.bat. Use 3 Tuya GPIO lines for data, latch, and clock. Map the first OpenBK channel to the first shift-register output. Then define 16 Toggle channels for the relay board. The thread’s final example starts at channel 10 and shows one 8-output register; use TotalRegisters 2 for 16 outputs. Expert quotation: “basic functionality of ShiftRegister seems to be working.” [#20533505]

What is a 74HC595 shift register and how does it expand the number of relay outputs from a Tuya/OpenBK module?

A 74HC595 expands OpenBK outputs by converting serial data from 3 GPIO lines into 8 parallel relay-control outputs. "74HC595 shift register is an integrated circuit that stores serial bits and presents them as parallel outputs, allowing multiple relay channels from few processor pins." The thread used it because the Belon2028N had about 9 I/O pins, while the relay board needed 16 control inputs. Chaining 2 chips gives 16 outputs. [#20530051]

How do I configure the OpenBK ShiftRegister driver in autoexec.bat for data, latch, clock, first channel, bit order, register count, and invert mode?

Configure it with startDriver ShiftRegister DataPin LatchPin ClkPin FirstChannel Order TotalRegisters Invert. Example: startDriver ShiftRegister 24 6 7 10 1 1 0. Here, GPIO 24 is data, GPIO 6 is latch, GPIO 7 is clock, channel 10 is the first mapped output, order 1 selects one bit order, 1 means one register, and 0 disables inversion. Set TotalRegisters to 2 for 16 outputs. [#20533505]

How should active-low relay boards be handled when using 74HC595 shift registers with OpenBK?

Handle active-low relay boards by using the ShiftRegister invert parameter when starting the driver. The relay board in the thread was active low, meaning a low-level output turns a relay on. The final OpenBK syntax includes an Invert argument after TotalRegisters. Use Invert 1 when the relay logic must be reversed globally. This keeps the hardware simple and avoids per-channel rewiring or custom logic. [#20533505]

What is the difference between using a 74HC595 shift register and an I2C GPIO port expander for controlling multiple relays in OpenBK?

A 74HC595 uses 3 GPIO lines and serial shifting, while an I2C expander uses the I2C bus and was already supported. The thread states that I2C port expanders are cheap and can provide up to 16 relay-driving GPIO. The 74HC595 option became useful because the user could buy those parts locally. The developer then added ShiftRegister support for OpenBK. [#20528766]

How many 74HC595 registers can OpenBK chain together, and how many relay channels does that provide?

OpenBK can chain up to 4 74HC595 registers in the implementation discussed. Each register provides 8 outputs, so 4 registers provide 32 relay-control outputs. The developer first mentioned a 32-bit shift function, then confirmed the driver could handle up to 4 registers. The thread’s 16-channel board needs only 2 registers. [#20532809]

Which OpenBK channel settings are needed to make shift-register-controlled relay outputs appear as toggles in the HTTP panel?

Set each mapped OpenBK channel type to Toggle after starting the ShiftRegister driver. For one 8-output register starting at channel 10, use setChannelType 10 Toggle through setChannelType 17 Toggle. For a 16-channel board starting at channel 10, continue the same pattern through channel 25. Without these channel-type commands, the relay outputs may not appear as clickable toggles in the HTTP panel. [#20533505]

What are the basic wiring connections between a BK7231/Tuya Belon2028N module, a 74HC595 shift register, and a 16-channel relay board?

Wire 3 OpenBK GPIO pins to the 74HC595 data, latch, and clock inputs, then connect each 74HC595 output to a relay input. The final example uses GPIO 24 for data, GPIO 6 for latch, and GPIO 7 for clock. Chain 2 74HC595 chips for 16 relay inputs. The developer summarized the connections as obvious according to the datasheet, so match each chip pin to its named function. [#20533505]

What kind of power supply is needed when one WiFi module controls many relays on a 16-channel relay board?

Use a power supply sized for the relay board, not only for the WiFi module. The developer warned that one WiFi module can control many relays, but the relays need a better power supply. A 16-channel relay board can energize many coils at once, so separate relay power from the small Tuya module supply when the board design allows it. Undersized power can cause resets or unstable switching. [#20530051]

Where can I find OpenBK scripting examples and documentation for creating custom automation scripts?

Use the OpenBK auto-generated documentation page and the examples shared in the thread. The developer pointed to the OpenBK GitHub README documentation when asked for scripting examples. The thread also shows commands such as startDriver, setChannelType, alias, addEventHandler2, SendGet, and startScript. These examples cover relays, IR events, HTTP commands, NTP, and MAX72XX clock scripts. [#20529763]

How do I build and run the OpenBK/OpenBeken simulator on Windows using the obkSimulator repository?

Build it by combining the OpenBK app repository with the obkSimulator repository, then selecting Win32 in Visual Studio. 1. Get OpenBK7231T_App and obkSimulator. 2. Copy the simulator contents into the OpenBK base directory. 3. Keep libs_for_simulator beside the .vcxproj file and build the Win32 target. The thread confirms localhost worked after this setup. [#20532101]

What are the required Windows dependencies for the OpenBK simulator, such as SDL, FreeGLUT, NFD, and LibDevil?

The Windows simulator setup discussed required FreeGLUT, LibDevil, NFD, and SDL. The user reported Visual Studio stopped asking for include or library files after adding those 4 dependencies. The simulator uses SDL for the windowed interface. The developer later provided a separate obkSimulator repository containing simulator support files, reducing manual dependency work. [#20532018]

Why might Visual Studio show missing files or linker errors like nfd_d.lib when building the OpenBK Windows simulator?

Visual Studio may show errors when the wrong build target or missing simulator libraries are used. The developer said several listed Beken SDK files were included only for reference and excluded from the Win32 build. Select Win32, not a firmware target. For LNK1104 cannot open file 'nfd_d.lib', the user resolved it by copying nfd_d.lib from a previous build into the expected library path. [#20532130]

What is OpenBK or OpenBeken, and how is it used to replace Tuya firmware on BK7231 and BL2028N smart modules?

OpenBK, also called OpenBeken, is firmware used to run custom local control on Tuya-style smart modules. In the thread, the Belon2028N module used a BL2028N chip, and the user flashed OpenBK successfully before adding relays. The project also runs on Windows for development. The developer noted that the simulator speeds testing because most issues are multiplatform, not BK7231-specific. [#20532809]

How do OpenBK IR remote features compare with possible 433 MHz RF remote support for controlling devices like lights or gate motors?

OpenBK IR support already existed, while 433 MHz RF support was still a future task in the thread. The developer said OpenBK IR tries to mimic Tasmota behavior and showed addEventHandler2 IR_Samsung examples. For RF, he found Tasmota used the rc-switch library and noted RF codes are similar to IR but different. He planned to buy an RF receiver before implementing it. [#20533323]
AI summary based on the discussion. May contain errors.
ADVERTISEMENT