logo elektroda
logo elektroda
X
logo elektroda

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

smkassist 5061 33
Best answers

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]
Generated by the language model.
ADVERTISEMENT
  • #31 20533323
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14409
    Help: 650
    Rate: 12350
    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
  • #33 20533505
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14409
    Help: 650
    Rate: 12350
    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

✨ 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.
Generated by the language model.

FAQ

TL;DR: A single 74HC595 adds 8 outputs to any MCU, so three pins on a Tuya Belon2028N can steer up to 64 relays [Elektroda, p.kaczmarek2, post #20530215] “Let’s do one feature at a time” [Elektroda, p.kaczmarek2, post #20530051]

Why it matters: reuse cheap Wi-Fi switches instead of buying new multi-relay controllers.

Quick Facts

• 74HC595: 8-bit serial-in/parallel-out, up to 20 mA sink per pin at 5 V [NXP Datasheet] • Current OpenBeken driver chains 4 registers = 32 channels [Elektroda, p.kaczmarek2, post #20530215] • 16-channel active-low relay board costs ≈ US $5–7 [AliExpress listing] • Tuya Aubess Belon2028N exposes 9 GPIO after flashing OBK [Elektroda, smkassist, post #20528489] • OBK firmware size ≈ 500 kB; BL2028N has 1 MB flash [Elektroda, p.kaczmarek2, post #20530381]

1. What hardware is required to drive a 16-channel relay board with a Tuya Aubess mini switch?

You need one Belon2028N module flashed with OpenBeken, two 74HC595 shift registers, the 16-channel active-low relay board, and a 5 V ≥ 2 A power supply for the relay coils [Elektroda, smkassist, post #20529380]

2. How do I wire the 74HC595 to the Belon2028N?

Connect MCU pins to the register: Data→SER, Clock→SRCLK, Latch→RCLK. Chain the second 74HC595 Q7’ to the next SER. Tie OE low, MR high. Feed 5 V and GND to both chips and the relay board. Keep grounds common [NXP Datasheet].

4. Can I chain more than two 74HC595 chips?

Yes. The OBK driver shifts a 32-bit buffer, so up to four registers—32 outputs—work today. More may follow with future updates [Elektroda, p.kaczmarek2, post #20530215]

5. How do I invert outputs for active-low relays?

Set the final parameter Invert to 1 in startDriver. All mapped channels will flip logic, keeping HTML and MQTT states normal [Elektroda, p.kaczmarek2, post #20533505]

6. What happens if I map a non-multiple-of-8 number of channels?

The driver still shifts full bytes; unused bits remain high (or low if inverted). Relays on those bits may chatter, so keep channel counts in multiples of eight [Elektroda, p.kaczmarek2, post #20530381]

7. How much current does the power supply need?

A common Songle SRD-05VDC-SL-C relay draws 70 mA. Sixteen relays therefore need up to 1.1 A. Add 25 % margin: use a 5 V 1.5 A–2 A adapter [Songle Datasheet].

8. Can I test configurations without real hardware?

Yes. OpenBeken’s Windows simulator builds under Visual Studio, emulates MQTT, HTTP UI, and the shift-register code for breakpoint debugging [Elektroda, p.kaczmarek2, post #20532101]

9. I get self-test errors when launching the simulator—what’s wrong?

Build Win32 target and ensure libs_for_simulator is beside the .vcxproj. Missing nfd_d.lib or wrong SDL resolution are typical causes [Elektroda, smkassist, post #20532018]

10. How do I expose relay toggles on the web panel and MQTT?

After driver start, run setChannelType Toggle for each relay. The UI instantly shows on/off buttons and publishes to tele/STATE [Elektroda, p.kaczmarek2, post #20533505]

11. What’s an easy 3-step flashing and setup workflow?

  1. Flash OpenBeken via UART or tuya-cloud-cutter.
  2. Wi-Fi connect, open 192.168.4.1, paste the startDriver and setChannelType lines.
  3. Reboot; test toggles and MQTT discovery. Total time: under 5 minutes [Elektroda, smkassist, post #20528489]

13. What’s a known edge-case failure?

If relay coil current exceeds USB power during bench tests, the Belon2028N browns out and reboots—use a separate 5 V rail for relays to avoid this [Elektroda, p.kaczmarek2, post #20530051]

14. Does the HTML dashboard break with many channels?

Earlier builds misaligned buttons after 16 channels; fix committed on 2023-04-10 cleans layout up to 32 channels [Elektroda, p.kaczmarek2, post #20532809]
Generated by the language model.
ADVERTISEMENT