[BK7231N - CBU] Tuya Night Light with WiFi: Pin Configuration, PWM, dInput, ADC, PIR Sensitivity
Tuya night light with WIFI
Source: https://de.aliexpress.com/item/1005004997029225.html
The night light is made by Tuya-module CBU.
All needed pin are accessable. You can flash it without dismount the module
Pin definition for the module as cbu.txt
These pins are used:
P26 - PWM1 - red
P24 - PWM2 - green
P6 - PWM3 - blue
P8 - PWM4 - cool white
P7 - PWM5 - warmwhite
P14 - dInput - PIR-signal
P20 - dInput_n - button
P23 - ADC - brightness (0 = bright; 4096 = dark)
P9 - PWM - sensitivity of PIR, 0-max, 255-min
I do not use HA but IP-Symcon. That is why I can not say something to HA-integration.
Some inner pictures:
I use the device as a simple status signal. In my case for the count of open windows in the case of exit the apartment.
pins explained:
P26; P24; P6; P8; P7
standard PWM output for R,G,B,CW,WW
P20
buttom at the right side of the device
negated
P23
analog brightness signal
0 - sun light
200-400 approx. room light in the evening
4096 - no lights
P14
PIR signal with approx. 5sec switch-off delay
P9
output corresponds with pin SENS of the PIR-module BS-612
there is a small capacitor between signal and ground (no value known).
0 Volt - highest sensitivity
3 Volt - low sensitivity
I do not know if you can output this as PWM or you have to set it as a standard digital output.
Other signal pin were not found.

Source: https://de.aliexpress.com/item/1005004997029225.html
The night light is made by Tuya-module CBU.
All needed pin are accessable. You can flash it without dismount the module


Pin definition for the module as cbu.txt
These pins are used:
P26 - PWM1 - red
P24 - PWM2 - green
P6 - PWM3 - blue
P8 - PWM4 - cool white
P7 - PWM5 - warmwhite
P14 - dInput - PIR-signal
P20 - dInput_n - button
P23 - ADC - brightness (0 = bright; 4096 = dark)
P9 - PWM - sensitivity of PIR, 0-max, 255-min
I do not use HA but IP-Symcon. That is why I can not say something to HA-integration.
Some inner pictures:



I use the device as a simple status signal. In my case for the count of open windows in the case of exit the apartment.
pins explained:
P26; P24; P6; P8; P7
standard PWM output for R,G,B,CW,WW
P20
buttom at the right side of the device
negated
P23
analog brightness signal
0 - sun light
200-400 approx. room light in the evening
4096 - no lights
P14
PIR signal with approx. 5sec switch-off delay
P9
output corresponds with pin SENS of the PIR-module BS-612
there is a small capacitor between signal and ground (no value known).
0 Volt - highest sensitivity
3 Volt - low sensitivity
I do not know if you can output this as PWM or you have to set it as a standard digital output.
Other signal pin were not found.
Comments
Thank you for a very detailed review. I wasn't aware about the PIR setting. Can you provide us two more things for analysis? First, a Tuya Config partition file, extracted like on the tutorial: https://www.youtube.com/watch?v=WunlqIMAdgw&ab_channel=Elektrodacom And... [Read more]
Hi, now, I have made some changes. - translated to english - added some more necessary files - PWM-pins changed from 0-4 to 1-5 - pins explained - Tuya-config added here are only the PWMs... [Read more]
The Pin9 is present in the JSON, it was just not converted to text (not listed on human-readable interpretation) "pirin_pin":"14", "pirsense_pin":"9", ... [Read more]
Hi, thank you for your answer. Pin 9 is found - Ok. But can you give me the information, how "tuya" this pin uses. PWM or 0/1 ? Andreas [Read more]
I have no idea how is this pin used. This is totally new to me. As I said, your device is a new thing for me and I will later improve my flasher to extract GPIO specified in your Tuya partition. You... [Read more]
https://github.com/OpenBekenIOT/webapp/commit/475cfcdfbcdd7e214667e612cbc7ab977c7db97a [Read more]