Це відео не доступне.
Перепрошуємо.
Cheap DIY Motion Sensor that works with ESPHome & Home Assistant
Вставка
- Опубліковано 15 сер 2024
- Wemos D1 Mini (AliExpress affiliate) - s.click.aliexp...
5 Pack Hc-sr501 Pir Motion Ir (AliExpress affiliate) - s.click.aliexp...
Passive Infrared Sensors or #PIR sensors for short or just Motion Sensor are completely supported by #HomeAssistant and ESPHome. I have a question for you why to buy an expensive motion sensor when you can #DIY for cheap. In this video I will show you what parts you will need, how to install ESPHome, how to add the motion sensor to Home Assistant and how to make automations.
Using smart motion sensors on strategic places at your home is one of the quick wins when you are turning your home into a smart home. Of course you can use out of the box motion sensors like Shelly Motion or other similar, but they are not coming cheap, especially if you have to buy a lot of them. That is why we are going to create one that will cost around 4 US dollars and it will take only few minutes of your time to make it. I will show you everything step by step and at the end we will see a real demo with Home Assistant automation.
Let’s see how.
► TIME TABLE
00:00 Intro
01:38 What is needed for the DIY Motion Sensor?
03:04 How to connect the D1 Mini to PIR sensor?
03:34 Install ESPHome as Home Assistant add-on
05:00 Editing the ESPHome configuration
06:59 Install ESPHome on D1 Mini
07:55 Add the DIY Motion sensor to Home Assistant
09:02 How to make Home Assistant automation with the DIY Motion Sensor?
10:38 Outro
► MY WRITTEN ARTICLE - peyanski.com/c...
► MY GUIDE - ON SALE
Smart Home Getting Started Smart Home Guide v2.0 - peyanski.com/p...
► SUPPORT MY WORK
Patreon - / kpeyanski
Paypal - www.paypal.me/...
Bitcoin - 1GnUtPEXaeCUVWdJxCfDaKkvcwf247akva
Revolut - revolut.me/kir...
► COME AND SAY “HI” on:
My Discord server: invite.gg/kpey...
My Twitter: / kpeyanski
► AFFILIATE LINKS
Wemos D1 Mini - s.click.aliexp...
5 Pack Hc-sr501 Pir Motion Ir Sensor Body Module Infrared - s.click.aliexp...
jumper (Dupont) wires - s.click.aliexp...
USB to microUSB Cable - s.click.aliexp...
USB Plug Adapter 1A - s.click.aliexp...
NodeMCU-32 ESP32 wifi+Bluetooth (ESP32) - s.click.aliexp...
NodeMCU V3 (ESP8266) (AliExpress affiliate link) - s.click.aliexp...
Ubiquiti UniFi Dream Machine (UDM) - amzn.to/34B0FQK
Raspberry Pi 4 4GB Starter Kit with 32GB Micro SD Card - amzn.to/3qaI5qN
Raspberry Pi Zero W kit 2 - s.click.aliexp...
Raspberry Pi Zero W Official Starter Kit (Amazon Affiliate link) - amzn.to/3ndcX87
Tech that I’m using right now - www.amazon.com...
Get $100 in credit over 60 days for DigitalOcean - m.do.co/c/6dd2...
► CRYPTO AFFILIATE LINKS
Sign up for Crypto.com and we both get $25 USD (Referral code: xn86atnceg) - crypto.com/app...
Coinbase - Get $10 in Bitcoin when you buy or sell $100 or more - www.coinbase.c...
Binance - One of the biggest Crypto currency exchange - www.binance.co...
► ESPHome configuration
esphome:
name: pir-sensor-1
platform: ESP8266
board: d1_mini
Enable logging
logger:
Enable Home Assistant API
api:
ota:
password: “512345rt234gwef”
wifi:
ssid: "A IoT"
password: “SmashTheLike”
Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Pir-Sensor-1 Fallback Hotspot"
password: “somepass”
captive_portal:
binary_sensor:
- platform: gpio
pin: 13
name: "PIR Sensor"
device_class: motion
► HOME ASSISTANT MOTION SENSOR AUTOMATION
automations.yaml entry
alias: When PIR motion sensor is activated
description: ''
trigger:
- platform: state
entity_id: binary_sensor.pir_sensor
to: 'on'
condition: []
action:
- service: light.turn_on
target:
entity_id: light.shellybulbduo_8caab5616d5c
mode: single
► USEFUL LINKS
PIR Sensor 3D printed cases - www.yeggi.com/...
ESPHome PIR Sensor page - esphome.io/coo...
✅ Don't Forget to like 👍 comment ✍ and subscribe to my channel!
► DISCLAIMER
Some of the links above are affiliate links, where I earn a small commission if you click on the link and purchase an item. You are not obligated to do so, but it does help fund these videos in hopes of bringing value to you!
What I like about these is that I don't have to worry about changing the batteries. I added some code in esphome to show the wifi signal strength and up time. It lets me know how my wifi network is preforming. Just add this to the yaml code and change the name to whatever you are using.
sensor:
- platform: wifi_signal
name: "PIR WiFi signal"
update_interval: 60s
- platform: uptime
name: "PIR uptime"
unit_of_measurement: "min."
filters:
multiply: 0.0166666667
Great tips 👏 thanks for that! Do you have any issues with false positives? If yes, how you deal with them? Thanks one more time for the useful comment.
@@KPeyanski I had false positives when I used short Dupont wires like you did. I switched to longer wires, over a meter, and moved the sensor away from the D1-mini and it fixed the problem. I used cat 5e and connected it using a wire wrap tool, but soldering would also work. The PIR sensors appear to have been designed for alarm systems where they would be away from other electronics.
Incredible tips. I will pin this. Thanks 🙏 Also feel free to join my Discord server. We need ppl like you there - invite.gg/kpeyanski
Super walkthrough! So cool too.... that GRAY thumbs up symbol is a great "mouse click" sensor, turns blue on a click, simply amazing!!!
hahah glad you like both the video and the thumbs up automation :) What do you say It works flawlessly? 🤣
Definitely worked! Happy 1k!
I've used Home Assistant for several years now and noticed the Esphome integration, but had no idea how easy it was to use. Just ordered 5 nodemcu and 5 motion sensors. Now I can have my lights come on as I ever l enter certain times. Can't wait to try them out.
Thanks for this great tutorial. 👍
Great video! The real hang-up is packaging these DIY devices, especially for outdoor use.
It sure is! That is why I'm asking for help with 3d printer models if there is someone that wish to help. Thanks for the comment.
Tell me when can I order
SUGGESTION..
Could you make a tutorial on building a cheap Wifi Door Sensor.? I'm sure using these D1 Mini boards and a cheap (Reed/Magnet) contact switch would be very useful to a bunch of people. Thanks in advance. 👍😊
I tried the blue thumb automation and it worked! 😂😂
I told you and it works every-time 🤣 Thanks!
Followed the on al the way through so excellent. Love your work
Welcome aboard of #PIRowners! And thanks for that comment :)
Another great video. Is there an easy solution to turn these into battery powered devices?
Following...I'm sold if these can be battery powered!
I'm also interested in that question, but don't know the answer yet.
Agreed. Anyone have a batteried solution for this?
I also wanted to know as I want to build a floating pool temperature gauge and switch on every 2 hours and goes to sleep but I’m not good with electronics but I follow these videos easy
@@KPeyanski hurry up and find a solution 😂😂😂 love your videos
Excellent guide! Straightforward and to the point! Thanks!
Glad it helped!
I like your videos, very easy to understand, thanks
Glad to hear that! Enjoy!
Hi, I have my Home Assistant running on Synology NAS on virtual machine. Everything went ok until Install, where I got a message "No serial devices found". Validation went OK. I plugged in the sensor into USB of the NAS drive.
Any ideas what went wrong and how it can be installed? Thank you !!
Excellent solution, cheap and effective! I looking for similar solution but working with zigbee instead of wifi. Do you know how to do it and can you please make a video explaining how to do it?
Thanks for the comment and for the suggestion. I will think about it.
Thanks for a great presentation!
My pleasure! Glad you enjoy it!
Great instructions. Thank you.
Thanks for watching and commenting, Ron!
#PIRowned Hi Kpeyanski, I took NMCUV3 ESP8266 and HC-SR501. Make all as you show in your Video and I say WOW. It work all fine and perfect. Please get so on by making this good and useful Videos, BRAVO
Welcome to the club! I'm very glad that I managed to help
1:17 you deserve a sub just for that bit!! 😁
Thanks :) I stopped making such jokes in my latest videos as I thought ppl are not liking them. I guess I have to test that somehow
I clicked the thumbs up button twice and is didn't stay blue. :D
Haha only odd numbers are counted for this automation :)
4usd for the esp board and pir sensor, sure, but you still need to buy more stuff like usb cable and power adapter for each, case, wires. Tgis is more like a 20usd device once you finally assembled one.
You actually don't need a USB cable for power. Tons of ways to hook it up. For cases, there's 3D printing. Wires are super cheap if you're not using prototyping wires and buy rolls of the stuff. What he's showing here is how to get started. Use your imagination and get creative on what materials you can use to make dozens of them. I've been able to get mine down to about $1 a piece, not counting batteries (rechargable AA) which sure as heck beats off the shelf hardware, $15 to $30 a piece.
nice, wish i knew how to add a flexible timer to switch the light off
You can do that with the automation, but it depends what exactly want to achieve.
@@KPeyanski when pir activate light, it stays on for xx mins, then switches off
@@ecoterrorist1402 fiddle with the 'time out' so it doesn't trigger the automation all wild like, then when triggered on add a "wait for time delay". in the same automation, send a command to turn lights off
As usual , Great job :)
Thank you! Cheers!
Thank you. This worked beautifully. :)
You're welcome!
Another great video Kiril! Thanks. I love how easy Esphome has become to use.
Yes, ESPHome become like native way to go after Nabu Casa acquired the ESPHome. Love it.
#PIROwned with ESP Easy Mega, Domoticz and Wemos D1 Mini expansion boards
Great to hear! Very good job! Enjoy!
Thanks for the vid! Only downside to commercial solutions is the need for having it hooked up to a power source.
I don't have a socket close to every point where I use those.
Any way to make these battery powered? I guess that wifi will be eating to much power?
Sure there is a way to use batteries, but I can’t recommend you anything at the moment. Maybe I’ll make another video when I have more info.
Is there any way yo add a led light or led strip to turn on where motion is detected?
I didn't get one thing... In real world I would be able to know when someone is entering in a room and when someone is going out from a room so that in this way I could count the number of people in the room and turn the light off if and only if there are 0 persons in the room, so I would need two sensors. Could someone explain me if I get something wrong?
Anyone have a solution to solution? I'm very new to this but I got the sensor work but I'd love to be able to use batteries to power it.
It is possible do with zigbee ? it will be greate because it will use battery. Thanks!
Thank you for the detailed video!
My pleasure!
Is a great video. Thx
Thank you as well for the good words! 👌
Great video!!!. I made Two of this sensor but I have a lot of false event. Have you the same problem?
Yes, unfortunately false events are present. And this Is because of the sensor itself. There are some tricks that can be used to minimise them and I think we discussed them either here in the comments or in my written article.
Why did you use the d7 pin?
PIROwned ! The only problem is the false positive. so i'm sourcing for the AM312 PIR sensor for replacement.
Great to hear! Good luck with the other sensors and let us know the results afterwards!
I made three of these. One stays detected all the time. One constantly flips back and forth between detected and clear. The other sort of works correctly but has about 3 false positives every couple hours. After some research it turns out the cheap knock off boards recommended in this video, coupled with these sensors which are known to be noisy, and this is a terrible idea of a project.
Same I'm gonna attempt to make another tonight but I had 3 stop responding completely in one day
@@kyleawilliams91 how does it go, I'm trying to use this as a college project.
@@hellothere9167 unfortunately I gave up on them after 3 or 4 stoped working in a day. I'm going to use a premade motion sensor via zwave or some presence detector.
@@kyleawilliams91 dang, guess I'll just wing it then
I know from using reed sensors(magnetic) you can lower the sensitivity to reduce false positives, say has to be trivgered for 200ms before triggers...
Is there a was to link the activation to my cell phone to give an alert ?
Yes - ua-cam.com/video/JCjzEKdlezk/v-deo.html
Any thoughts on how to power via battery?
It is possible, but I haven't done any research on this yet so I can't tell any details.
I didn't know Slavoj Zizek was into home automation xD
Who is this guy? And is this good or bad?
@@KPeyanski hes a socialist from slovakia if I remember it correctly. Hes got a similar accent. Id take it as a compliment.
Great video! Can you share your experience about battery life?
I'm not using battery for this, but an USB adapter
@@KPeyanski - so just a simple wall adapter to provide power through the micro-USB port, correct? Seems simple enough, and never have to worry about battery life.
so cool!
Glad you think so! Enjoy!
thanks for the tipp - using ikea trådfri motion sensor for €9 per piece but they suck
after motion was detected you will have 60 seconds until the device will take a new motion detection - so deadtimer
another questions: how do you power them? microusb is not available all the time where I need this sensors. any ideas?
are these kind of ESP modules also available for Zigbee? I love it since I didn't have any outages or issues with that protocol.
ESP8266 and ESP32 are Wi-Fi microcontrollers only. I power them with microUSB cable and any USB adapter (from phone or other device) Probably you can attach a battery, but I didn't tried this and I don't know which battery I can recommend.
#PIRowned the only issue is that the motion sensor must be attached to the Rasberry-pi/Laptop is there a way to use a battery to power it also the wireless option how it works ? thanks great video
Great, that you manage to make the PIR sensor ;) For sure there is a way to add a batteries, but I can't give you concrete directions, because I haven't done that yet and I don't want to give you false instructions.
Is it possible to add bot pir and a dht22 for example to one board?
Yes, sure!
#PIRowned
awesome tutorial and very useful
Glad to hear that! Congrats and enjoy! Good job 👍
this is my log screen after programing wemos, and wemos is offline, pleas help. " wemoINFO Reading configuration /config/esphome/gl-8.yaml...
INFO Starting log output from gl-8.local using esphome API
WARNING Can't connect to ESPHome API for gl-8.local: Error resolving IP address: [Errno -2] Name or service not known
INFO Trying to reconnect to gl-8.local in the background"
Sorry I don't know what could be the reason. Try to start from scratch and use my article instructions if it is easier for you
You rock
Thanks, glad you like it!
if we can power de nodemcu with batterys will be very nice!
Great!, any clues how to make a HTTPS home assistance?
Sure, here is a video tutorial of mine - ua-cam.com/video/jkBcGl7Vq8s/v-deo.html
Can i use this in other place but still appear in my HA? I use wled in my store via mqtt and can control fine from home
yes, you can use it wherever you wish as long as it have wi-fi coverage there.
Can you explain about the ESP Mesh feature? Is it something the can be used alongside ESPHome? Thanks
I'm not familiar with that sorry!
What's the battery life?
no battery here it should be connected to a USB port or you have to use USB adapter
I have them to still have to do it my kid Will do it they even sell mount for it
Hey Alex, I'm having hard time to understand that comment. Maybe because I shoot two videos in a row and my head is kind of autopilot right now. Can you please explain again :)
#PIRowned - working great!
Perfect! Thanks for sharing!
How to order
Use the links in the video description
hi, is it possible to do this with rain sensor instead of PIR sensor?
Yes, check the esphome web page to find some examples.
#PIRowned #DHTowned
Works separately, but together on the same D1 Mini, after a few minutes it stops reporting the values.
Do you know what can be?
PIR - 5v
DHT - 3v
Thanks and great videos
Congratulations on the efforts! Regarding your Q - I'm not sure I never tried that. Is it the same with power adapter?
Thanks @KPeyanski , it was a power supply problem. I changed the AC/DC supply to 2A and the problem was solved.
I already have 3 mounted and are all ok. Thanks for your help.
Now I will start another project. Maby the esp32-cam. ;)
How is this powered when not connected to the USB?
USB adapter from an old phone or something.
Hey do you have the Philips Hue motion sensors? Do you find any drawbacks in reporting rate or speed between the DIY and Philips Hue ones?
No, I don't have PH motion sensor, but the speed of the DIY Motion sensor is pretty good.
I've just set this up but using a microwave sensor rather than PIR (but same config) and I can say it's as quick as Philips Hue sensor and the microwave sensor even worked through an internal brick wall! (The sensor I'm testing is this one: www.amazon.co.uk/gp/product/B07W5G6M1B/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&psc=1)
Dose this work with any esp8266
Most probably, yes! But not 100% sure here as I don't know all of the available esp8266 devices
#PIRowned
Wow great to hear that. Congrats :)
but.. what about the false trigger?
if you have such you can try to play with the sensitivity knobs and/or the cables length
I have always had too manyfalse positives with these sensors for some reason. Got fed up actually, tried microwave sensors and ended up with the same problem
You can adjust the sensitivity with the yellow knobs but you probably already know that.
@@KPeyanski yeah, I do. But it was some other interference, it would just keep triggering randomly. I tried microwave sensors as well and had the same problem
@@MrBlackpanther87 I have many sensor boxes with motion, lightsensor, temp and humidity running ESPHome. I use the same 501 PIR for motion. I had lots of false positives in the beginning, when I used Tasmota. Now I am on ESPHome, and appart from one of the sensors occationally giving me false positives, the others are 100% stable. Note, I've connected PIR Vcc to D1mini 3.3V pin, not 5V.
@@ollyalme makes sense. I have used tasmota only. So might actually be a tasmota problem then.
It's been a while, so I don't remember if I tested with just Arduino code direclty and faced the same problem. But worth retrying just to see how it works now.
I got frustrated and ended up switching to zigbee sensor which are more convenient since they are battery based but spent a lot more money then I would have wanted to offcourse
#PIROwned ...me...! :( I got a lot of interference from the PIR sensor and during the night (with no motion) i get constantily the trigger ON and OFF... so unusable....
Sorry to hear that it seems that is often a problem with this exact PIR sensor model. Try to shorten the cables from the PIR sensor to the D1 mini some ppl are saying that this help.
@@KPeyanski i soldered on top on my wemos mini like other commercial motions sensors do... but no luck... anyway your videos are amazing as always! thanks so much
Thanks and I hope to minimise the false positives to 0.
I had interference problems too. I solved the problem by using longer wires to get the PIR away from the esp board, CAT 5 about 2 meters long. Other sensors can also be hooked up to the same board, such as temperature/humidity sensors.
@@vegaswayne247 So you suggest longer and shielded?
#PIROWNED
Great to heart that. Enjoy! Also, check my other DIY smart sensors videos that I have ;)
Mine turned white and not blue 😂
Really, how come? What device/browser are you using? 🤪
@@KPeyanski Stock UA-cam app on Android ;)
I see, thanks for sharing :)
not to be offensive but, wtf is you from? i havent ever heard your accent. again i did not mean that in an offensive manner
I'm from Bulgaria. Not to be offensive, but "wtf is you from?" is a totally wrong written question!
@@KPeyanski i see i dont entirely remember this but i think i was asking where you were from because i haddnt heard your accent before, i hope you have a good day sir
#PIRowned
Wow great! I really love that ❤️ Was it hard to implement?
@@KPeyanski I had it up and running within 10 minutes of receiving the sensor. Thanks for your help 😊
Very glad to hear that! Enjoy 😊