logo elektroda
logo elektroda
X
logo elektroda

[CBU] Tuya Battery-Powered PIR Siren/Light Alarm: Disassembly, Components, and MM32G0 TuyaMCU - WIP

divadiow 399 2
ADVERTISEMENT
  • Helpful post
    #1 21206129
    divadiow
    Level 34  
    I thought I'd give this Tuya battery-powered PIR/alarm device a look. It was purchased from Ali Express at https://vi.aliexpress.com/item/1005007342948074.html

    Tuya Alarm with PIR detection and sound-light function.

    What's inside? What makes it tick? A familiar module or something new?

    PIR alarm device set with packaging and manual. Technical parameters of the Tuya PIR/alarm device. Disassembled battery-powered Tuya alarm device with exposed components. Circuit board with microprocessor and Wi-Fi module. Close-up of the interior of a device with electronic circuitry. Interior of the Tuya PIR/alarm device with visible electronic components. Interior of Tuya PIR/alarm device showing the circuit board and sensor. White PIR device casings on carpet PIR alarm installation guide with Tuya app. PIR sound and light alarm instruction manual.

    CBU.

    And a separate Mindmotion MM32G0 series 32-bit general-purpose microcontroller based on the Arm Cortex-M0 processor. Specifically, a TSSOP20 package MM32G0001A1T. Datasheet attached.

    Table of MM32G0 microcontroller specifications.

    Despite my best efforts I could not get my J-Link USB clone to connect when soldered to DIO and CLK test pads, which have continuity with pins 4 (PA14) and 18 (PA13).

    Pin diagram and PCB image featuring Mindmotion MM32G0 microcontroller.

    J-Link even has the 32G0001A1T in its list.

    SEGGER J-Flash interface with microcontroller settings.

    Not sure how or when it's programmed at the factory. Before CBU is present? PA14 can be NRST or SWCLK so not sure how to I can achieve a backup.

    Onto the CBU. A backup was taken using Easy Flasher. Surprisingly the MCU did not get in the way of backup.

    Before flashing OpenBeken I captured the UART log from TX2

    Code: Text
    Log in, to see the code


    and to see the behaviour and capture TuyaMCU data to and from the wifi module when paired with the Tuya app
    App screen showing PIR status: Human status with options Working, Record, Smart, and Set. Screen of the Tuya PIR/alarm device settings application. Phone screen displaying a motion alarm notification with device details. Device update screen showing no updates available for modules

    On power-up the wifi module sends all the preference data set in the app in one go to the MCU

    TuyaMCU Explorer/Analyzer window displaying captured data packets.

    Code: Text
    Log in, to see the code


    and when you change the preferences it will not apply them until the device next wakes. Eg, here's me changing the values of these settings with red exclamation marks against them

    Tuya app screen displaying PIR alarm settings.

    Screenshot of TuyaMCU Explorer Analyzer for OpenBeken, showing raw packet data and decoding from a WiFi module.

    so we already know dpID 103 is alarm volume and dpID104 is alarm duration.

    That's where I am for now. I'll carry on with the remaining dpIDs and flash OpenBeken then update this thread.
  • ADVERTISEMENT
  • Helpful post
    #2 21206242
    divadiow
    Level 34  
    Code: Text
    Log in, to see the code


    and here's a siren and LED demo when motion is detected. This is with the piezo unsoldered so barely audible.



  • #3 21207586
    divadiow
    Level 34  
    yikes. trying to get TuyaMCU battery devices to stay awake is a pain. I thought some of my autoexec experiments were having success keeping it in a loop/awake, but I think hammering the button confuses the MCU for a while.

    Code: Text
    Log in, to see the code
ADVERTISEMENT