logo elektroda
logo elektroda
X
logo elektroda

Tuya Water Sensor WiFi DY-SQ400B Flashing, Configuration for OBK Esphome/Tasmota style firmware

io2345 11367 113
Best answers

How to flash and configure the Tuya DY-SQ400B water sensor with its CB3S board for OpenBeken?

Flash it as a BK7231N/CB3S device, not TuyaMCU: make a 2 MB backup with BK7231GUIFlashTool first, then use the same tool’s Write option to flash OpenBeken [#21070016] [#21070089] [#21070895] The working pin map ended up as GPIO7 PWM for buzzer/LED on channel 5, GPIO8 DoorSnsrWSleep_nPup on channel 0, GPIO14 BAT_Relay on channel 1, GPIO23 BAT_ADC on channel 2, GPIO24 Btn_ScriptOnly, and GPIO26 LED on channel 5 [#21095640] For wake/sleep problems, the thread recommends DSEdge tuning (0/2 were both tried), and if the button causes unwanted actions, setting it to Btn_ScriptOnly; accidental childlock/disable-autostart flags should be cleared [#21072613] [#21086332] [#21403880] The final scripts used DSTime at the top of autoexec.bat for timed wakeups, with a loop that clears DSTime while $CH0==1 and an addChangeHandler to drive channel 5 to 80 when channel 0 goes high; DSTime must be the first line when used [#21089513] [#21091186] [#21095624] [#21095640] Battery reporting was calibrated with Battery_Setup values around 2800–2900 min, 3700–4100 max, 1.94 vdivider, plus Battery_cycle 20, and the new DSTime second argument can be used to force a periodic wakeup for battery updates [#21397320] [#21089513]
Generated by the language model.
ADVERTISEMENT
  • #1 21068803
    io2345
    Level 9  
    Posts: 244
    Help: 1
    Rate: 6
    Did anyone yet come across the Tuya Wifi Water Sensor DY-SQ400B?
    It has a CR123A 3V-battery and a CB3S Com-Board:

    Close-up of the interior part of the Tuya Wifi Water Sensor DY-SQ400B with CB3S board. Top view of the Tuya Wifi Water Sensor DY-SQ400B circuit board with CB3S module. White Tuya Wifi water sensor DY-SQ400B with three views: top, side, and bottom.
    Attachments:
    • Tuya Water Sensor WiFi DY-SQ400B Flashing, Configuration for OBK Esphome/Tasmota style firmware Tuya Wifi Watersensor.JPG (8.35 KB) You must be logged in to download this attachment.
  • ADVERTISEMENT
  • #2 21068872
    divadiow
    Level 38  
    Posts: 4867
    Help: 424
    Rate: 863
    I have not. Have you opened it up? what module/chip?
  • #3 21069018
    io2345
    Level 9  
    Posts: 244
    Help: 1
    Rate: 6
    CB3S Board. Pictures now in the first thread
  • #4 21069228
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14429
    Help: 650
    Rate: 12396
    Looks like TuyaMCU device:
    Electronic board with CB3S module and component markings
    Please do TuyaMCU capture to confirm:
    https://www.elektroda.com/rtvforum/topic3970199.html#20528459
    See also generic TuyaMCU tutorial:
    https://www.elektroda.com/rtvforum/topic4038151.html
    Helpful post? Buy me a coffee.
  • #5 21069430
    io2345
    Level 9  
    Posts: 244
    Help: 1
    Rate: 6
    Alright, I'll try that. Seems to be quite easy with battery powered modules.

    As I am still a beginner, please, could anyone confirm, that these are the Pins, that I have to connect to UART?
    What about TX2, does that have to be connected somewhere? Or only TX1 ?

    Close-up of CB3S electronic module with visible pins labeled GND, TX D2, RX D1, TX D1.
  • #6 21069433
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14429
    Help: 650
    Rate: 12396
    Both flashing and TuyaMCU are using UART1, so you need to check TXD1 and RXD1:
    Pin schematic of the WB3S module showing connections to UART1.
    Both WB3S and CB3S have UART1 on the same pins.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #7 21069440
    divadiow
    Level 38  
    Posts: 4867
    Help: 424
    Rate: 863
    it'd be cool to get the log from TXD2 though too?
  • #8 21069447
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14429
    Help: 650
    Rate: 12396
    Well, for research purposes, sure. You could also try to do one more thing before flashing, namely:
    https://www.elektroda.com/rtvforum/topic4021129.html
    Helpful post? Buy me a coffee.
  • #9 21069759
    io2345
    Level 9  
    Posts: 244
    Help: 1
    Rate: 6
    >>21069433
    Thanks for clearing things with Pinout. I mistakenly did put GND pin position on the photo on the wrong place "around the corner" ;-)

    EDIT: Fixed photo in above thread #5, so nobody get's confused
  • #10 21069767
    divadiow
    Level 38  
    Posts: 4867
    Help: 424
    Rate: 863
    Did you manage to make a backup and flash OBK?
  • #11 21069833
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14429
    Help: 650
    Rate: 12396
    First I would consider doing either dpID extraction from Tuya or UART capture so we can tell which dpID is alarm, etc, etc.
    Still, we may already know that, if there was a similiar device on our list:
    https://openbekeniot.github.io/webapp/devicesList.html
    or if there was similiar Tasmota device...
    Helpful post? Buy me a coffee.
  • #12 21069867
    io2345
    Level 9  
    Posts: 244
    Help: 1
    Rate: 6

    RealTerm program interface for serial data capture. Screenshot of a program for analyzing UART packets, showing the interface for capturing data. >>21069228
    Tried that, but no luck. So, maybe I did something wrong, or there is no MCU-communication.
    I tried with UART RX, TX -> Chip RX, TX and with crossed lines as well. Nothing on TX1 and only crap on TX2 (which I guess isn't even connected - see "captures.zip").
    First I tried to capture with "Tuya MCU Explorer / Analyzer", then with "RealTerm".

    I think it is very possible, that there is no MCU-communication, as there is not really much of functionality on the board: Only a hardware button, a buzzer and the two sensor contacts.
    Attachments:
    • captures.zip (4.38 KB) You must be logged in to download this attachment.
  • ADVERTISEMENT
  • #13 21069875
    io2345
    Level 9  
    Posts: 244
    Help: 1
    Rate: 6
    >>21069767
    Me, as being a beginner, I would not dare to flash without knowing what I'm doing ;-)
  • #14 21069910
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14429
    Help: 650
    Rate: 12396
    I still think it's TuyaMCU, either at 9600 baud or at 115200. Let's check something else, but still related.
    Make sure that batteries are inserted.
    When batteries are inserted, is there 3.3V directly on the WiFi module (between WiFI module GND and 3.3V)?

    I am asking because TuyaMCU devices are often controlling WiFi module power via transistor so WiFI module is off most of the time.

    second question - take off batteries, is the continuity between those two points?
    Purple circuit board with WiFi module model CB3S labeled.
    Maybe it's not MCU, after all...

    Also, still without batteries, where TXD1 and RXD1 go? Check with multimeter. Do they connect to SOIC8 chip?
    Helpful post? Buy me a coffee.
  • #15 21070005
    io2345
    Level 9  
    Posts: 244
    Help: 1
    Rate: 6
    There is always power between GND and V+ on the CB3S unit (measuring with multimeter for four minutes).

    There is direct connection between V+ of the CB3S and the buffer capacitor.

    Tx and Rx on the CB3S unit are not connected to the U6 chip.
  • #16 21070016
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14429
    Help: 650
    Rate: 12396
    So this is not a TuyaMCU device. Can you try doing 2MB firmware read with our tool?
    https://github.com/openshwprojects/BK7231GUIFlashTool
    Helpful post? Buy me a coffee.
  • #17 21070074
    io2345
    Level 9  
    Posts: 244
    Help: 1
    Rate: 6

    This tool automatically starts an erase of the stock firmware, right? I want to avoid this for the moment. How can I achieve it?
  • #18 21070089
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14429
    Help: 650
    Rate: 12396
    This tool automatically does a 2MB backup first, but I asked you to do a backup specifically. There is a "Read firmware" button that will make a 2MB flash backup that can be used to extract device configuration.
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #19 21070110
    io2345
    Level 9  
    Posts: 244
    Help: 1
    Rate: 6
    {
    	"bt_pin":"24",
    	"status_led_pin":"26",
    	"rstcnt":"3",
    	"nxtalm_t":"5",
    	"basic_pin_pin":"8",
    	"bt_lv":"0",
    	"bz_pin_pin":"7",
    	"net_t":"180",
    	"samp_type":"1",
    	"bz_pin_lv":"1",
    	"basic_st":"1",
    	"basic_pin_lv":"1",
    	"alarm_type":"0",
    	"samp_sw_pin":"14",
    	"max_V":"3000",
    	"min_V":"2600",
    	"sound_pin":"6",
    	"samp_sw_lv":"1",
    	"beep_t":"10",
    	"status_led_lv":"1",
    	"samp_pin":"23",
    	"crc":"66",
    	"}hfAgw_di{abi":"0",
    	"id":"null",
    	"swv":"1.1.6",
    	"bv":"40.00",
    	"pv":"2.2",
    	"lpv":"3.3",
    	"pk":"key4cngfa3qtqsk7",
    	"firmk":"key4cngfa3qtqsk7",
    	"cadv":"05Atls_ca_cnt.1.6",
    	"s_id":"null",
    	"dtp":"0",
    	"sync":"0",
    	"attr_num":"0",
    	"mst_tp_0":"0",
    	"mst_ver_0":"null",
    	"mst_tp_1":"0",
    	"mstAtimer_arrer_2":"null",
    	"mst_tp_3":"0",
    	"mst_ver_3":"null }3^Awf_start_mdll",
    	"md":"0",
    	"random":"0",
    	"wfb64":"1",
    	"stat":"0",
    	"token":"null",
    	"region":"null",
    	"reg_key":"null",
    	"dns_prio":"00Atls_ca_cnt0EAtls_ca_cnt0{abi",
    	"cdv":"1.0.0",
    	"dev_swv":"1.1.6",
    	"mst_ver_1":"null",
    	"mst_tp_2":"0",
    	"mst_ver_2":"null",
    	"type":"obj",
    	"mode":"ro",
    	"property":"{range",
    	"{trigger":"direct",
    	"max":"100",
    	"scale":"0",
    	"step":"1",
    	"lckey":"Q>eU*F}PIV<Ev4NL",
    	"h_url":"http",
    	"h_ip":"52.29.225.195",
    	"hs_url":"null",
    	"hs_ip":"null",
    	"hs_psk":"https",
    	"hs_psk_ip":"18.185.182.159",
    	"mqs_url":"null",
    	"mqs_ip":"null",
    	"mq_url":"m2.tuyaeu.com",
    	"mq_ip":"3.66.126.37",
    	"ai_sp":"null",
    	"ai_sp_ip":"null",
    	"mq_psk":"m2.tuyaeu.com",
    	"mq_psk_ip":"3.66.126.37",
    	"time_z":"+01",
    	"s_time_z":"[[1711846800",
    	"wx_app_id":"null",
    	"wx_uuid":"null",
    	"dy_tls_m":"0",
    	"cloud_cap":"1025",
    	"psk21_key":"null "
    }
    


    Text description:
    Device configuration, as extracted from Tuya:
    - Button (channel 0) on P24
    - Status LED on P26
    - PIR sensor on P8
    - Battery Relay on P14
    - Battery Max Voltage: 3000
    - Battery Min Voltage: 2600
    - Battery ADC on P23
    Device seems to use Battery Driver. See more details here: https://www.elektroda.com/rtvforum/topic3959103.html
    No module information found.
    And the Tuya section starts, as usual, at 2023424
  • #20 21070118
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14429
    Help: 650
    Rate: 12396
    Whoa, that did the most of the job for you! Okay, so now, do you know how deep sleep works in OpenBeken? You know, the system that puts the device to sleep and wakes it up on button (or sensor) event to report state to HA?
    Helpful post? Buy me a coffee.
  • #21 21070139
    io2345
    Level 9  
    Posts: 244
    Help: 1
    Rate: 6

    No, sorry. No idea about that. I'm a beginner when it comes to IoT
  • #22 21070823
    io2345
    Level 9  
    Posts: 244
    Help: 1
    Rate: 6

    >>21070118
    Let me know if there is something more I can do or check for the moment. If not, I would prefer to put the sensor back together. Don't want to stay without flood warning too long...
  • #23 21070841
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14429
    Help: 650
    Rate: 12396
    Well, the next step is to flash OpenBeken. Then you do first the configuration without the deep sleep, but without deep sleep, battery will discharge in few days, so it's only for testing. In this stage, you have to check whether the digital input (decoded as PIR) can detect water correctly.

    Once you are sure that your digital input can detect water, and once you have also button configured, you can proceed to testing deep sleep wakeup feature. The testing should be done as follows:
    - make sure button and dInput roles are set
    - for the testing purposes, enter PinDeepSleep command via console
    - then do separate tests for each wakeup method, try to wakeup device via button and via water event....
    Then you will have a choice, you can either use existing driver (like DoorSensor driver - it's called DoorSensor but for water the logic is similiar) or write your own autoexec.bat script...
    Here are some scripting samples:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/autoexecExamples.md
    But, as a beginner, you will most likely prefer to just use existing solution, the "DoorSensor" driver, which is also good.

    The battery powered devices are a bit harder to configure than the mains powered ones, but don't get discouraged, it's really just a 15 minutes job, and I can guide you through full process.

    So, now that you have 2MB flash backup, the first step is to flash OBK, then connect to OBK access point, and then configure your WiFi data so OBK connects to your router...
    Helpful post? Buy me a coffee.
  • #24 21070858
    io2345
    Level 9  
    Posts: 244
    Help: 1
    Rate: 6

    Ok, let's start. Draining battery isn't a problem.
    Let me try to flash - with the same tool I used for backup, right?

    Hinzugefügt nach 34 [Minuten]:

    Flashing ok. Connected to local WiFi and MQTT Broker.
    What's next?
  • #25 21070895
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14429
    Help: 650
    Rate: 12396
    Of course draining battery in 2-3 days is a problem, but we;'re going to fix that very soon. It's just simpler to setup device without deep sleep first, so you can do some basic tests to make sure that everything is alright.

    So, to flash the device, you should use the same tool, but use the "write" option instead of "read".

    You can also watch some of our tutorials on youtube, here:
    https://www.youtube.com/@elektrodacom
    For instance, here we are flashing one CB2S module with the BK7231 easy flash tool:
    https://www.youtube.com/watch?v=YQdR7r6lXRY
    Helpful post? Buy me a coffee.
  • #26 21070916
    io2345
    Level 9  
    Posts: 244
    Help: 1
    Rate: 6
    Basic configuration done, I hope, it's not to bad ;-)

    {
      "vendor": "Tuya",
      "bDetailed": "0",
      "name": "Full Device Name Here",
      "model": "enter short model name here",
      "chip": "BK7231N",
      "board": "TODO",
      "flags": "1024",
      "keywords": [
        "TODO",
        "TODO",
        "TODO"
      ],
      "pins": {
        "8": "DoorSnsrWSleep;0",
        "14": "BAT_Relay;0",
        "23": "BAT_ADC;0",
        "24": "Btn;0",
        "26": "LED_n;0"
      },
      "command": "",
      "image": "https://obrazki.elektroda.pl/YOUR_IMAGE.jpg",
      "wiki": "https://www.elektroda.com/rtvforum/topic_YOUR_TOPIC.html"
    }


    Currently the hardware button only toggles the LED on/off
  • #27 21070920
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14429
    Help: 650
    Rate: 12396
    Well... I am not sure if I would recommend using DoorSnsrWSleep pin role already, because it will automatically invoke deep sleep... but whatever you want.

    Since you have already set the DoorSnsrWSleep role, this means your device is going to sleep after some time, right? So it's becoming offline? Do you have a sleep countdown timer on your HTTP page?

    Now, the next step in this case is the following:
    - first, make sure that you can just wake up your device with a button (this is used as an emergency to recover it if something goes wrong)
    - then, check if you can wake up your device with a water sensor (shorting that sensor or adding water.....)

    It may be helpful for you to connect UART RX to TX2 pin (not TX1 !) of the WiFi module, so you can observe device debug log at 115200 baud, so you can tell what's going on.
    Helpful post? Buy me a coffee.
  • #28 21070943
    io2345
    Level 9  
    Posts: 244
    Help: 1
    Rate: 6
    I just did put in, what the analysis of the firmware readout delivered as information. Of course, I will put in, whatever you suggest.

    At the moment I'm at work, so nothing will happen before 7 p.m.
  • #29 21071038
    p.kaczmarek2
    Moderator Smart Home
    Posts: 14429
    Help: 650
    Rate: 12396
    Here is some futher reading for you, information related to DoorSensor driver (which very well may be used also for water detection):
    https://www.elektroda.com/rtvforum/find.php?q=DoorSensor
    Helpful post? Buy me a coffee.
  • #30 21071114
    io2345
    Level 9  
    Posts: 244
    Help: 1
    Rate: 6
    >>21070943
    Back now. Right, there is a counter on the device's webpage saying "time until deep sleep", but the counter never goes beyond 50 seconds. The red LED of the device gives a short flash every 8-9 seconds.

    Also, high water level (simulated with resistor between sensors) does not do anything on the device itself. In the Tuya-version the LED starts to flash and the buzzer will activate as long as the water level is high.

    In the Log I can see, that the device switches the value for high water level for a very short time (less than one second), every 8-9 seconds. So, that's probably the reason for the above mentioned LED flash.

    
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MQTT:Publishing val 4411 to Wassersensor1/voltage/get retain=0
    Info:MQTT:Publishing val 100 to Wassersensor1/battery/get retain=0
    Info:DRV:DRV_BATTERY : battery voltage : 4411.828125 and percentage 100.000000%
    Info:MAIN:Time 1452, idle 181881/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1453, idle 172940/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 2, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1454, idle 187047/s, free 75752, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1455, idle 187228/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1456, idle 198670/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1457, idle 184043/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1458, idle 371128/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1459, idle 185887/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1460, idle 185564/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:GEN:dhcp=0 ip=192.168.0.154 gate=192.168.0.1 mask=255.255.255.0 mac=d8:d6:68:2f:f8:65
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-62,ssid=WiFiAccessPoint,bssid=50:e6:36:35:f5:b8,channel=1,cipher_type:CCMP
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1461, idle 179800/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:DRV:DRV_BATTERY : Measure Battery volt en perc
    Info:GEN:CHANNEL_Set channel 0 has changed to 1 (flags 0)
    
    Info:MQTT:Channel has changed! Publishing 1 to channel 0 
    Info:MQTT:Publishing val 1 to Wassersensor1/0/get retain=0
    Info:GEN:CHANNEL_Set channel 0 has changed to 0 (flags 0)
    
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MQTT:Publishing val 4415 to Wassersensor1/voltage/get retain=0
    Info:MQTT:Publishing val 100 to Wassersensor1/battery/get retain=0
    Info:DRV:DRV_BATTERY : battery voltage : 4415.853515 and percentage 100.000000%
    Info:MAIN:Time 1462, idle 184377/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1463, idle 172631/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 2, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1464, idle 182464/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1465, idle 183808/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1466, idle 183426/s, free 75968, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1467, idle 184900/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MAIN:Main_OnWiFiStatusChange - WIFI_STA_CONNECTED - 4
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1468, idle 181960/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1469, idle 187075/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1470, idle 184156/s, free 67592, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 3/38 
    Info:GEN:dhcp=0 ip=192.168.0.154 gate=192.168.0.1 mask=255.255.255.0 mac=d8:d6:68:2f:f8:65
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-61,ssid=WiFiAccessPoint,bssid=50:e6:36:35:f5:b8,channel=1,cipher_type:CCMP
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1471, idle 178443/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:DRV:DRV_BATTERY : Measure Battery volt en perc
    Info:GEN:CHANNEL_Set channel 0 has changed to 1 (flags 0)
    
    Info:MQTT:Channel has changed! Publishing 1 to channel 0 
    Info:MQTT:Publishing val 1 to Wassersensor1/0/get retain=0
    Info:GEN:CHANNEL_Set channel 0 has changed to 0 (flags 0)
    
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MQTT:Publishing val 4414 to Wassersensor1/voltage/get retain=0
    Info:MQTT:Publishing val 100 to Wassersensor1/battery/get retain=0
    Info:DRV:DRV_BATTERY : battery voltage : 4414.511718 and percentage 100.000000%
    Info:MAIN:Time 1472, idle 186544/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1473, idle 168876/s, free 75968, MQTT 1(1), bWifi 1, secondsWithNoPing 2, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1474, idle 183341/s, free 75984, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 3/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1475, idle 186412/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1476, idle 182125/s, free 75968, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1477, idle 183607/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1478, idle 189737/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1479, idle 186442/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1480, idle 184427/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:GEN:dhcp=0 ip=192.168.0.154 gate=192.168.0.1 mask=255.255.255.0 mac=d8:d6:68:2f:f8:65
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-69,ssid=WiFiAccessPoint,bssid=50:e6:36:35:f5:b8,channel=1,cipher_type:CCMP
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1481, idle 180483/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:DRV:DRV_BATTERY : Measure Battery volt en perc
    Info:GEN:CHANNEL_Set channel 0 has changed to 1 (flags 0)
    
    Info:MQTT:Channel has changed! Publishing 1 to channel 0 
    Info:MQTT:Publishing val 1 to Wassersensor1/0/get retain=0
    Info:GEN:CHANNEL_Set channel 0 has changed to 0 (flags 0)
    
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MQTT:Publishing val 4414 to Wassersensor1/voltage/get retain=0
    Info:MQTT:Publishing val 100 to Wassersensor1/battery/get retain=0
    Info:DRV:DRV_BATTERY : battery voltage : 4414.511718 and percentage 100.000000%
    Info:MAIN:Time 1482, idle 191116/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1483, idle 170041/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 2, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1484, idle 184906/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1485, idle 182845/s, free 75984, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 3/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1486, idle 181827/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1487, idle 186179/s, free 75968, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1488, idle 186793/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1489, idle 182851/s, free 75984, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 3/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1490, idle 189198/s, free 75968, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:GEN:dhcp=0 ip=192.168.0.154 gate=192.168.0.1 mask=255.255.255.0 mac=d8:d6:68:2f:f8:65
    Info:GEN:sta: 1, softap: 0, b/g/n
    Info:GEN:sta:rssi=-69,ssid=WiFiAccessPoint,bssid=50:e6:36:35:f5:b8,channel=1,cipher_type:CCMP
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1491, idle 181699/s, free 75968, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:DRV:DRV_BATTERY : Measure Battery volt en perc
    Info:GEN:CHANNEL_Set channel 0 has changed to 1 (flags 0)
    
    Info:MQTT:Channel has changed! Publishing 1 to channel 0 
    Info:MQTT:Publishing val 1 to Wassersensor1/0/get retain=0
    Info:GEN:CHANNEL_Set channel 0 has changed to 0 (flags 0)
    
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MQTT:Publishing val 4414 to Wassersensor1/voltage/get retain=0
    Info:MQTT:Publishing val 100 to Wassersensor1/battery/get retain=0
    Info:DRV:DRV_BATTERY : battery voltage : 4414.511718 and percentage 100.000000%
    Info:MAIN:Time 1492, idle 189835/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1493, idle 172355/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 2, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1494, idle 184820/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1495, idle 182586/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1496, idle 186945/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1497, idle 184404/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 
    Info:MQTT:Channel has changed! Publishing 0 to channel 0 
    Info:MQTT:Publishing val 0 to Wassersensor1/0/get retain=0
    Info:MAIN:Time 1498, idle 186186/s, free 76200, MQTT 1(1), bWifi 1, secondsWithNoPing 1, socks 2/38 


    Voltage reading of the battery is obviously wrong (4,4 Volt instead of 3,3V).

Topic summary

✨ The discussion centers on the Tuya WiFi Water Sensor DY-SQ400B equipped with a CR123A 3V battery and a CB3S communication board. Initial attempts to identify the device as a TuyaMCU-based module via UART communication failed, revealing no MCU communication on TX1 and unclear signals on TX2. Subsequent analysis confirmed the device uses a BK7231N chip rather than a TuyaMCU. Firmware backup and flashing were performed using the BK7231GUIFlashTool, enabling installation of OpenBeken (OBK) firmware. Configuration involved setting pin roles for sensor input, button, LED, buzzer (PWM on pin 7), and battery monitoring (BAT_Relay and BAT_ADC). The DoorSensor driver was adapted for water detection with deep sleep management to conserve battery life. Users developed autoexec.bat scripts to handle deep sleep wakeup on sensor trigger or button press, battery voltage reporting, and continuous alarm signaling during water detection. Issues addressed included configuring DSEdge to enable wakeup on both signal edges, managing MQTT message intervals, and separating button functions to avoid false alarms. The final working configuration includes scripted channel handlers to activate buzzer and LED alarms on water detection, with manual button wakeup without triggering alarms. The community also discussed firmware update procedures, file system management for autoexec.bat, and integration with home automation via MQTT. The thread concludes with a stable setup for reliable water leak detection, battery monitoring, and alarm signaling using OpenBeken firmware on the DY-SQ400B sensor.
Generated by the language model.

FAQ

TL;DR: A safe workflow starts with a 2MB backup and the CB3S/BK7231N pin map; as one maintainer put it, "Both flashing and TuyaMCU are using UART1." This FAQ is for DY-SQ400B owners who want OpenBeken deep sleep, MQTT, buzzer, and battery reporting without losing stock firmware first. [#21069433]

Why it matters: The DY-SQ400B can work well on OpenBeken, but deep-sleep wake behavior, DSEdge, battery scaling, and script order decide whether it becomes a reliable leak alarm or an unusable sensor.

Option Wake reliability from moisture Local buzzer/LED behavior Battery reporting
Stock Tuya firmware Worked reliably for affected users Native alarm behavior present Native cloud/app reporting
OpenBeken, basic template only Can fail or wake only on probe short Often incomplete until PWM/script tuning Wrong until Battery_Setup is tuned
OpenBeken, final tuned template + autoexec Reported working with deep sleep, buzzer, MQTT, and timed wake Works after PWM on pin 7 and script logic Works after DSTime and Battery_Setup tuning

Key insight: The DY-SQ400B is not a TuyaMCU device in this thread’s findings. The stable OpenBeken setup came from backup-based pin extraction, DSEdge tuning, a filesystem autoexec.bat, and a script that clears DSTime while channel 0 stays active.

Quick Facts

  • The device discussed uses a CB3S board with BK7231N, a CR123A 3V battery, and a stock firmware dump workflow centered on a 2MB flash backup before modification. [#21070110]
  • The extracted stock config mapped key pins as button P24, status LED P26, sensor P8, battery relay P14, battery ADC P23, and buzzer P7. [#21070110]
  • Early battery readings were badly wrong at about 4.4V to 4.8V, but later tuning with Battery_Setup produced realistic values around 3382–3403 mV and 73–75%. [#21086071]
  • A working timed wake example used DSTime 100 6000, where 100 is awake time and 6000 seconds is the auto-wake interval; later users confirmed timed wake works when DSTime is placed first in autoexec.bat. [#21089513]
  • Final shared working configs used pin 7 as PWM;5, pin 8 as DoorSnsrWSleep_nPup;0, pin 24 as Btn_ScriptOnly;1, and pin 26 as LED;5. [#21095640]

How do I flash a Tuya DY-SQ400B water leak sensor with a CB3S/BK7231N module to OpenBeken and make a safe 2MB firmware backup first?

Use the BK7231 GUI flash tool and read the flash before writing anything. 1. Open the case, connect UART1 on the CB3S, and power the board. 2. In the tool, use Read firmware to make a 2MB backup. 3. Only after that, use the write option to flash OpenBeken. The thread confirms the tool can do a backup first, and the maintainer explicitly pointed to the Read firmware button for a 2MB dump that can later extract device configuration. [#21070089]

What is DSEdge in OpenBeken, and how do I choose the right DSEdge setting for a DY-SQ400B water sensor that won’t wake reliably from deep sleep?

DSEdge is the deep-sleep wake edge selector, and you choose it by testing which transition wakes your specific sensor reliably. "DSEdge is a deep-sleep wake setting that selects which GPIO transition wakes the device, and its key characteristic is that different hardware reacts to different edges or both." In this thread, DSEdge 0 fixed one user’s device, while another later reported DSEdge 2 in a working setup. Start with 0, then test 1 and 2 with button fallback enabled. [#21075813]

What is autoexec.bat in OpenBeken, and where exactly do I create and edit it in the Web Application for the DY-SQ400B?

autoexec.bat is the startup script file that OpenBeken runs on boot, and you create it in the Web Application filesystem. "autoexec.bat is a startup script file that stores persistent commands, and its key characteristic is that OpenBeken executes it automatically after boot." 1. Open Launch Web Application. 2. Go to Filesystem → List Filesystem. 3. If autoexec.bat is missing, create it with Create File, then edit it in the file editor on the right. [#21339745]

Why does the DY-SQ400B sometimes wake only when the probes are shorted directly, but not when moisture is present on the contacts?

Because the wake circuit can react differently to a hard short than to a resistive moisture path. One 2026 user reported the sensor always woke when the probes were shorted, but not when moisture bridged them, even though stock Tuya firmware had worked correctly before flashing. That points to edge detection and wake-threshold behavior, not dead hardware. The practical fix in the thread was to test DSEdge values and confirm wake behavior with real moisture, not only metal shorting. [#21859503]

How do I configure the final working OpenBeken template for the Tuya DY-SQ400B, including PWM buzzer, DoorSnsrWSleep_nPup, battery ADC, and Btn_ScriptOnly?

Use the final shared template with pin 7 as PWM, pin 8 as DoorSnsrWSleep_nPup, pin 23 as BAT_ADC, and pin 24 as Btn_ScriptOnly. The last posted working JSON used: 7: PWM;5, 8: DoorSnsrWSleep_nPup;0, 14: BAT_Relay;1, 23: BAT_ADC;2, 24: Btn_ScriptOnly;1, 26: LED;5, plus command: DSEdge 0 and flags: 8. That template was shared after the buzzer, button, battery, and wake issues were resolved. [#21095640]

Why does the water leak alarm start immediately after boot on some OpenBeken configs, and which flags or script lines cause that behavior?

It starts immediately when the script forces the buzzer channel on at boot, not only on flood. In the thread, the culprit was setChannel 5 80 placed unconditionally near the top of autoexec.bat; that made the LED and buzzer activate right after boot. Another user also reported that turning Flag 42 off stopped immediate alarm behavior in a later setup. If you want alarm only on water, remove unconditional setChannel lines and trigger PWM from channel changes instead. [#21097688]

What is the difference between DoorSnsrWSleep, DoorSnsrWSleep_nPup, and the other DoorSensor variants in OpenBeken for battery-powered water sensors?

The variants mainly change input polarity and pull-up behavior, and that changes wake reliability. In this thread, plain DoorSnsrWSleep caused unstable behavior, while users reported that the other two door-sensor variants worked better for this water sensor, especially DoorSnsrWSleep_nPup. That variant became the final shared choice on pin 8. The practical rule here is simple: try the _nPup form first on the DY-SQ400B, then test other variants only if wake or state logic is inverted. [#21074406]

How can I stop the deep sleep countdown while a flood condition is active so the DY-SQ400B keeps alarming until the battery dies or the leak is cleared?

Loop on channel 0 and clear DSTime whenever the flood state stays active. The maintainer provided a tested approach: use an again: loop, delay_s 1, and if $CH0==1 then DSTime clear. A later working script added the buzzer with addChangeHandler Channel0 == 1 setChannel 5 80, so the siren starts when channel 0 goes high and the countdown keeps getting reset. That creates an effectively continuous alarm until power is exhausted or the leak clears. [#21095640]

What’s the right way to make the DY-SQ400B wake up automatically once a day to report battery values over MQTT while still using the DoorSensor driver?

Use the newer two-argument DSTime command in autoexec.bat, with the second value set to the auto-wake interval in seconds. The maintainer added this so DSTime 100 6000 means 100 seconds awake and 6000 seconds until forced wake. Users later confirmed the feature worked on hardware when placed correctly in the script. For once-daily reporting, use roughly 86400 seconds as the second argument and keep the DoorSensor-based flood wake on channel 0. [#21089513]

Why do DSTime commands only work when placed at the top of autoexec.bat on this Tuya water sensor?

Because the timed wake setting must be applied before later script logic and driver activity interfere with deep-sleep handling on this device. A user tested it directly and reported that timed wake worked only after moving DSTime to the first line of autoexec.bat. The same user said placing it at the end did not work. On this DY-SQ400B, treat DSTime as an early startup command, ahead of Battery_Setup, loops, and alarm handlers. [#21091186]

How should I tune Battery_Setup and Battery_cycle in OpenBeken so the DY-SQ400B reports a realistic CR123A battery voltage instead of 4.4V or 4.8V?

Tune Battery_Setup empirically against a multimeter and keep Battery_cycle moderate, such as 20 seconds while testing. Early untuned readings were about 4414–4823 mV, which was clearly wrong for a 3V CR123A device. Later working values included Battery_Setup 2900 3700 1.94 and Battery_cycle 20, producing readings around 3382–3403 mV and 73–75%. The shared thread conclusion was that battery reporting is usable only after calibration, not with extractor defaults alone. [#21095369]

How do I enable and tune the buzzer on pin 7 with PWM in OpenBeken, and what do setChannel and PWMFrequency actually do on this device?

Assign pin 7 to a PWM role, give it a PWM channel, and drive that channel from the script. The maintainer’s method was: set pin 7 to PWM, put it on a channel such as 5, enable raw PWM controls if needed, then test commands like PWMFrequency 1000 and setChannel 5 50. In this device, setChannel changed duty level and audibly drove the buzzer; one user preferred values around 78–99, describing the sound as a police siren. PWMFrequency had little audible effect on that buzzer. [#21077971]

Why does pressing the hardware button publish 100 to the MQTT state topic, and how does changing the pin role to Btn_ScriptOnly fix it?

Because the normal button role interacted with the LED driver and pushed channel 0 to dimmer-style values like 100. The logs showed button presses publishing led_enableAll, led_dimmer, and then 100 to the main MQTT state topic. The maintainer identified that as automatic button interaction and advised changing the role to Btn_ScriptOnly. After that change, the device still woke on button press, but it stopped publishing spurious 100 values to the water sensor state topic. [#21086332]

OpenBeken vs stock Tuya firmware on the DY-SQ400B: which one handles deep sleep wakeup and moisture detection more reliably?

Stock Tuya firmware handled moisture wake more reliably in the unresolved edge cases shown here. Multiple users got OpenBeken working well after tuning, but later reports still described devices that woke only on a hard short or failed to reconnect cleanly after moisture wake. One 2026 user stated the stock Smart Life firmware had worked properly, while the flashed unit did not reliably wake from deep sleep on wet probes. OpenBeken wins on MQTT, local scripting, and cloud-free control, but stock looked more robust by default. [#21859503]

What power options are safest for the DY-SQ400B besides a CR123A cell, and how do Li-ion, LiFePO4, or 2xNiMH compare for voltage compatibility?

The safest alternatives mentioned were LiFePO4 or 2xNiMH, not a bare 3.7V Li-ion cell. A user reported one device had worked for a while on direct Li-ion, then died, suggesting overvoltage damage. Another participant recommended LiFePO4 because its maximum is about 3.65V and said 2xNiMH in series simulates a CR123A reasonably well. In contrast, fresh 3-cell alkaline packs can exceed 4.6V, and even 3.7V Li-ion can be too high without regulation or a drop element. [#21417572]
Generated by the language model.
ADVERTISEMENT