https://github.com/gpbenton/esp8266-door-open-sensor
Door open detector using esp8266 native code in platformio environment
https://github.com/gpbenton/esp8266-door-open-sensor
Last synced: about 2 months ago
JSON representation
Door open detector using esp8266 native code in platformio environment
- Host: GitHub
- URL: https://github.com/gpbenton/esp8266-door-open-sensor
- Owner: gpbenton
- Created: 2017-01-24T09:22:36.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-24T11:19:26.000Z (over 8 years ago)
- Last Synced: 2025-01-21T11:44:42.385Z (3 months ago)
- Language: C
- Homepage:
- Size: 7.81 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# esp8266-door-open-sensor
Door open detector using esp8266 native code in platformio environmentI saw http://www.esp8266.com/viewtopic.php?f=11&t=4458 and as I had a spare esp01 module I thought it would be worth a try.
If the link stops working, here is the diagram
-----------------------------------
|VCC |RST |
-------------- \ SPDT Reed
| | \ Switch
| | CH_PD | |---------o
| |--------------o |
| | | |
| |GPIO0 | |
| |---/\/\/\/\---o |
| | 1KOhm | |
| | / |
| | \ 10KOhm |
| | / |
| | \ |
| |-------------=|=------------o
| |GPIO2 | |
| | | \
-------------- | / 10KOhm
| GND | |
--------------------------------o-------------o-The idea is that the esp8266 is powered off by CH_PD dragged low until the switch is closed.
On power up, GPIO0 is taken high to keep CH_PD high until processing is finished.
## Software
I had wanted to try out Platformio development environment, and this seemed a perfect opportunity.All my sensors use MQTT, so I can easily swap between different controlling software so I have included esp_mqtt from @tuanpmt as a submodule, and the platformio.init is configured to use this.
The only change I have had to make to the esp_mqtt is to specify the include directory for queue.h in queue.c as this was conflicting with queue.h in the development environment, and I couldn't find a way of changing the Include path search order.
#include "include/queue.h"