logo elektroda
logo elektroda
X
logo elektroda

P06 Tuya PIR Motion Sensor Review: CBU Module, BK7231N, and MCU Insights

divadiow 3063 20
ADVERTISEMENT
  • Helpful post
    #1 21121587
    divadiow
    Level 38  
    Here I'll post my findings relating to the P06 Tuya PIR motion sensor. This device takes 2 AA batteries and 5v USB using a micro-USB connector.

    This item was purchased from https://www.aliexpress.com/item/1005004083257831.html from the NVWU store

    Screenshot of an AliExpress product page featuring the Tuya PIR motion sensor.

    Opening we see it comes with a CBU module. Unlike this P06 which comes with an XR3 (which is what I was hoping for). We also see it's accompanied by a Tuya MCU.

    View of the P06CBU-V1.3 motion sensor circuit board with the date 2022-12-22. Circuit board with P06 Tuya PIR electronic module. Circuit board of the P06 Tuya PIR device with markings and a micro-USB port. PCB from a Tuya PIR P06 motion sensor with connected wires.

    from TX2:

    Code: Text
    Log in, to see the code


    As expected the RX1/TX1 communication with the Tuya MCU gets in the way of dump/flash

    Screenshot of TuyaMCU Explorer/Analyzer software for OpenBeken.

    There is no continuity between RX/TX and any of the MCU legs but instead there is continuity to the small resistors beside the MCU. So, I severed the RX trace just where it leaves the CBU, after which the dump could be obtained, attached. Being Tuya MCU, there's no pin extraction

    Screenshot from Tuya Config Quick Viewer showing GPIO configuration in JSON format.

    firmware version 2.1.0 so no good for cloudcutter.

    Flashed with OBK and then soldered a little pb bridge over the cut RX.

    And that's as far as I can go tonight.
    Attachments:
    • readResult_BK7231N_QIO_2024-16-6-21-09-48.bin (2 MB) You must be logged in to download this attachment.
  • ADVERTISEMENT
  • #2 21121692
    p.kaczmarek2
    Moderator Smart Home
    So it can work with both batteries and USB? But it's battery-powered flavour of TuyaMCU, so it always sleeps anyway? How is the connection handled? Do batteries discharge when 5V USB is connected?
    Helpful post? Buy me a coffee.
  • #3 21121759
    divadiow
    Level 38  
    good questions. The manual isn't much help

    User manual for PIR motion sensor WiFi model P06 lying on a carpet. Leaflet with setup instructions for the Smart Life app with a QR code.
    Device setup instruction showing app screenshots for connecting to a Wi-Fi router. Motion sensor instruction manual with list of features and Wi-Fi setup.

    apart from this perhaps

    A section of user instructions describing how to connect a device via Micro USB port.

    I should probably flash back to factory to see what default behaviour is. You'd think there'd be safeguards in place to stop damage if both battery and USB were live, right?!
  • Helpful post
    #4 21121843
    p.kaczmarek2
    Moderator Smart Home
    Those safeguards would be in hardware, not software, so there is no need to flash. It depends on the connection circuit. The simplest (but no so efficient) way would be to use some dodes.
    Helpful post? Buy me a coffee.
  • #5 21122644
    divadiow
    Level 38  
    curious, the only dpID appears to be
    Code: Text
    Log in, to see the code
  • #6 21122804
    p.kaczmarek2
    Moderator Smart Home
    so what kind of values does this enum have?
    Helpful post? Buy me a coffee.
  • #7 21122815
    divadiow
    Level 38  
    actually dpID 3 too

    Code: JSON
    Log in, to see the code
  • ADVERTISEMENT
  • #8 21122839
    p.kaczmarek2
    Moderator Smart Home
    Battery enum is nothing new.
    So, pir state is an enum but has only two values possible?
    Helpful post? Buy me a coffee.
  • #9 21122850
    divadiow
    Level 38  
    seems so.

    result of tuyaMcu_sendQueryState

    Code: JSON
    Log in, to see the code


    Added after 34 [minutes]:

    button and key pad trace to MCU leg

    P06 Tuya PIR Motion Sensor Review: CBU Module, BK7231N, and MCU Insights

    Added after 6 [minutes]:

    BS612 PIR sensor seen on 3 other devices. https://www.elektroda.com/rtvforum/find.php?q=bs612

    https://www.adafruit.com/product/5578
    Code: Text
    Log in, to see the code
    Attachments:
    • C17724.pdf (1.31 MB) You must be logged in to download this attachment.
  • #10 21122974
    divadiow
    Level 38  
    Code: Text
    Log in, to see the code


    im still fiddling.

    autoexec

    Code: Text
    Log in, to see the code
  • #11 21122988
    p.kaczmarek2
    Moderator Smart Home
    I think that you need a tmSensor driver as well, as it is a TuyaMCU low power protocol. Not the classic TuyaMCU
    Helpful post? Buy me a coffee.
  • #12 21122998
    divadiow
    Level 38  
    ah! genius.

    Code: Text
    Log in, to see the code


    Screenshot displaying information about OpenBK7231N and channel status.

    I did try ReadOnlyLowMidHigh on setChannelType 3 ReadOnly but that didn't reveal anything in the GUI.

    Also, if there are only two dpIDs, I can't do anything with the LED or Btn? that's it, PIR and a rubbish battery indicator?
  • #13 21123016
    p.kaczmarek2
    Moderator Smart Home
    Are LED and Btn connected to MCU or to WiFI module?
    Helpful post? Buy me a coffee.
  • ADVERTISEMENT
  • #14 21123029
    divadiow
    Level 38  
    I can't seem to trace from resistor I am getting continuity from on one side. It's all right next to the MCU. I don't have continuity from CBU to any components. Button is as above to MCU.

    and no sign of pin assignments in binary

    Code: JSON
    Log in, to see the code


    posting this for ref too

    Screenshot of TuyaMCU Explorer/Analyzer program on the Elektrodka platform displaying WiFi data packets.
  • ADVERTISEMENT
  • #15 21123063
    p.kaczmarek2
    Moderator Smart Home
    Well, I am almost certain that the button at least must be connected to MCU. You can press it and MCU may send then a special packet to WiFI module, which is used for pairing.

    The same probably goes for the LED>...
    Helpful post? Buy me a coffee.
  • #16 21123104
    divadiow
    Level 38  
    yes. I expected that too but that was not the experience. button pushes didn't seem to produce any MCU packets.

    I've gone back to factory and hooked up a second USB-TTL so I can properly see what factory is doing. Also, believe it or not, I've not really done much with TuyaMCU Analyser, so good practice,

    Electronic setup on a wooden desk with connected USB-TTL devices on a test board.

    COM10 = USBTTL_RX - RX test pad on PIR device
    COM22 = USBTTL_RX - TX test pad on PIR device

    boot log:

    Screenshot of TuyaMCU Explorer/Analyzer tool with Wi-Fi data packets.

    Added after 2 [minutes]:

    and a bit of Tuya app info too while I'm here

    Screenshot of a mobile app showing a detected motion sensor. App settings screen with motion detection and low battery alarms enabled. Device update screen showing no updates available. Motion sensor app screen indicating Motion detected.

    Added after 24 [minutes]:

    change from motion detected to no motion detected status:

    Screenshot of TuyaMCU Explorer showing decoded packets incoming and outgoing from the WiFi module. Tuya app screen on a smartphone displaying No motion detected.

    and reverse:

    Screenshot of TuyaMCU Explorer tool showing packet data.

    Added after 3 [minutes]:

    unpairing/wipe data and reboot from Tuya app. LED fast flash;

    Screenshot of TuyaMCU Explorer/Analyzer program with communication between Wi-Fi module and MCU.

    Added after 7 [minutes]:

    motion detected = dpId=1 Enum V=0
    no motion = dpId=1 Enum V=1

    Added after 3 [minutes]:

    odd. button short, long or very long presses produce nothing. not even a ringbuffer count change. It also doesn't reset/unpair the device to default.

    Added after 1 [hours] 18 [minutes]:

    CEN has a trace but the path is missing a component so ultimately doesn't have continuity to the MCU leg highlighted

    Two images of circuit boards from an electronic device, showing test points.
  • Helpful post
    #17 21125392
    p.kaczmarek2
    Moderator Smart Home
    Thank you for sharing. This is very strange that the RESET button does not seem to work.

    The CEN trace without component, on the other hand, seems normal. They don't need CEN. They just cut the power to the whole module.
    Helpful post? Buy me a coffee.
  • #18 21125436
    divadiow
    Level 38  
    yes. and there's continuity still from both sides of the button through to the MCU leg. the far side beeps fine when the button is pushed.

    nothing new in log out when button is pushed.

    Added after 18 [minutes]:

    divadiow wrote:
    I did try ReadOnlyLowMidHigh on setChannelType 3 ReadOnly but that didn't reveal anything in the GUI


    is ReadOnlyLowMidHigh not correct for this?

    Added after 10 [minutes]:

    OK so with the autoexec above (tmsensor now added) we get this on USB power

    Screenshot of the OpenBK interface showing PIR sensor and battery level information.

    when no motion PIR = 1 and this is changed when the MCU sends this:

    Code: Text
    Log in, to see the code


    motion detected PIR = 0 - MCU sends this

    Code: Text
    Log in, to see the code


    Added after 4 [minutes]:

    after 30s of the sensor being covered after motion, it will go back to no motion detected. The MCU flashes the red LED once when motion is detected and again when asserting no motion state
  • Helpful post
    #19 21125502
    p.kaczmarek2
    Moderator Smart Home
    I can indeed see that this channel type is missing http display. Can you check this commit, after it builds?
    https://github.com/openshwprojects/OpenBK7231...mmit/a70bd96ee1275ec3b65572c56166b8d532404f8a
    Helpful post? Buy me a coffee.
  • Helpful post
    #20 21125503
    divadiow
    Level 38  
    -on 5v USB the device stays online all the time
    -on battery the MCU deep sleeps until a motion event then sleeps - then 30s later a no-motion event. For each event it boots and stays awake long enough for OBK to load for a few seconds
    -with batteries inserted and USB powered it will stay awake, presumably using USB as power source
    -if USB removed with batteries inserted the batteries do not take over. The device has to have all power removed and a power source added again

    at 3.0v (according to my PSU) battery level = 2
    at 2.9v (according to my PSU) battery level = 2
    at 2.8v (according to my PSU) battery level = 1
    at 2.7v (according to my PSU) battery level = 1
    at 2.6v (according to my PSU) battery level = 1
    at 2.5v (according to my PSU) battery level = 1
    at 2.4v (according to my PSU) battery level = 1
    at 2.3v (according to my PSU) battery level = 0
    at 2.2v (according to my PSU) battery level = 0

    Added after 14 [minutes]:

    p.kaczmarek2 wrote:
    Can you check this commit, after it builds?

    Screen displaying information about the device OpenBK_BK7231N_CBU_PIR_P06, including PIR channel status and battery level.

    :D

    Added after 2 [minutes]:

    does this mean there could be ReadOnlyMotion for 0 + 1 byte translation to plain-text status? What was the case for doing ReadOnlyLowMidHigh for battery and not other RO enum values?

    Added after 7 [hours] 2 [minutes]:

    WiFi PIR motion sensor with packaging and accessories

    https://github.com/OpenBekenIOT/webapp/pull/127
  • #21 21125800
    p.kaczmarek2
    Moderator Smart Home
    How does it know it's connected to 5V?

    ReadOnlyLowMidHigh was added because we had a LowMidHigh type for kitchen fans, which was both read and write enabled. It was showing a radio buttons on http panel and user was able to choose the level himself just by clicking.
    Motion, on the other hand, it's always just a read-only type, so there is no need to special "read only" version in this case.
    Helpful post? Buy me a coffee.

Topic summary

✨ The discussion revolves around the P06 Tuya PIR motion sensor, which operates on both 2 AA batteries and 5V USB power via a micro-USB connector. Users explore the internal components, including the CBU module and Tuya MCU, and discuss the device's behavior when powered by USB versus batteries. Key points include the device's deep sleep mode on battery power, the interaction between battery and USB power sources, and the functionality of the PIR sensor and battery state enums. Users also analyze the connection circuit and the potential need for hardware safeguards to prevent damage when both power sources are connected. The conversation highlights the importance of the TuyaMCU driver for proper operation and the challenges faced in tracing connections for buttons and LEDs.
Generated by the language model.

FAQ

TL;DR: P06 does a 30 s cooldown to "no motion," and "on 5V USB the device stays online all the time." Battery mode deep-sleeps, only PIR and battery states are exposed, and USB removal doesn’t auto‑switch to AA without a power cycle. [Elektroda, divadiow, post #21125503]

Why it matters: This FAQ helps tinkerers, integrators, and OBK users quickly decide how to power, flash, and map dpIDs on the P06 Tuya PIR.

Quick Facts

What chipset/module is inside the P06 Tuya PIR?

The opened unit shows a CBU module housing a BK7231N Wi‑Fi SoC, paired with a Tuya MCU. The enclosure provides both a 2×AA battery bay and a micro‑USB 5V input. This specific P06 differs from another variant that used XR3; this sample is clearly the CBU/BK7231N version. [Elektroda, divadiow, post #21121587]

Can I power it from both AA batteries and USB, and what actually happens?

Yes. With 5V USB connected, the device stays online continuously. On batteries, it deep‑sleeps and only wakes on motion, then reports no‑motion about 30 seconds later. With both sources present it appears to run from USB. Removing USB does not automatically fall back to AA; a full power cycle is required. This is a notable edge case to plan around. [Elektroda, divadiow, post #21125503]

Does USB power drain the AA batteries while connected?

Testing showed the unit stays awake on USB and did not automatically switch to battery when USB was removed. It required removing all power and then re‑applying a source to resume. Those observations indicate the device prefers USB when present rather than drawing from AA simultaneously. No charging of AA cells is implied. [Elektroda, divadiow, post #21125503]

How long after motion does it report “no motion,” and what does the LED do?

After motion, it asserts no‑motion in about 30 seconds. The red LED blinks once when motion is detected and once again when no‑motion is asserted. This timing helps when tuning automations or validating sensor placement during setup. [Elektroda, divadiow, post #21125436]

Which TuyaMCU dpIDs are exposed on this P06?

Two read‑only dpIDs were observed: dpID 1 for pir_state with enum values {pir, none}, and dpID 3 for battery_state with enum values {low, middle, high}. No writable dpIDs were found. This limits control to monitoring PIR and basic battery state. [Elektroda, divadiow, post #21122815]

How is dpID 1 (PIR) encoded—what do the values mean?

dpID 1 is an enum with two states. It reports 0 for motion detected and 1 for no motion. This mapping matches serial captures during state transitions and simplifies direct rule mapping in OpenBeken or other hubs. [Elektroda, divadiow, post #21123104]

What does dpID 3 (battery state) report, and is there a voltage cue?

dpID 3 is an enum: low=0, middle=1, high=2. Observed mapping showed 3.0 V returned 2 (high), 2.8–2.6 V returned 1 (middle), and 2.3–2.2 V returned 0 (low). That quick mapping aids threshold planning for battery alerts. [Elektroda, divadiow, post #21125503]

What UART speed and drivers should I use with OpenBeken?

Set TuyaMCU to 9600 baud and enable the tmSensor driver for Tuya’s low‑power protocol. A minimal autoexec uses: startDriver TuyaMCU; startDriver tmsensor; tuyaMcu_setBaudRate 9600; link dpIDs to channels; and set defWiFiState 4. How‑To: Basic OBK config
  1. startDriver TuyaMCU; startDriver tmsensor.
  2. tuyaMcu_setBaudRate 9600; tuyaMcu_defWiFiState 4.
  3. linkTuyaMCUOutputToChannel for dpID 1 and 3, then label channels. [Elektroda, divadiow, post #21122974]

How do I flash OpenBeken if the Tuya MCU occupies RX/TX?

Temporarily isolate the Wi‑Fi module’s RX from the MCU. The simplest field method was cutting the RX trace near the CBU, flashing OBK, then restoring the trace with a small solder bridge. This avoids MCU chatter during dump/flash and restores UART after. How‑To: Trace‑cut flash
  1. Sever CBU RX trace to isolate.
  2. Flash OBK via UART.
  3. Re‑bridge RX with solder. [Elektroda, divadiow, post #21121587]

Is this firmware compatible with Cloudcutter?

No. The captured factory firmware was version 2.1.0, which was reported as not compatible with Cloudcutter for this device. Use the manual UART method described instead if you need local firmware. [Elektroda, divadiow, post #21121587]

My reset/pair button does nothing over serial—how do I reset or unpair?

On this unit, button presses produced no TuyaMCU packets and did not reset the device. Unpairing and wipe were instead triggered from the Tuya app, which caused an LED fast flash and reboot. Use the app for pairing management on this variant. [Elektroda, divadiow, post #21123104]

Can I control the LED or button via dpIDs on this P06?

No. Only dpIDs 1 (PIR) and 3 (battery) were found, both read‑only. There are no dpIDs that expose LED control or button actions on this sample. That functionality appears handled internally by the Tuya MCU. [Elektroda, divadiow, post #21122815]

Which PIR sensor IC does this board use?

The board uses a BS612 PIR sensor element. This IC also appears in several other devices, making integration behavior familiar to makers and testers. The pinout and timing are typical for BS612‑based modules. [Elektroda, divadiow, post #21122850]

How do I sniff TuyaMCU traffic for analysis?

Connect a USB‑TTL RX to the device TX test pad at 9600 baud. For full‑duplex observation, use two USB‑TTL adapters—one on each test pad—to monitor bidirectional traffic from MCU and Wi‑Fi during events and app actions. [Elektroda, divadiow, post #21123104]

Does OpenBeken show Low/Mid/High battery states in the web UI?

Yes. An update added proper display for Low/Mid/High enums, confirmed with screenshots on this device. After configuring channels, the web panel presents the battery state clearly for quick diagnostics and automation mapping. [Elektroda, divadiow, post #21125503]

Is the CEN pin used to manage the Wi‑Fi module on this board?

A CEN trace exists but lacks the needed component, so it isn’t used. Instead, the design cuts power to the whole module when required. "They don't need CEN. They just cut the power to the whole module." [Elektroda, p.kaczmarek2, post #21125392]

Are dual‑power protections handled in software or hardware?

They are hardware‑side. As one expert notes, “Those safeguards would be in hardware, not software.” Expect simple diode‑OR or similar approaches for source selection, independent of firmware changes. This aligns with the observed behavior. [Elektroda, p.kaczmarek2, post #21121843]
Generated by the language model.
ADVERTISEMENT