logo elektroda
logo elektroda
X
logo elektroda

Using CH341A Programmer for BK7231N/CB3S Door/Window Sensor PB-69W VER 1.3: UART & OpenBK7231N_QIO

nihildiximus 5958 40
Best answers

Why does my BK7231N/CB3S door sensor only wake from deep sleep when it was asleep with the reed open, and how do I make wake-up work in the closed state too?

Set the wake-up edge to match the sensor’s idle level before sleep: the working fix was `DSEdge 1` for the low-level wake-up case, and another user later confirmed that this solved the same problem for them [#20542881][#20826289] For the original reed-switch wiring, the working combination was `DoorSnsrWSleep_nPup` with a forced edge of `0`; for a direct GPIO-to-GND test setup, `DoorSnsrWSleep` with a forced edge of `1` was needed [#20542881] The issue was that the sensor must wake on the same state it will be in after deep sleep, otherwise opening/closing the reed does not generate the expected wake event [#20542881] If you need to set multiple startup commands, use Tasmota-style `backlog ...; ...;` syntax rather than separating commands with plain semicolons [#20543214]
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
  • ADVERTISEMENT
  • #32 20546793
    Adi13089
    Level 11  
    I am using the OpenBK7231N_QIO_1.15.699.bin software and I do not have the Configure IP option in the WEB GUI
  • #33 20546801
    nihildiximus
    Level 9  
    You need a newer FW for this sensor. Go to "Launch web application" → "OTA" → "Select remote OTA file to download to PC", rip the latest 1.17.10.rbl and load it to your device (Drop OTA here). Then there will be an option with IP and other things needed for this sensor to work as it should.
  • ADVERTISEMENT
  • #34 20546804
    p.kaczmarek2
    Moderator Smart Home
    You need to update the firmware. In addition, from the description of your problem, I'm beginning to suspect that you may have performed an operation in the flasher Clear all , i.e. you have removed the entire Flash memory, as a result of which the MAC address has changed to the default one, ending with 0x00 characters. Now if you have another same device, you will have two devices with the same MAC, which will result in problems connecting them.

    The normal OpenBeken upload operation does not clear the entire memory, only its beginning, and leaves the MAC sections unchanged.

    If your MAC address ends in 0x00, there are two solutions:
    1. via UART, in our flasher, do Restore RF partition: https://github.com/openshwprojects/BK7231GUIFlashTool
    2. In our Web Application, in the Flash Memory tab, press the Restore RF partition button

    The Restore RF Partition operation will assign a new random MAC address to your device and solve WiFi connection issues.

    Added after 1 [minutes]:

    Btw: we already have a lot of answers in the FAQ:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/faq.md
    Using CH341A Programmer for BK7231N/CB3S Door/Window Sensor PB-69W VER 1.3: UART & OpenBK7231N_QIO
    And here:
    https://github.com/openshwprojects/OpenBK7231T_App/blob/main/docs/README.md
    Helpful post? Buy me a coffee.
  • #35 20546834
    Adi13089
    Level 11  
    Unfortunately, I cannot enter the WebApp in SAFE MODE. Using CH341A Programmer for BK7231N/CB3S Door/Window Sensor PB-69W VER 1.3: UART & OpenBK7231N_QIO
  • ADVERTISEMENT
  • Helpful post
    #36 20546859
    p.kaczmarek2
    Moderator Smart Home
    You have indeed removed the RF partition, as evidenced by the device name ending in zeros. This name comes by default from the MAC, which also ends with zeros, which means that during flashing you had to overwrite the RF section or perform Clear All (the entire 2MB flash).

    There should be a big "Exit safe mode" button in the main menu, but the Web App downloads from the web, so it may not open for you. I have separate wifi and separate internet connected by cable, so it works for me. Try the Web App anyway.

    If it doesn't go, disconnect the device with the same MAC from the router (I guess it is, because this problem has already appeared on the forum), or fix the RF partition on that device, and then fix it on the other one, it was written in like previous post.

    As a last resort, you can also simply repair the RF partition via UART.

    Now I see it's finally there the restore RF partition option would be very useful in the firmware itself (not WebApp), but at the moment it is not there, we did not expect such problems with it. I think I will modify the firmware so that from the next versions, as soon as it detects a clean MAC, it will fix it itself ...
    Helpful post? Buy me a coffee.
  • #37 20546986
    Adi13089
    Level 11  
    Fixed IP: 192.168.2.44, 255.255.255.0, 8.8.8.8, 192.168.2.1
    2.4GHz WiFi network
    Unfortunately, there is still no IP and no access to the device, DHCP does not assign an address for this device, and somehow setting the IP to a fixed one also does not change anything Using CH341A Programmer for BK7231N/CB3S Door/Window Sensor PB-69W VER 1.3: UART & OpenBK7231N_QIO Using CH341A Programmer for BK7231N/CB3S Door/Window Sensor PB-69W VER 1.3: UART & OpenBK7231N_QIO
  • #38 20547103
    p.kaczmarek2
    Moderator Smart Home
    Do you have any other devices with OBK?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #39 20547119
    Adi13089
    Level 11  
    Yes of course :)
    Techliner power strip :)
  • #40 20547160
    p.kaczmarek2
    Moderator Smart Home
    And what does her MAC address look like?

    The situation becomes very mysterious. To sum up - you wiped 2MB flash, lost the RF partition, then restored it, and the device still won't connect to your WiFi?

    On which BK are your devices, on which is the strip, and on which door sensor?

    I have two dev boards with BK7231T and BK7231N, just to be sure, I will clean their flash at home and check if they connect ....
    Using CH341A Programmer for BK7231N/CB3S Door/Window Sensor PB-69W VER 1.3: UART & OpenBK7231N_QIO
    Helpful post? Buy me a coffee.
  • #41 20826289
    Jerome_H
    Level 1  

    Hello,

    To begin with, a huge thanks for all the work to release OBK. It's a genius idea.

    After 3 days of research, I solved my problem :)

    The issue was that wakeup did not work after a deepsleep in LOW level.
    I just fixed it by adding the rapid text command: DSEdge 1

    Thanks everybody.
    Have a nice day.

Topic summary

✨ The discussion revolves around using the CH341A programmer to interface with the BK7231N/CB3S door/window sensor (PB-69W VER 1.3) and the OpenBK7231N_QIO firmware. Users report issues with the sensor not waking up from deep sleep when the reed switch is closed, despite various firmware updates and configurations. Solutions proposed include adjusting GPIO settings, using different firmware versions, and implementing specific commands like "DSEdge" to manage wake-up behavior. The conversation highlights the importance of correctly configuring pull-up and pull-down resistors and the need for firmware modifications to ensure proper functionality. Users also discuss the challenges of MQTT connectivity and the timing of state changes after waking from sleep.

FAQ

TL;DR: Users cut MQTT round-trip from 60 s to 6 s by flashing OpenBeken 1.17.10 and issuing “DSEdge 1; DSTime 15” [Elektroda, nihildiximus, post #20546258] “Set the correct wake edge and everything works” —-p.kaczmarek2 [Elektroda, 20543157]

Why it matters: Correct edge, timing and IP settings turn a useless door sensor into a reliable, battery-friendly alarm node.

Quick Facts

• Default deep-sleep delay: 60 s; adjustable 1-600 s via DSTime [Elektroda, p.kaczmarek2, post #20543157] • Wake-to-MQTT time: 6 s static IP vs 9 s DHCP [Elektroda, nihildiximus, post #20546258] • Edge command values: 0 = rising, 1 = falling (forced), 2 = auto [Elektroda, p.kaczmarek2, post #20543214] • Safe-mode entry: 5 rapid power cycles or 20 s button hold [Elektroda, p.kaczmarek2, post #20546462] • RF-partition loss shows MAC ending in 00; fix via “Restore RF partition” in WebApp or UART tool [Elektroda, p.kaczmarek2, post #20546804]

What hardware and software do I need to read or flash the PB-69W (BK7231N/CB3S) sensor?

Use a CH341A USB programmer. Short CEN to GND momentarily, then read or write flash with uartprogram + hid_download_py; BK7231GUIFlashTool under mono errors out [Elektroda, nihildiximus, post #20534749]

Why does BK7231GUIFlashTool under Linux fail with “serial.BytesToRead 4095” and how do I bypass it?

The mono build mismanages UART buffers on Linux. Swap to uartprogram and hid_download_py; they read the entire 2 MB flash without the buffer overflow [Elektroda, nihildiximus, post #20534749]

Which GPIO pins control the button, LED and reed switch on PB-69W v1.3?

• GPIO 26 → housing button (Btn1). • GPIO 9 → blue LED. • GPIO 7 → reed switch input [Elektroda, nihildiximus, post #20534749]

The sensor only wakes if it slept with the reed open. How do I fix that?

Flash ≥1.17.10, then issue DSEdge 1 to force falling-edge wake or DSEdge 0 for rising. Add DSTime to shorten standby. Problem disappears after setting the correct edge [Elektroda, Jerome_H, post #20826289]

What exactly do DSEdge and DSTime do?

DSEdge selects which edge (0 rising, 1 falling, 2 auto) triggers wake from deep sleep. DSTime sets how many seconds the MCU stays awake before re-entering deep sleep (1-600 s) [Elektroda, p.kaczmarek2, post #20543214]

Why does my startup line “DSEdge 0; DSTime 15;” not change DSTime?

The console requires Tasmota-style backlog. Write “backlog DSEdge 0; DSTime 15;” or place commands in autoexec.bat; otherwise only the first instruction runs [Elektroda, p.kaczmarek2, post #20546271]

Flashing erased my MAC and the device stays in safe mode. What now?

You overwrote the RF partition. Open WebApp → Flash Memory → Restore RF partition, or run “Restore RF” in BK7231GUIFlashTool over UART. A new random MAC restores Wi-Fi and DHCP [Elektroda, p.kaczmarek2, post #20546804]

How do I enter safe mode if the web UI is unreachable?

  1. Remove power.
  2. Apply power five times quickly (<8 s total).
  3. Device boots in safe mode AP, SSID ends with “_SAFE” [Elektroda, p.kaczmarek2, post #20543214]

Can I restore functionality without rewiring the reed switch?

Yes. Keep original wiring, set role DoorSnsrWSleep_nPup and DSEdge 0. This wakes on both closed-sleep and open-sleep states [Elektroda, nihildiximus, post #20542881]

What firmware version should I use and how do I upgrade OTA?

Use ≥1.17.10.rbl for full DSEdge/DSTime/UI features. WebApp → OTA → “Select remote OTA file”, choose the newest .rbl, then drag-drop onto “Drop OTA here” [Elektroda, nihildiximus, post #20546801]

How do I configure battery reporting?

Add to autoexec.bat:
  1. Battery_Setup 2000 3000 1.885 2400 4096
  2. Battery_cycle 2 These lines calibrate 2.0–3.0 V cells and push MQTT every two cycles [Elektroda, DeDaMrAz, post #20546308]

Is there a quick 3-step setup for a fresh sensor?

  1. Flash OpenBeken 1.17.10 via CH341A.
  2. In WebApp: assign static IP, map pins (26 Button, 9 LED, 7 DoorSnsrWSleep), backlog DSEdge 1; DSTime 15.
  3. Reboot; pair Wi-Fi; add MQTT credentials. Sensor now wakes and reports in ~6 s [Elektroda, compiled].

What edge-case still breaks wake-up?

If DSTime is set too low, the sensor may re-enter sleep before Wi-Fi handshake, dropping the MQTT message. Keep DSTime ≥5 s unless static IP and strong signal are confirmed [Elektroda, p.kaczmarek2, post #20546462]
ADVERTISEMENT