logo elektroda
logo elektroda
X
logo elektroda

Tuya 6-Zone 24V BK7231N CBU sprinkler, dual 74HC595 OpenBeken

d_fed 543 2
ADVERTISEMENT
  • Helpful post

    Teardown of BK7231N sprinkler controller with dual 74HC595

    #1 21908473
    d_fed
    Level 1  
    Posts: 1
    Help: 1
    Rate: 1
    Teardown
    I recently purchased this generic 6-zone 24V WiFi sprinkler controller on AliExpress:
    https://www.aliexpress.com/item/1005008893463104.html
    Wi‑Fi irrigation controller with 1–8 panel, connected solenoid valves, and a smartphone app screen


    Hardware Description
    The device uses a CBU module (BK7231N) and contains two separate 74HC595 shift registers.
    PCB inside a gray enclosure with capacitors, a radio module, a buzzer, and a screw terminal block

    The board is quite well designed for flashing. It even has a pin header footprint that directly exposes +3.3V, RX, TX and GND. This is quite rare on Tuya device and made flashing very straightforward.
    Close-up of a PCB showing “RST G”, a pin header, and SMD components

    There are two 74HC595 shift registers on the board:

        The right 74HC595 controls the Triacs that switch the 24V outputs to the valves.
        The left 74HC595 is used only for the status LEDs on the front panel.

    On the side of the device there are three physical buttons. In the original Tuya firmware these were used to manually cycle through zones (Up/Down) and manually open a zone (Enter). For my own use I simply mapped them to the first three valve channels.

    Flashing

    Because of the convenient pin header, flashing was very easy. I connected a USB-UART adapter and flashed OpenBeken without any need to cut traces or solder wires.

    Configuration
    Below is the final configuration that is currently running on the device:
    
    {
      "vendor": "Tuya",
      "bDetailed": "0",
      "name": "6-Zone 24V Sprinkler Controller (CBU + 2x 74HC595)",
      "model": "Sprinkler-6Z-24V",
      "chip": "BK7231N",
      "board": "CBU",
      "flags": "1024",
      "keywords": [
        "Sprinkler",
        "Irrigation",
        "74HC595",
        "Valve"
      ],
      "pins": {
        "6": "Btn;2;2",
        "7": "Btn;3;3",
        "8": "Btn;1;1"
      },
      "command": "backlog startDriver ShiftRegister 16 20 22 1 1 1; startDriver ShiftRegister 9 17 15 1 1 1; setChannelType 1 Toggle_Inv; setChannelType 2 Toggle_Inv; setChannelType 3 Toggle_Inv; setChannelType 4 Toggle_Inv; setChannelType 5 Toggle_Inv; setChannelType 6 Toggle_Inv",
      "image": "https://obrazki.elektroda.pl/...",
      "wiki": "https://www.elektroda.com/rtvforum/topic_xxxx.html"
    }


    During the configuration process I discovered that the existing ShiftRegister driver only supported a single 74HC595 instance. Because this board uses two independent shift registers (one for valves, one for LEDs), I had to modify the driver so it can handle multiple chips at the same time.

    The modification involved changing the global variables into an array of structures (shiftReg_t) so that each command of startDriver ShiftRegister creates a new independent instance. After the change, both 74HC595 chips can be used simultaneously without one overwriting the configuration of the other.
    Summary

    This turned out to be a relatively easy device to convert to OpenBeken, mainly thanks to the built-in pin header. The only complication was the need to extend the ShiftRegister driver to support multiple chips. After the driver update and a bit of reverse engineering of the pin mapping, all six valves work correctly.
  • ADVERTISEMENT
  • #2 21909302
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14770
    Help: 659
    Rate: 12913
    That's a very interesting device, I have never seen shift register used in Tuya device before. I added ShiftRegister driver to play around with LEDs on the breadboard. I'm glad to hear you've found it useful!

    Regarding multiple shift register instances - yes, it's a good idea. Can you share your changes - open a pull request so we can merge?
    Helpful post? Buy me a coffee.
  • Startup defaults all sprinkler channels to on

    #3 21913033
    d_fed
    Level 1  
    Posts: 1
    Help: 1
    Rate: 1
    >>21909302
    Sorry, I created the pull request prior to creating this thread but there was a minor mistake that caused it to fail the tests. It's now resolved: https://github.com/openshwprojects/OpenBK7231T_App/pull/2112

    I've noticed one glitch with this device, whenever I restart or power it on it always initializes with all channels in the "on" state. I tried further messing with the driver to see if I could somehow force it to the off state but haven't had any luck.

    The other thought was adding a startup script to set all of the channels to off but that seems to ignore the underlying issue. Any thoughts?

    Also, I accidentally clicked "flash only no backup" when flashing the device so there's no original firmware backup. I was kicking myself after that mistake, but fortunately the device was fairly simple to reverse engineer.
ADVERTISEMENT