logo elektroda
logo elektroda
X
logo elektroda

Water Boiler/Heater switch with 4 touch buttons and 20Amp relay

seeindarkness 1986 18
ADVERTISEMENT
  • Helpful post
    #1 20967494
    seeindarkness
    Level 7  

    Water Boiler switch with 4 touch buttons and 20Amp relay
    Markings on the board: EZS-WBA1H20C-AA_V1.4
    20211231

    Water boiler switch with four touch buttons, time markings, and a drop symbol in the center.
    Printed circuit board with electronic components and traces.
    Electronic board with markings and connection elements.
    Printed circuit board in a plastic casing with electronic components and screw terminals.
    Close-up of an integrated circuit on a printed circuit board with markings.
    WiFi boiler switch with labeled connections and technical details.

    link to item Link

    Managed to map some pins, like all the LEDS the weird Relay and one capacitance button,
    There is a mystery MCU on the board that is connected only to P28 and apparently sending high and low signals when touching 2 of the pads
    Code: JSON
    Log in, to see the code


    There is also BL0942 chip but I was unable to config it to see any packets of info from it,
    Also the relay is magnetically held.
    P24 - Relay - High to turn on
    P26 - Relay - high to turn off

    P7 also goes into the power board, no idea what it does.

    Any help will be appreciated.
  • ADVERTISEMENT
  • #2 20969785
    divadiow
    Level 38  
    did you take a backup of the factory firmware?
  • ADVERTISEMENT
  • #4 21065449
    divadiow
    Level 38  
    I'd forgotten all about this and my subconscious has since told me to buy one because it wasn't in the device list. It's now arrived but I haven't done anything but open it up.
  • ADVERTISEMENT
  • #6 21071623
    divadiow
    Level 38  
    I'm getting nothing from tuyaMcu_sendQueryState at 115200 or 9600 baud following this https://www.elektroda.com/rtvforum/topic4049908.html#21053452

    but it seemed in continuity check that two of the main PCB connector pins looked like they were going roughly in this area of the BK IC with SPI pins (I couldn't really see which pins I was touching)

    PCB connector diagram with highlighted pins 12, 13, 14.

    then I remembered there was a BL0942SPI driver. so started that

    Code: Text
    Log in, to see the code


    Screenshot displaying OpenBK_BK7231N_Boiler parameters.

    but like @uchristo device in here

    Code: Text
    Log in, to see the code


    these are seen with startdriver bl0942spi 9600 and startdriver bl0942spi 115200

    so not really sure what's next. don't know what role the MCU is playing.
  • #7 21134480
    seeindarkness
    Level 7  
    Whoa, I'm glad you bought one too, I too haven't made much progress, my guess the MCU probably is a touch controller for the buttons on the faceplate
  • ADVERTISEMENT
  • #8 21134684
    divadiow
    Level 38  
    Mine's back in the box. I think I got bored of it 😬
  • #9 21771967
    seeindarkness
    Level 7  
    Small update,
    On Pin 28 the chip that is connected is the touch-sensing chip with 4 outputs to DAC ladder, which Pin 28 interprets as 4 distinct analog levels.
    I was not able to find a firmware version that supports AB_MAP (tried compiling from source, using Docker; nothing works).
    For me the values for the buttons are:
    ~25 on Pad 1
    ~1810 on Pad 2
    ~2685 on Pad 3
    ~3623 on Pad 4
    ~4000 idle

    So that's the whole pinout.

    Added after 2 [hours] 14 [minutes]:

    BL0942 pinouts:
    J1 - Pin1 - GND
    J1 - Pin2 - GND
    J1 - Pin3 - 3.3V
    J1 - Pin4 - REL on/off
    U1-TX -> J1 - pin5 - Pin9 - BL0942
    J1 - pin6 - REL on/off
    U1-RX -> J1 - Pin7 - Pin8 - BL0942
    J1 - Pin8 - Pin6 - BL0942

    Added after 5 [hours] 14 [minutes]:

    and here is my autoexec.bat file that acts a timed switch for the relay:

    loglevel 3
    
    // --- Initial states and counters ---
    setChannel 1 0        // LED 1 + logical relay state
    setChannel 2 0        // LED 2
    setChannel 3 0        // LED 3
    setChannel 4 0        // LED 4
    setChannel 10 0       // segment counter 0..4
    setChannel 37 0       // OFF coil idle
    setChannel 39 0       // ON coil idle
    
    // --- Force relay OFF mechanically at startup ---
    setChannel 37 1
    addRepeatingEvent 1 1 setChannel 37 0
    
    // Channel 1 will still be the logical ON/OFF state for the relay
    setChannelType 1 toggle
    
    // --- COIL CONTROL: map logical state (Channel1) to latching pulses ---
    
    // Relay ON: Channel1 goes 0 -> 1
    //  - pulse ON coil (Channel39)
    addChangeHandler Channel1 == 1 backlog setChannel 39 1; addRepeatingEvent 1 1 setChannel 39 0
    
    // Relay OFF: Channel1 goes 1 -> 0
    //  - pulse OFF coil (Channel37)
    addChangeHandler Channel1 == 0 backlog setChannel 37 1; addRepeatingEvent 1 1 setChannel 37 0
    
    // --- BUTTON FROM ADC ON Channel20 ---
    // Each press advances 5-minute segments:
    //   CH10: 0 -> 1 -> 2 -> 3 -> 4 -> 0
    // We use addChannel 10 1 and wrap at >4 back to 0.
    //
    // (If your build does not support addChannel, you'll see
    //  "cmd addChannel NOT found" in the log; tell me and I’ll
    //  give an alternative using only setChannel.)
    addChangeHandler Channel20 < 4000 backlog addChannel 10 1; if $CH10>4 then setChannel 10 0
    
    // --- SEGMENT / LED MAPPING from CH10 ---
    // CH10 == 0: all LEDs and relay OFF
    addChangeHandler Channel10 == 0 backlog setChannel 1 0; setChannel 2 0; setChannel 3 0; setChannel 4 0
    
    // CH10 == 1: 5 minutes -> LED1 ON (relay ON)
    addChangeHandler Channel10 == 1 backlog setChannel 1 1; setChannel 2 0; setChannel 3 0; setChannel 4 0
    
    // CH10 == 2: 10 minutes -> LED1,2 ON
    addChangeHandler Channel10 == 2 backlog setChannel 1 1; setChannel 2 1; setChannel 3 0; setChannel 4 0
    
    // CH10 == 3: 15 minutes -> LED1,2,3 ON
    addChangeHandler Channel10 == 3 backlog setChannel 1 1; setChannel 2 1; setChannel 3 1; setChannel 4 0
    
    // CH10 == 4: 20 minutes -> LED1,2,3,4 ON
    addChangeHandler Channel10 == 4 backlog setChannel 1 1; setChannel 2 1; setChannel 3 1; setChannel 4 1
    
    // NOTE: Whenever CH1 changes (due to CH10 mapping above),
    // the coil handlers above will generate the appropriate
    // ON/OFF pulse.
    
    // --- 5-MINUTE COUNTDOWN ---
    // Every 300 seconds (5 minutes) reduce CH10 by 1, down to 0.
    // We split into four short timers to avoid too many args.
    
    // 4 -> 3
    addRepeatingEvent 300 -1 if $CH10==4 then setChannel 10 3
    // 3 -> 2
    addRepeatingEvent 300 -1 if $CH10==3 then setChannel 10 2
    // 2 -> 1
    addRepeatingEvent 300 -1 if $CH10==2 then setChannel 10 1
    // 1 -> 0
    addRepeatingEvent 300 -1 if $CH10==1 then setChannel 10 0
  • #10 21775536
    seeindarkness
    Level 7  
    Small update:

    A simpler script to just turn on and off with timer:

    loglevel 2
    
    // --- Initial states ---
    setChannel 1 0        // LED 1   logical relay state
    setChannel 2 0        // unused, keep OFF
    setChannel 3 0        // unused, keep OFF
    setChannel 4 0        // unused, keep OFF
    setChannel 37 0       // OFF coil idle
    setChannel 39 0       // ON coil idle
    
    // --- Force relay OFF mechanically at startup ---
    // Make sure logical state is OFF
    setChannel 1 0
    // Send a short OFF pulse to guarantee the latching relay is OFF.
    setChannel 37 1
    // If 0.2 is not accepted by your build, change 0.2 to 1.0.
    addRepeatingEvent 0.2 1 setChannel 37 0
    
    // Channel 1 = logical ON/OFF state for the relay (and LED 1)
    setChannelType 1 toggle
    
    // --- COIL CONTROL   10-minute TIMER ---
    // Relay ON: Channel1 goes 0 -> 1
    //  - pulse ON coil (Channel39)
    //  - start a 10-minute timer to turn Channel1 OFF.
    addChangeHandler Channel1 == 1 backlog setChannel 39 1; addRepeatingEvent 0.2 1 setChannel 39 0; addRepeatingEvent 600 1 setChannel 1 0
    
    // Relay OFF: Channel1 goes 1 -> 0
    //  - pulse OFF coil (Channel37)
    addChangeHandler Channel1 == 0 backlog setChannel 37 1; addRepeatingEvent 0.2 1 setChannel 37 0
    
    // --- BUTTON FROM ADC ON Channel20 ---
    // Any press toggles Channel1.
    // When Channel1 becomes 1, the handler above starts the 10-minute timer.
    // When Channel1 becomes 0, it turns OFF immediately.
    addChangeHandler Channel20 < 4000 toggleChannel 1
  • #11 21784551
    seeindarkness
    Level 7  
    Code: JSON
    Log in, to see the code
  • #13 21787170
    p.kaczmarek2
    Moderator Smart Home
    seeindarkness wrote:
    Small update,
    On Pin 28 the chip that is connected is the touch-sensing chip with 4 outputs to DAC ladder, which Pin 28 interprets as 4 distinct analog levels.

    There is a driver for that, see:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/drivers.md
    Documentation fragment about ADCButton function with highlighted text


    seeindarkness wrote:

    I was not able to find a firmware version that supports AB_MAP (tried compiling from source, using Docker; nothing works).

    We have a dedicated solution for compiling firmware online with just few clicks. Just enable this driver by defining "ENABLE_DRIVER_ADCBUTTON" for your platform in obk_config.h and follow this guide:
    https://www.elektroda.com/rtvforum/topic4033833.html

    No toolchain required, not even code download - with OBK, you can build your firmware version (or even develop your driver from scratch) fully on GitHub. That's the recommended solution. And it even automatically runs self tests - so you get feedback telling whether everything is still ok in OBK core. And it checks for memory leaks... etc.
    Helpful post? Buy me a coffee.
  • #14 21794424
    seeindarkness
    Level 7  
    >>21784616 Yeah, this is the correct one.
  • #16 21799581
    ainoretho
    Level 2  
    If it helps anyone, I (also have one of those, was watching this thread for a while. First OpenBeken usage - so thanks a lot!):

    https://github.com/yehoshuapw/OpenBK7231T_App/actions/runs/20718534966/artifacts/5025369763 - A build with the define mentioned here for the ADC driver.

    (Also, for some reason, when I have the top red LED as LED it stays on regardless of the channel, but when I put it as REL it does what I want it to)
    Here are some helpers which I just created to try and write some autoexec which will be usable without Wi-Fi working

    // LEDS
    SetChannelLabel 8 UpRedLED
    SetChannelLabel 4 UpBlueLED
    SetChannelLabel 5 RtRedLED
    SetChannelLabel 1 RtBlueLED
    SetChannelLabel 6 DnRedLED
    SetChannelLabel 2 DnBlueLED
    SetChannelLabel 7 LtRedLED
    SetChannelLabel 3 LtBlueLED
    
    SetChannelPrivate 8 1
    SetChannelPrivate 4 1
    SetChannelPrivate 5 1
    SetChannelPrivate 1 1
    SetChannelPrivate 6 1
    SetChannelPrivate 2 1
    SetChannelPrivate 7 1
    SetChannelPrivate 3 1
    
    SetChannelVisible 8 0
    SetChannelVisible 4 0
    SetChannelVisible 5 0
    SetChannelVisible 1 0
    SetChannelVisible 6 0
    SetChannelVisible 2 0
    SetChannelVisible 7 0
    SetChannelVisible 3 0
    
    alias led_up_red_on SetChannel 8 1
    alias led_up_red_off SetChannel 8 0
    alias led_up_blue_on SetChannel 4 1
    alias led_up_blue_off SetChannel 4 0
    alias led_rt_red_on SetChannel 5 1
    alias led_rt_red_off SetChannel 5 0
    alias led_rt_blue_on SetChannel 1 1
    alias led_rt_blue_off SetChannel 1 0
    alias led_dn_red_on SetChannel 6 1
    alias led_dn_red_off SetChannel 6 0
    alias led_dn_blue_on SetChannel 2 1
    alias led_dn_blue_off SetChannel 2 0
    alias led_lt_red_on SetChannel 7 1
    alias led_lt_red_off SetChannel 7 0
    alias led_lt_blue_on SetChannel 3 1
    alias led_lt_blue_off SetChannel 3 0
    
    // pin fixups: 6,14,15,16,17,20,22,23
    SetPinRole 6 REL
    SetPinRole 6 LED
    SetPinRole 14 REL
    SetPinRole 14 LED
    SetPinRole 15 REL
    SetPinRole 15 LED
    SetPinRole 16 REL
    SetPinRole 16 LED
    SetPinRole 17 REL
    SetPinRole 17 LED
    SetPinRole 20 REL
    SetPinRole 20 LED
    SetPinRole 22 REL
    SetPinRole 22 LED
    SetPinRole 23 REL
    SetPinRole 23 LED
    
    // timer
    SetChannelLabel 40 WaterBoilerTimer
    setChannelType 40 TimerSeconds
    
    SetChannelLabel 41 SwitchState
    setChannelType 41 ReadOnly
    
    SetChannelLabel 39 SwitchOn
    SetChannelLabel 37 SwitchOff
    
    startDriver ADCButton
    
    AB_Map 910 2250 3150 3860
    
    addEventHandler OnADCButton 2 backlog led_up_blue_on; SetChannel 40 7200; addRepeatingEvent 0.5 1 led_up_blue_off
    addEventHandler OnADCButton 3 backlog led_rt_blue_on; SetChannel 40 1800; addRepeatingEvent 0.5 1 led_rt_blue_off
    addEventHandler OnADCButton 0 backlog led_dn_blue_on; SetChannel 40 3600; addRepeatingEvent 0.5 1 led_dn_blue_off
    addEventHandler OnADCButton 1 backlog led_lt_blue_on; SetChannel 40 5400; addRepeatingEvent 0.5 1 led_lt_blue_off
    
    SetChannel 37 1
    addRepeatingEvent 0.2 1 SetChannel 37 0
    alias switch_on backlog SetChannel 39 1; addRepeatingEvent 0.2 1 SetChannel 39 0
    alias switch_off backlog SetChannel 37 1; addRepeatingEvent 0.2 1 SetChannel 37 0
    
    loop:
    // for faster testing, put here some a bigger number, say -75
    // however make sure 30*60 is a multiple of it (to not go negative). and make sure it is odd, so the led flashing can work
    if $CH40>0 then addChannel 40 -1
    
    if $CH40>900||($CH40>0&&($CH40%2==0)) then led_rt_red_on else led_rt_red_off
    if $CH40>2700||($CH40>1800&&($CH40%2==0)) then led_dn_red_on else led_dn_red_off
    if $CH40>4500||($CH40>3600&&($CH40%2==0)) then led_lt_red_on else led_lt_red_off
    if $CH40>6300||($CH40>5400&&($CH40%2==0)) then led_up_red_on else led_up_red_off
    
    if $CH40==0 then goto wanted_off
    wanted_on:
    if $CH41==0 then backlog SetChannel 41 1; switch_on
    goto loop_end
    wanted_off:
    if $CH41==1 then backlog SetChannel 41 0; switch_off
    
    loop_end:
    delay_s 1
    goto loop
    


    update: added here full code which as far as I can tell seems to work. I tested it with ticks of 75 seconds instead of 1 second per tick,
    and this is the first thing I ever wrote for openbeken (or IoT in general), so take it with a grain of salt.
    (I did first skip over all the examples and docs, so doing here a loop instead of a infinite addRepeatingEvent like in above scripts)
  • #17 21800017
    p.kaczmarek2
    Moderator Smart Home
    ainoretho wrote:

    (Also, for some reason, when I have the top red LED as LED it stays on regardless of the channel, but when I put it as REL it does what I want it to)

    Are you sure, can you double check? I think that internaly Relay and LED handling is the same. For example:
    C code snippet handling pin roles for LEDs and relays with syntax highlighting
    Helpful post? Buy me a coffee.
  • #18 21800488
    ainoretho
    Level 2  
    >>21800017 I don't know _why_, so this most likely is some misunderstanding on my part, but:

    When powering on, the upper red LED is on, and doing `setchannel` does not fix it; also when first doing 1. and some of the LEDs also don't do anything when I do a `setchannel` to them,
    This is all fixed if I change from LED to REL or opposite (see in the script above I swap them all back and forth).

    I suspect the `HAL_PIN_SetOutputValue` call from the func you attached is the reason this helps, which brings the question about what can be seen without any "hack" fixes in the GPIO config page.
    Checked that again just to make sure, and after a clean boot red up LED was on, so pin 15, channel 8. `getchannel 8` gave that it is 0.
    And in GPIO finder page was low. When set to high then back to low went off (which causes the change from LED to REL in this UI, which is the reason I tried that).
    So, either the GPIO page does not "read" the right value being put out - or it does not touch it, assume it is 0 but it is 1. I don't understand enough to know more.
    But triggering a set pin to 0 works, and the method of changing the pin type works. (and I don't find a command to set a pin value)

    tl;dr: yes, but it isn't about being REL or LED, it is about _switching_
  • #19 21825378
    yarix2
    Level 6  
    That device seems to be very problematic.
    after flashing many devices in the past, i loved the mainboard's JP1 socket, all pins we need for flashing are easily accessible via it (see image). you only need to ground CEN point once for the flashing.

    However, when i uploaded the firmware i run into many random network problems; sometimes the hotspot didn't work, sometimes the device failed to connect to the router.
    at some point, i clicked "Erased all" in the Esay UART Flasher gui, and since then the wifi seems to be gone. the device is only accessible via USB.
    of course, i did try to `Restore RF part` but that didn't solve the issue.
    This is the output from the restore rf...
    Code: Bash
    Log in, to see the code


    After that, i uploaded the latest firmware, but as mention, i can' see the device (neither hotspot nor router connectivity are happening).

    Code: Bash
    Log in, to see the code


    Is there anything i can do to make wifi work again?

    PCB board with labeled JP1 pins: GND, 3.3V, TX, RX, and CEN

Topic summary

Discussion revolves around a water boiler/heater switch featuring 4 touch buttons and a 20Amp relay, identified by the board marking EZS-WBA1H20C-AA_V1.4. Users are exploring the functionality of the device, particularly the mystery MCU connected to specific pins that send signals when buttons are touched. Some participants have attempted to map pins and retrieve data from the device, including firmware backups and storage data. Issues with communication and data retrieval from the device using Tuya and BL0942SPI drivers have been reported, with users sharing their experiences and troubleshooting steps.
Summary generated by the language model.
ADVERTISEMENT