logo elektroda
logo elektroda
X
logo elektroda

[BK7231N / CB3S] AliExpress Generic PIR Sensor HW4008-W: Setup, Template, Features & Details

ThatGuyinOz  Cool? (+2)
Purchased:from this link:
https://www.aliexpress.com/item/4000785415902...der_detail.order_detail_item.3.28fcf19cv5xMHt
Cost:
~$AUD16






(USB TTL converter to show scale)


Inputs:
1 x hidden switch marked "reset"
Power:
External micro USB connector
Internal 2 x AAA batteries

Template:

Code: JSON
Log in, to see the code


The board has a model number HW4008-W printed on it
The "reset" switch is actually just attached to P7, it is not a hardware reset.
Both inputs activate on pull to Gnd.

Flashing:
I used the BK7231Flasher Easy UART flasher after soldering RX/TX/3.3/Gnd wires.
I used an external PSU for 3.3v ( node MCU board powered from PC USB)
I had to set the UART speed to 115200 to avoid transfer failures

Flags :
I set Flag 10 - [MQTT] Broadcast self state on MQTT connect = On
I set Flag 37 - [WiFi] Quick connect to WiFi on reboot (TODO: check if it works for you and report on github) = On

Other Settings:
I have set both inputs to be "Door Sensor With Sleep" (DoorSnsrWSleep, with pullup)
I set startup value for 1 = 50. this makes the led illuminate dimly to show motion detection, with a small power saving.
I set startup value for 2 = 1. This seemed to be required to help door sensor driver.
After testing I set Startup Command text to "DSTime 10" to force shutdown for power saving reasons. (default is 60 sec)

Operation:
At motion detection I see first MQTT packet after 5-6 sec. unit goes to sleep about 5 sec later.

I would like to set a static IP address and see if that makes the initial connection faster but i cannot find the Command or setting anywhere.
[edit] I found the very obvious button on the main Config page... I'll update if it makes the first MQTT packet faster shortly.

About Author
ThatGuyinOz wrote 1 posts with rating 2 . Been with us since 2023 year.

Comments

p.kaczmarek2 08 Jun 2023 10:42

Yes, both Quick Connect flag and static IP can increase the connection time to MQTT server. It should be about 5 seconds or maybe even less. We're constantly improving it. [Read more]

ionoleinic 22 Jul 2023 11:30

I have the same device, but for me this configuration isn't working... I dont understand, why p26 should be pwm?? i think it should be wifi_led. Why 2 DoorSnsrWSleep? (P7 abd P8) I tried this: P7 -... [Read more]

p.kaczmarek2 22 Jul 2023 12:38

This device is battery powered and it's not TuyaMCU, which means we need to utilize deep sleep in order to preserve battery life. Otherwise batteries would drain in a matter of days. Using doorsensorwithdeepsleep... [Read more]

ionoleinic 22 Jul 2023 13:27

DoorSensor Driver only boot up wifi module? It does not change rel state? P26 is a Led. { "bt_pin":"7", "status_led_pin":"26", "rstcnt":"3", "basic_pin_pin":"8", "module":"CB3S", "jv":"1.0.1", "bt_lv":"0", "net_t":"180", "samp_type":"1", "basic_st":"1", "basic_pin_lv":"1", "samp_sw_pin":"14", "max_V":"3000", "min_V":"2400", "samp_sw_lv":"1", "status_led_lv":"1", "samp_pin":"23", "tamper_st":"0", "crc":"92" }... [Read more]

auntlydia 05 Sep 2023 19:54

Hi, from the photos above I believe I have the same device. It comes with battery state too. For me these settings have worked: - motion pin: p8 (dInput_n or DoorSnsrWSleep and Flag 42) (Channel 1) -... [Read more]

styb113 15 Jan 2025 15:30

Hello, I also want to run this Device via micro USB, how did you disable the Deep Sleep? [Read more]

auntlydia 16 Jan 2025 17:00

Hi there, if you have the same device, try setting "dInput_n" on P8 (or the pin your device has the motion sensor connected). This should keep the device awake. [Read more]

%}