A Super Simple ESP8266 IOT Motion Sensor

It’s really hard to overstate how awesome ESP8266 development boards like the Wemos D1 Mini really are. For literally a couple of dollars you can get a decently powerful Wi-Fi enabled microcontroller that has enough free digital pins to do some useful work. Like the Arduino and Raspberry Pi before it, the ESP8266 is a device that’s opening up whole new areas of hacking and development that simply weren’t as practical or cost-effective as previously.

As a perfect example, take a look at this stupendously simple Internet-connected motion detector that [Eric William] has come up with. With just a Wemos D1 Mini, a standard PIR sensor, and some open source code, you can create a practical self-contained motion sensor module that can be placed anywhere you want to keep an eye on. When the sensor picks up something moving, it will trigger an IFTTT event.

It only takes three wires to get the electronics connected, but [Eric] has still gone ahead and provided a wiring diagram so there’s no confusion for young players. Add a 3D printed enclosure from Thingiverse and the hardware component of this project is done.

Using the Arduino Sketch [Eric] has written, you can easily plug in your Wi-Fi information and IFTTT key and trigger. All that’s left to do is put this IoT motion sensor to work by mounting it in the area to be monitored. Once the PIR sensor sees something moving, the ESP8266 will trigger IFTTT; what happens after that is up to you and your imagination. In the video after the break, you can see an example usage that pops up a notification on your mobile device to let you know something is afoot.

With its low cost and connectivity options, the ESP8266 is really the perfect platform for remote sensing applications. Though to give credit where credit’s due, this still isn’t the simplest motion sensor build we’ve seen.

31 thoughts on “A Super Simple ESP8266 IOT Motion Sensor

    1. In the past, crimp contacts for PCB connectors, and the matching crimping tools were very expensive, so I also often soldered wires to those connectors, but nowadays they’re so cheap, that there’s no excuse to not crimp your own cables.

      1. For a semi permanent installations, I prefer soldering personally, especially for a “security” device. Just one less potential issue, troubleshooting intermittent connection issues can suck. :)

      2. I bought a cheap wire wrapping tool and haven’t looked back. Life changing! To me it’s more reliable than soldering, as you don’t get wire solder joints that break when you’re messing about with the board and such. Also easy to remove if needed.

        1. I haven’t used wire wrapping since college (33 years ago)! Yikes! Hard to believe it’s still being used! lol

          Honestly, soldering (if done properly) is the way to go. I have a D1 Mini that I use on a bread board to work up my projects, and then I use a new one and solder my wired connections directly to the holes on the new board. They’re only a couple of bucks, so I try to have a few on hand “just in case!” There’s always a need… :)

    2. Don’t let the fear of soldering trap you. There are lots of good YouTube videos about how to do it well. Get your favorite comfort food, favorite stuffed animal, a blanket and your remote control for your smart TV (sure hope you have one) and adventure forth through the video tutorials in your most comfortable chair/couch. Its worth overcoming and life is much better on the other side. If you feel encouraged enough, this video looks like a good starting point. :-)

          1. > being up typing at the keyboard when I should have been sleeping.

            Don’t we all?

            I still enjoy watching soldering tutorials once in a while. Thanks.

    3. Yeah that’s pretty rough.

      With more and more stuff going SMD, I suppose proper soldering is becoming a lost art (and it’s only going to get worse). Of course, even when through hole was at its peak, plenty of people weren’t any good at it so…

    4. The soldering is pretty brutal, but in his defense, those pins aren’t meant to be soldered to at all. It’s pretty amazing that it works at all.

      I would use header cables instead of soldering, or if it’s absolutely necessary desolder the headers and use the through-holes.

  1. Considering that there are dozens of (pretty much the same) motion sensor projects on the internet, this must be one of the worst:
    – the code is a mess and a wild copy-paste result with, for example, definitions and unused variables all over the place
    – the code does not even try to save a tiny amount of energy, which could be done with built-in functions of the ESP with a couple of lines of code and no negative impact

      1. As I said there are already more than a dozen tutorials out there who do exactly the same. No need to repeat it again and again. Furthermore, as commented by other people here, the design is seriously flawed. There is no need to put lipstick on a pig…

  2. I stopped using this sensor with esp8266 while ago because of false triggers. Somehow 2.4Ghz wifi from esp8266 is triggering motion sensor. I tried shielding sensor with aluminium foil, adding capacitors… nothing helped. I googled and found that I’m not the only one. Radar sensors like HB100 are better solution for use with esp8266.

    1. You can mitigate it by making sure all the wires to the PIR pass through a ferrite, and wrapping the PIR in grounded foil. I’ve had the same issues with using a PIR too close to a Pi Zero W.

  3. I’ve start using the Human Radar Sensor Modules. Sofar so good.
    and the end package is alot smaller smaller.
    Mind you the have been selling smaller motion detectors that are a bit more, but they are less the a 1/4 of the size.

    And I just found out how cheep the backup sensors are. Just got a package in now to play with.
    Looks really good. $12 gets you 4 sensors that are really small and the little computer that comes with it as well.
    Its play time..

    1. OH Boy “the”‘s really messed my sentence.
      “Mind you they have been selling smaller motion detectors that are a bit more, but they are less then a 1/4 of the size.”
      That looks better.

      1. “I’ve *started using the Human Radar Sensor Modules. *So far so good.
        and the end package is *a lot smaller.
        Mind you *they have been selling smaller motion detectors that are a bit more, but they are less *than a 1/4 of the size.

        And I just found out how *cheap the backup sensors are. Just got a package in now to play with.
        Looks really good. $12 gets you 4 sensors that are really small and the little computer that comes with it as well.
        It’s play time..”

        Hope this helps :)

  4. Thanks for this – it at least got me to buy some Wemos boards.
    Question – don’t you get like 10 text messages from one motion event this way? I think there needs to be a threshold, where it only sends an alert when there have been > 3 hits – and then stop sending alerts for 10min or some time after, in case someone is dancing in front of the PIR for half an hour. I’d hate to get a thousand alerts…

    1. There are a lot of ways to address your question. If integrated with Home Assistant, for example, the options are as infinite and as varied as their are integrations. But, delays can be set directly on the PIR as well, and even the D1 Mini can be programmed with delays, though don’t ask me how, cause at this point I’ve not had the patience to figure out the logic programming to set that up. I must have gotten lazy in my “old age”…

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.