logo elektroda
logo elektroda
X
logo elektroda

[BK7231N/CBU] Door sensor without TuyaMCU - how to connect to UART RX/TX

gramais 10896 61
ADVERTISEMENT
  • Helpful post
    #61 20826588
    atomphil
    Level 10  
    To align the magnet and device during installation, it can be helpful to assign pin 26 to the LED instead of WifiLED_n. This allows you to see immediately whether the magnet is triggering or not.

    Screenshot of a device configuration interface showing various pin assignments.

    You can set it back to WifiLED_n afterwards.

    btw. Is there a way to increase the sensitivity of the sensor or adjust the threshold value? Background: I have a window with two sashes and would like to attach the device to one and a stronger magnet to the other to monitor both. So far, I have achieved a detection distance of approx. 10cm, which is about 5cm short of a reliable detection.
  • ADVERTISEMENT
  • #62 21563591
    sevenissimo
    Level 2  
    Hi everyone,
    I'm new to OpenBeken and I need some help with my Beken BK7231N door sensor.
    It seems to be bricked and I'm at a loss on how to proceed.

    Here's the story:
    I flashed OpenBeken using the GUIFlashTool, performing a backup and extracting the Tuya config. The device then entered AP mode. I set up the network SSID, MQTT, and the module config (initially, the first one I found in a thread, which wasn't quite right). It connected to my Wi-Fi, and the door sensor worked, but it wouldn't enter deep sleep (the timer kept resetting at 60 seconds).

    After reading more of your forum, I tried new module configurations. The device then seemed to enter deep sleep, but I couldn't wake it up, especially not with the button, as it wasn't configured on the correct pin but on the wrong channel. Since it was in deep sleep, I couldn't access the web interface to correct the configuration.

    I attempted a soft reset with multiple consecutive power cycles. During some of these, the LED configured as Wifi_n would light up. Then, that stopped working too. After several attempts, the module now seems completely unresponsive, only emitting a buzzing sound when powered.

    Initially, I was using rechargeable NiMH batteries. Since it seemed to have died, I've switched to new alkaline batteries, which should provide the expected power.

    Today, I tried reconnecting it via serial. I can still read and write to the chip.

    First, I read, modified, and rewrote the configuration – first the correct one for the hall sensor and button, then all to None:0. But after rebooting, still no sign of life (no AP, no STA). I then tried to rewrite the firmware. Reboot, nothing. I even tried restoring the RF partition (which required a lower baud rate). Reboot, still nothing.

    It really feels like it's in a "sleep of death."
    I'm quite new to OpenBeken and have no idea how to fix this. Any suggestions would be greatly appreciated!

    [BK7231N/CBU] Door sensor without TuyaMCU - how to connect to UART RX/TX

Topic summary

The discussion focuses on connecting and flashing BK7231N-based Tuya door/window sensors without using TuyaMCU, specifically the CBU module variant. Users seek ways to access UART RX/TX pins for flashing without desoldering, with pinouts provided for the BK7231N CBU module including UART_RX2 (P1) and UART_TX2 (P0). Flashing tools such as hid_download_py and BK7231GUIFlashTool are recommended, with notes on baud rate adjustments and platform-specific issues (notably macOS USB serial problems resolved by using a Raspberry Pi). Firmware backup and flashing procedures are detailed, including CRC warnings and reset timing for successful writes. Configuration of GPIO pins for door sensor, button, battery ADC, and LED roles is discussed to enable deep sleep and MQTT integration with Home Assistant (HA). Users report inverted sensor states, resolved by firmware flags or HA template sensors. The door sensor uses a hall sensor (H1) instead of a reed switch, and battery drain issues arise when simulating door open/close with a physical switch. Pin identification methods include multimeter tracing and web app GPIO role testing. Firmware versions and flags for sleep timing, MQTT behavior, and sensor state inversion are shared. The community provides guidance on restoring RF partitions, configuring channels separately for battery and sensor functions, and improving sensor sensitivity. Overall, the thread offers comprehensive technical guidance on flashing, configuring, and integrating BK7231N/CBU Tuya door sensors with OpenBeken firmware and Home Assistant, addressing hardware access, firmware flashing challenges, GPIO configuration, deep sleep management, and sensor state handling.
Summary generated by the language model.
ADVERTISEMENT