Use this forum to chat about hardware specific topics for the ESP8266 (peripherals, memory, clocks, JTAG, programming)

User avatar
By trackerj
#12903 Might worth a look : http://www.esp8266-projects.com/2015/03/esp8266-pir-motion-sensor-detection.html

No false positives, working continuously ok in the last weeks. Managed to tweak position to avoid the cat walk around so no more disco lights :D

It will be easy to adapt to any ESP module variant.
User avatar
By Mikejstb
#12916 No, my scheme of shutting the radio off while waiting for the PIR to interrupt works well, so the radio is never on while waiting for PIR to interrupt.
User avatar
By Mikejstb
#13310 Thought I'd post some pictures of my "wife approved" PIR sensor unit.
First I bought some of these from Amazon -
IMG_2145.JPG


http://www.amazon.com/gp/product/B00L589HJG/ref=oh_aui_detailpage_o01_s00?ie=UTF8&psc=1

Opening it up and investigating the circuit board showed that it is using a standard ME003 PIR chip.
I found a schematic where this chip is used here -
http://www.elecfreaks.com/wiki/index.php?title=PIR_Motion_Sensor_Module:DYP-ME003
where I confirmed that the chip is running at 3.3v and I could pick up the trigger signal from pin 2.
This particular unit has a photo-resistor and circuitry to enable it only when a certain level of darkness happens. It's adjustable, but I'm not sure if I want that or not, so for now I just stuck a little bit of electrical tape over the photo sensor.
Also - out of the box the unit leaves the trigger set for a minimum of 40 seconds up to several minutes. I only need it to be triggered for a few seconds, so I located where the timing resistors are on the circuit and modified them to just keep triggered for 3 seconds.

In my software once I get an interrupt I change the gpio pin from trigger to input - first to stop any further interrupts while I'm processing, and second I read the input after 500 ms to sort of debounce or eliminate false triggers. That's all working well, so setting the PIR sensor to stay triggered (high) for 3 seconds is OK.

I tried a 1117 LDA type of voltage regulator to get my 3.3v for the ESP, but the 1117 didn't handle dropping 12v down to 3.3 very well (got VERY hot!!) so I used a tiny adjustable buck-type converter instead like these - http://www.ebay.com/itm/331288864626?rmvSB=true

That powers an ESP-12 which is just using one gpio pin as an interrupt to sense the PIR signal - but the -12 was the smallest ESP module I had.

The little buck converter and the ESP fit right in along the rim of the PIR enclosure -
IMG_2148 - Copy.JPG


Nice and clean - just needs 12v to power the whole thing. I haven't permanently mounted it yet, but it could go in the ceiling or wall easily.

Next one up is a unit for my garage - one of these -
http://www.amazon.com/gp/product/B0056ZATE6/ref=oh_aui_detailpage_o01_s00?ie=UTF8&psc=1
This one covers 40 x 40 feet, plus it also looks down as well as out. It's meant for a burglar alarm so it's output is a NC relay. My software looks for an 'up' interrupt, so I'm going to use the NC relay and a resistor to keep my gpio line low until the relay opens on trigger at which point the signal will go high and trigger. I've already tested and the default on this one already triggers for a couple of seconds so I really won't need to modify anything. It's a much tighter fit, not much extra room at all in the enclosure so it's going to be a real challenge to see if I can fit the ESP inside.

At this point I've got 6 ESP powered PIR sensors scattered throughout the house. They all use mqtt, report to a mosquito server running on a Raspberry PI, which also runs Node Red to send the reports from the PIR sensors and a bunch of temp/humidity/barometric pressure sensors to various places.

My next part of the PIR project is to somehow extract the PIR data from my MySQL data base and display graphically on a floor plan of my house which sensors were triggered and when. I have no idea how to do that but I think I can do it fairly easily using JavaScript.
I hope to be able to have a user interface where I could pick a date/time, scroll somehow and watch the movement between the PIRs graphically on a floorplan.

Also want to detect movement patterns. Is it me moving at night? Or a pet, or a burgler? Did the movement begin in an occupied bedroom, or did it start at an ingress into the house? Should some lights turn on as it senses me moving from bedroom toward kitchen, etc?

Having reliable wireless sensors that only cost around $10-$20 really makes some interesting things possible. And having such a great user community here to help with ideas and troubleshooting is priceless valuable.

The more I think about this the more ideas come to mind!
You do not have the required permissions to view the files attached to this post.