Used instead of very expensive Hue motion sensor. It's basicly a D1 mini, which breaks out pins from ESP8266 WiFi module and adds some periphery to enable USB serial communication.
It uses PIR sensor attached to pin D1 (arduino library maps this pin to pin 5) to detect motion and turn on specified Hue light bulb if all conditions are met. These conditions are:
- It's night time. This is determined based on if specified light bulb is on or off. State of the light bulb is checked and updated every set number of minutes ("lights_check_delay").
- If motion is detected. Specified light bulb is turned on for set amount of time ("motion_detected_delay"). Motion is still detected and updated when light is turned on, this means light is turned off only after no motion is detected for set delay.
- Philips Hue lights
- D1 mini or clone (ESP8266).
- PIR motion sensor (HC-SR501).
If enabled, you can put module to sleep while "lights_check_delay" is active. It can conserve a lot of power and is specialy useful when module is powered with batteries. This is controlled with "use_deep_sleep" variable.
Minor hardware modification is also necessary. Connect D0 pin to RST pin. This connection is used to wake up the module after sleep period is over.
Look for code in "####" block at the begining of code.
-
Mandatory
- ssid - wifi network name
- password - wifi password
- bridge_ip, port - Hue bridge ip and port
- user - Hue bridge username
- light - number of controlled light
-
Optional
- motion_detected_delay
- lights_check_delay
- hue_on - command send to Hue bridge when turning on the light
- hue_off - command send to Hue bridge when turning off the light