As most this kind of sensor requires 5v to work reliably. In 3.3v it is proven that gives false positives or no detection of movement. So in a setup with esp8266 (or a NodeMCU board like I used) you must have a 5v output just for the PIR sensor.
Thankfully someone has found a solution without modifying the sensor as most propose (this is tested for the sensor working in repeat mode). Studying the schematics it is shown that instead of connecting the 5v power to the standard VDC input you can connect 3.3v directly to the lower pin of the High/Low trigger selection pin. You can read about this in the following blog post https://techgurka.blogspot.gr/2013/05/cheap-pyroelectric-infrared-pir-motion.html
Problem #2: Interference! PIR sensor acts crazy when in close proximity with esp8266/NodeMCU’s WiFi producing a lot of false alarms.
The solution is to put the WiFi of esp8266 to sleep until there is a movement trigger from the sensor with this code:
As mentioned you’ll need an IFTTT account and a webhooks (former maker) key to use in the code. So each time PIR sensor detects motion esp8266 connects to WiFi and fires a webhook event. For example a Pushbullet notification in your phone.
The schematic connecting PIR with a NodeMCU is the following:
An ON/OFF switch is also added to stop sending the alarms when needed.
It was about time to somewhat clean the code, update the README with instructions and also provide a demo Android app for my THE433 Home Automation
It’s a self contained ESP8266 RF433 Interface to control RF sockets from afar (with your personal IP or a DDNS service). No need for external services and servers (no MQTT, right now I prefer it that way..) and its main feature is that you can set RF signals to fire in the future or repeat over time.
You will need your afraid.org subdomain hash which you can get by logging in https://freedns.afraid.org/dynamic/ and checking the URL at the bottom of the page where it says Direct URL.
There are a lot of IoT projects out there dealing with weather / weather conditions etc. I’ve been tinkering with some as it’s a great way to learn things around microcontroller boards like Arduino.
After playing around with some designs I wanted something simple for my room to check tomorrow’s weather forecast at a glance.
So this is the Forecast Jar.
Design is simple component side. An esp8266, two RGB common anode leds and a DHT22 sensor for local weather conditions.
The code (is a mess but “Hey! It compiles!”) uses Weather Underground API in its free version which offers enough daily requests for this project.
Of course Forecast Jar has a web interface (esp8266 ;)) in which you can check local conditions reported from DHT22 sensor and, more importantly, you can change the location of the Forecast Jar with latitude and longitude so it can request the correct conditions from Weather Underground.
Also in the web interface there is the color legend for the forecast conditions
The Forecast Jar (in code) is also connected to IFTTT Maker if needed and reports it’s DHT22 data to a ThingSpeak channel so we can have pretty graphs of our room temperature and humidity :)
Oh well someone has to watch over our sewage pump. Which has already a panel that control when to start / stop the pump or when to turn on heat protection when there’s no “water” left.
The problem was that this control panel is two floors down and if we wanted to check its condition (i.e. after a power failure or if the pump has stopped for heat protection) we should make regular passes from the basement.
The good thing about this control panel is that it has its own LEDs showing the status of the pump (Power Supply, Motor On, Motor Protection, Automatic (on/off), Level Alarm and No Water Alarm).
Enter esp8266 / NodeMCU.
With the use of six photoresistors (CdS, LDR) we can read the status of each LED of the control panel and output its status on a web page. Yippee..
The schematics on how to connect LDRs to an esp8266 or a NodeMCU are all over the web if you look. For three LDRs for example is the following:
In the code I’m reading the digital output of each LDR as 0 or 1.
Putting the six LDRs in the correct positions was easy on a 9x15cm prototyping PCB (luckily 9cm was the height of the opening of the control panel).
Reversing the PCB and placing it over the control panel with a breadboard to hold the NodeMCU for testing:
there was some duct tape involved.. (Duct tape is for everything right?)
Aaand we have our output readings in a static IP in our network (where green color is good):
In the code of the NodeMCU (with Arduino IDE) there is also a part that connects with IFTTT Maker channel to notify me for important events.
control 433MHz (compatible with Arduino libs) sockets/devices through web and time rules ESP8266 RF433 Interface
(esp8266 + RF 433 transmitter + Arduino IDE)
This is a sketch for controlling RF remote control sockets or relays that operate at the 433MHz frequency and are compatible with the Arduino/esp8266 RCSwitch libraries.
The main feature is that you can schedule events (up to 10) to turn ON/OFF your devices that repeat daily/weekly or that actuate once only within a week from setting the command.
A web interface is used to control the RF devices directly given a relative command at the main form and also scheduling the time events by giving at the same form a keyword to enter the scheduled events interface.
In the whole sketch these scheduled events are named Time Commands.
Time Commands (up to 10) execute your functions that fire the 433MHz sockets operating devices and can be set:
– Alarm Once
(once when the time next reaches the given hour, minute)
– Daily Alarm Repeat
(every day at the given hour, minute)
– Weekly Alarm Once
(once only on the next DayOfWeek, hour, minute)
– Weekly Alarm Repeat
(every week on the given DayOfWeek, hour, minute)
Here’s a video showing some basic usage of the web interface
Coding is really basic since my knowledge of C++ is minimal but hey.. it works!
– navigate with your browser at this IP
– here you can enter either a command to activate a connected device (you must edit the source code) i.e. SWITCH 1 ON
or you can enter the provided keyword to enter the Time Commands interface i.e. ENTERTIMECOMMANDS
– at the Time Commands interface you can select a function you want to be executed at a specific time
– select the time to activate and submit
– you’ll have to restart your esp8266 and you’ll be informed about this
– after esp8266 restarts and reconnects you’ll find the saved Time Command at the bottom of the web interface (from there you can also delete it)
// Post about: esp8266 / NodeMCU.
// Info on what they are at the end of the post
Yes out there is the excellent WiFimanager for saving the config of our esp8266 and it’s great.
Just wanted to try something quick and dirty on my own (learning process)
Started looking chriscook8’s esp-arduino-apboot code and tried to rewrite the heck out of it.
The goal was to have all this in a separate file and not in my main server/project sketch. Instead have it open in another IDE tab and just make a call from the main.
This is not a library (and it may never become one..)
You must have the two files “espWiFi2eeprom.h” and “espWiFi2eeprom.ino” in the same directory with your project sketch.
Has been tested with NodeMCU v1.0 and Arduino IDE 1.6.5-r5 in Windows 7
Check “example-espWiFi2eeprom.ino” for an example of usage along with another server.
You can edit “espWiFi2eeprom.h” in order to change parameters.