I wrote yesterday on ESP8266 programming tools and let’s continue on the ESP8266 theme. Two days ago Hackaday had an interesting posting Internet Knows Your Every Move Thanks to IKEA and ESP8266. It describes how to combine ESP8266 WiFi module and IKEA Molgan PIR light. The stock PIR light simply lights when motion is detected, and ESP8266 communicates that event to Internet.
The lamp time it stays on after detecting movement was changed to have enough time for the ESP8266 to power up get an IP, SNTP time and publish a MQTT message. The developer set up mqttwarn to push notification to phone and computer (pushbullet) whenever motion is detected by the PIR.
- log on wifi
- get time from NTP server (pool.ntp.org)
- format text with timestamp
- log on to MQTT broker
- publish formated text to MQTT broker
- go into deep sleep.
Schematics, source code and tons of great pictures are available on his blog in two postings and GitHub project: