In this tutorial we will show how to build ESP8266 WiFi PIR sensor with ESP8266 and PIR.
Materials
-ESP8266 module
ESP8266 ESP-01 Serial WIFI Wireless Transceiver Module | |
$2.11 | |
$17.00 |
ESP8266 ESP-03 Serial WIFI Wireless Transceiver Module | |
$2.07 | |
$2.15 |
ESP8266 ESP-12 Serial WIFI Wireless Transceiver Module | |
$2.06 | |
$1.75 |
ESP8266 ESP-05 Serial WIFI Wireless Transceiver Module | |
$1.88 |
ESP8266 ESP-07 Serial WIFI Wireless Transceiver Module | |
$2.18 | |
$1.88 |
ESP8266 Lua Nodemcu WIFI Network Development Board | |
$7.43 | |
$2.65 |
-PIR sensor module HC-SR501
Pyroelectric Infrared Motion Sensor Detector Module HC-SR501 | |
$0.99 | |
$1.05 |
See buying guide at the end of tutorial.
PIR sensor display in EasyIoT server.
EasyIoT server
In EasyIoT server web interface add Virtual node. Type for virtual node is Motion (DI). See How to add node to EasyIoT server tutorial for detail. Remember node address because it will be needed later. Add node to one of Groups to display.
Virtual node address.
Program
Program can be found on GitHub. Correct following lines in program (AP username password, server IP address, node address, EasyIoT server username and password):
//AP definitions
#define AP_SSID "your AP SSID"
#define AP_PASSWORD "your AP password"
// EasyIoT server definitions
#define EIOT_USERNAME "admin"
#define EIOT_PASSWORD "test"
#define EIOT_IP_ADDRESS "192.168.1.5"
#define EIOT_PORT 80
#define EIOT_NODE "N8S0"
Compile and load program with ESP8266 Arduino IDE. Read tutorial for direct ESP8266 programming in Arduino IDE.
Connection
Power supply for ESP8266 is max 3.6V and PIR sensor is powered by 5V. If you check datasheet for PIR sensor you will see that internally is powered by 3.3V (see 3.3 regulator).
Internal logic is 3.3V so output. It can be directly connected to ESP8266 GPIO pin.
PIR
PIR | |
VCC | VCC 5V |
GND | GND |
OUT | GPIO2 on ESP8266 |
PIR HC-SR501 pinout
ESP8266 and PIR HC-SR501 connection.
Check also EasyIoT Cloud ESP8266 PIR sensor tutorial.
See more tutorials at http://iot-playground.com/build
Buying guide
To support this site and EasyIoT framework development please buy in our store.
Comments
But if you connect directly to 3.3v it doesn't work well.
Take a look of http://techgurka.blogspot.it/2013/05/cheap-pyroelectric-infrared-pir-motion.html to easy modify sensor to power at 3.3v !
Read comments in program.
Kan you give a link here, icant findt it
I've updated program with link to library. Hope it helps.
I get this error
test1.ino:2:20: fatal error: Base64.h: No such file or directory
compilation terminated.
Fejl i kompilering.
And i cant find the file anyware??
Program is almost the same - just add pull up command to GPIO pin.
thanks
Dario
RSS feed for comments to this post