logo elektroda
logo elektroda
X
logo elektroda

How to Configure BK7231N/CB3S Tuya Sprycle WiFi Water Timer Bought from AliExpress

andrewmarkcongdon 2094 13
ADVERTISEMENT
  • #1 20891834
    andrewmarkcongdon
    Level 7  
    Attachments:
    • Sprycle-readResult_BK7231N_QIO_2024-04-1-07-53-26.bin (2 MB) You must be logged in to download this attachment.
  • ADVERTISEMENT
  • #2 20892240
    p.kaczmarek2
    Moderator Smart Home
    There is no Tuya JSON data in the attached binary file. It seems that you need to investigate the PCB to find out the GPIO roles. Have you tried using GPIO doctor?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #3 20892295
    andrewmarkcongdon
    Level 7  

    p.kaczmarek2 wrote:
    There is no Tuya JSON data in the attached binary file.


    Yes, I need to investigate further, thanks.
    Unlike a couple of other outdoor things I was looking at today, this one wasn't potted, so I can make some progress later.
  • #4 20892300
    p.kaczmarek2
    Moderator Smart Home
    This may require some script to turn off relay after 2 or 3 seconds but it's easily doable with OBK
    Helpful post? Buy me a coffee.
  • #5 20987824
    andrewmarkcongdon
    Level 7  

    P9 Button
    P14 Motor Open Valve
    P24 LED
    P26 Motor Close Valve

    Yes 2 - 3 seconds for the motor to complete its cycle sounds about right.
  • #6 20987982
    p.kaczmarek2
    Moderator Smart Home
    Can you attach it as full JSON template from the OBK Web App?
    Helpful post? Buy me a coffee.
  • #7 20989270
    andrewmarkcongdon
    Level 7  

    How to Configure BK7231N/CB3S Tuya Sprycle WiFi Water Timer Bought from AliExpress
    Attachments:
    • FJKW001J-B.zip (463 Bytes) You must be logged in to download this attachment.
  • #8 20989346
    p.kaczmarek2
    Moderator Smart Home
    Thank you!
    Code: JSON
    Log in, to see the code

    Do you need any futher help with configuring the device?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #9 20993554
    andrewmarkcongdon
    Level 7  

    p.kaczmarek2 wrote:
    Do you need any further help with configuring the device?


    For now manually turning on/off the device is working.
    I'm hoping to get to an automated script?
    Next step is the 2-3 second toggle. So OBK is where I should be looking next?
    The goal is to add a Zigbee moisture sensor in the future.
  • ADVERTISEMENT
  • Helpful post
    #10 20993719
    p.kaczmarek2
    Moderator Smart Home
    You can very easily configure device to open and close the relay after given time. Check out our autoexec samples:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/autoexecExamples.md
    For example, the following code may be altered to suit your needs:
    
    // This aliased command will turn off relay on CH1 after 10 seconds
    // addRepeatingEvent	[IntervalSeconds][RepeatsOr-1][CommandToRun]
    alias turn_off_after_time addRepeatingEvent 10 1 setChannel 1 0
    // this will run the turn off command every time that CH1 becomes 1
    addChangeHandler Channel1 == 1 turn_off_after_time 
    

    You can also check the clock events:
    
    // setup NTP driver
    startDriver ntp
    // set your time zone
    ntp_timeZoneOfs 10:00
    
    // create command aliases for later usage
    alias day_lights backlog led_temperature 200; led_dimmer 100; echo lights_day
    alias night_lights backlog led_temperature 500; led_dimmer 50; echo lights_night
    
    // at given hour, change lights state
    addClockEvent 06:01 0xff 1 day_lights 
    addClockEvent 20:01 0xff 1 night_lights 
    
    // wait for NTP sync
    waitFor NTPState 1
    // after NTP is synced, just after reboot, adjust light states correctly
    if $hour>=06&&$hour<21 then day_lights
    if $hour>=21||$hour<06  then night_lights
    
    

    How to create autoexec.bat:


    Helpful post? Buy me a coffee.
  • #11 21000601
    andrewmarkcongdon
    Level 7  
    I changed the pin definitions slightly:

      "pins": {
        "9": "Btn;3",
        "14": "Rel;0",
        "24": "LED;2",
        "26": "Rel;1"
      },
    


    So I could toggle the LED state to reflect the valve state.
    Similarly the button could be scripted to toggle valve state.

    // Channel 0 - Water Off
    // Channel 1 - Water On
    // Channel 2 - LED
    
    alias turn_off_led backlog setChannel 2 0
    alias turn_on_led backlog setChannel 2 1
    
    // This will automatically turn off relays after about 2 seconds
    // NOTE: addRepeatingEvent [RepeatTime] [RepeatCount]
    alias stop_flow backlog turn_off_led; addRepeatingEvent 2 1 setChannel 0 0
    alias start_flow backlog turn_on_led; addRepeatingEvent 2 1 setChannel 1 0
    
    addChangeHandler Channel0 != 0 stop_flow
    addChangeHandler Channel1 != 0 start_flow


    I can change the state of channel 1 and 0 using mqtt so remote script control works too.
    I also added PowerSave in startup.
  • #12 21000702
    p.kaczmarek2
    Moderator Smart Home
    Good job on scripting that. I may add that script to our autoexec.bat examples. Is this a final version, or is there anything more I can help you with?
    Helpful post? Buy me a coffee.
  • #13 21005974
    andrewmarkcongdon
    Level 7  

    Couldn't find a suitable OpenBeken compatible moisture sensor so went with this

    2-in-1 soil sensor next to a plant, measuring moisture and temperature.

    and a ZBDongle-E. Works OK, posts results to MQTT allowing simple closed loop scripting, but the battery life looks like only a week.
  • #14 21512504
    piotrszulc1
    Level 10  
    FYI there's a new version of this device - based on cbu (was cb3s), firmware reported by Tuya App is 1.0.0.
    The firmware is patched so cannot be cloudcut.
    The device looks almost identical on the outside, except that the led is now red (was blue). Can be opened and flashed over serial as the previous version.
    The pinout has changed though, now it is as follows:

    P17 - button, inverted
    P26 - red LED
    P7/P6: on/off relays, to be used with bridge driver

Topic summary

✨ The discussion focuses on configuring the BK7231N/CB3S-based Tuya Sprycle WiFi Water Timer (model FJKW001J-B) purchased from AliExpress. Initial investigation revealed no Tuya JSON data in the firmware binary, prompting manual GPIO role identification using tools like GPIO doctor. Pin assignments were established: P9 as button, P14 and P26 as relays controlling motor valves, and P24 as LED indicator. Configuration and automation were achieved using the OpenBK7231T (OBK) firmware, enabling scripting to toggle relays with timed delays (2-3 seconds) to control valve operation cycles. The user implemented MQTT integration for remote control and LED state reflection of valve status. Sample autoexec scripts from the OpenBK7231T project were recommended for relay timing and event handling. A Zigbee moisture sensor was later integrated via a ZBDongle-E for closed-loop irrigation control, though battery life was limited. A newer device version based on the CB-U board with firmware 1.0.0 was noted, featuring changed pinouts and a red LED, with firmware patched against cloudcut but still flashable via serial. The updated pinout includes P17 for an inverted button, P26 for red LED, and P6/P7 for relays using a bridge driver.

FAQ

TL;DR: Set up the Tuya Sprycle on OpenBeken with a 10‑second auto‑off script; "You can very easily configure device to open and close the relay after given time." Example commands and clock events are provided. [Elektroda, p.kaczmarek2, post #20993719]

Why it matters: This FAQ helps DIYers configure safe, local, automated irrigation on Tuya/BK7231N or CBU versions with clear pin maps and scripts.

Quick Facts

How do I configure the Tuya Sprycle timer with OpenBeken?

Map the GPIOs in the OBK Web App, then add a simple alias plus addRepeatingEvent to auto‑turn off a channel after a delay. Use clock events if you need time‑based schedules. The post includes example commands and a YouTube walkthrough for creating autoexec.bat. [Elektroda, p.kaczmarek2, post #20993719]

What are the GPIO pins for the CB3S/BK7231N version?

Use the provided template: P9 as Btn;0, P14 as Rel;0, P24 as LED;1, and P26 as Rel;1. This maps the push‑button, two relay channels for valve control, and the status LED. Load the JSON in the OBK Web App to apply the roles quickly. [Elektroda, p.kaczmarek2, post #20989346]

How can I stop the motor after 2 seconds to avoid stalling?

Create aliases that trigger addRepeatingEvent 2 1 to set the active relay channel back to 0. Andrew shared a working snippet that starts flow, lights the LED, then turns the relay off after about two seconds. This protects the motor and battery. [Elektroda, andrewmarkcongdon, post #21000601]

How do I mirror valve state on the LED and toggle with the button?

Assign LED as a separate channel (e.g., Channel 2) and the button as Btn;3 so it toggles a channel. Use aliases to setChannel 2 to match valve state and addChangeHandler to react to Channel0/1 changes. Andrew’s example shows this pattern in action. [Elektroda, andrewmarkcongdon, post #21000601]

Can I control the valve via MQTT for remote scripts?

Yes. Publish MQTT commands that setChannel 0/1 to drive the two relay channels. Andrew confirmed he can change Channel 1 and 0 using MQTT, enabling remote closed‑loop scripts. Keep auto‑off handlers in place for safety. [Elektroda, andrewmarkcongdon, post #21000601]

Where can I get a ready OpenBeken JSON template for this timer?

Use the template posted in the thread. It lists vendor Tuya, model FJKW001J‑B, chip BK7231N, board CB3S, image link, wiki, and exact pin roles. Import it via the OBK Web App to speed setup. [Elektroda, p.kaczmarek2, post #20989346]

I can’t find Tuya JSON in the firmware—how do I proceed?

That firmware dump lacks Tuya JSON. Inspect the PCB to determine GPIO roles and assign them in OBK. The author suggests using GPIO doctor to aid discovery. Once mapped, you can script behavior normally. [Elektroda, p.kaczmarek2, post #20892240]

Do I need a safety script to protect the motor?

Yes, add an auto‑off. “This may require some script to turn off relay after 2 or 3 seconds but it’s easily doable with OBK.” Use addRepeatingEvent to enforce short activations. This prevents overrun and reduces wear. [Elektroda, p.kaczmarek2, post #20892300]

Is there a new CBU hardware revision, and what changed?

Yes. A new version uses CBU, has a red LED, and Tuya reports firmware 1.0.0. The firmware is patched, so Cloudcutter will not work. You can still open it and flash over serial. The pinout also changed. [Elektroda, piotrszulc1, post #21512504]

How should I configure pins on the CBU version?

Use P17 for the button (inverted), P26 for the red LED, and P7/P6 for on/off relays. Configure the relay pair with the bridge driver, as noted by the contributor. Validate behavior before running automated scripts. [Elektroda, piotrszulc1, post #21512504]

How do I create and load an autoexec.bat in OpenBeken?

  1. In the OBK Web App, set pin roles, then open the Console.
  2. Add aliases and addRepeatingEvent or clock events to autoexec.bat.
  3. Save, reboot, and verify via logs or LED/relay behavior. Example code and a YouTube walkthrough are linked in the post. [Elektroda, p.kaczmarek2, post #20993719]

Can I close the loop with a Zigbee moisture sensor?

Yes. A user paired a Zigbee moisture sensor with a ZBDongle‑E and published readings to MQTT, enabling simple closed‑loop scripts. Expect about one week of battery life in that setup, so plan maintenance or power optimizations. [Elektroda, andrewmarkcongdon, post #21005974]

Can I still operate the valve manually while using scripts?

Yes. Manual on/off works alongside your scripts. One user ran manual control first, then added a 2–3 second toggle script next. You can iterate safely: verify manual actions, then enable auto‑off logic. [Elektroda, andrewmarkcongdon, post #20993554]
ADVERTISEMENT