I Built My Own Presence Detection Sensor!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
a few weeks ago we took a look at what i think is a game changer for the smart home the acara fp1 a millimeter wave sensor capable of accurately detecting the presence of humans even when there is no movement but the problem with that sensor is that number one it's very difficult to get your hands on at the moment with supply shortages and number two it's not very cheap so could i build my own sensor with similar results for a more affordable price spoiler yes and it's really good i started researching millimeter wave diy sensors and after a quick google search i came across this millimeter wave sensor from df robot which works on the 24 gigahertz spectrum has a quoted range of nine meters which is four meters more than the acara fb1 and it had a nice simple connection diagram for arduino and most importantly had a rather detailed wiki page including some sample code looking at the code it seemed really simple to work with which is a real bonus and at less than 30 pounds for one sensor it was certainly worth a go when the sensor arrived i hooked it up to a wemos d1 mini since that has a native five volts output and the millimeter wave sensor requires 3.6 to 5 volts to operate we can see from looking at the pin out on the sensor that it has six pins vcc ground rx tx io1 and io2 this sensor uses uart for communication and again looking at the wiki page it outputs a simple text string that lets you know if a human is detected or not we can also see that the two i o pins will also output a high or low signal if the sensor detects movement giving us two different ways to work with this sensor you'll also notice the gold contacts on the sensor and this is the front of it and where you will want to face the sensor towards the room for detection i then loaded up the basic code from the df robot wiki page and checked to see if the sensor worked although this code is really basic and it doesn't connect to wi-fi so that you can output sensor information to home assistant that's easy to add afterwards and does allow me to see how the sensor works and how to interface with it upon loading the code and opening the serial monitor we can see that the sensor will output a 0 for no presence detected or a 1 if presence is detected super basic and easy to understand which is great with the sensor working i then started thinking about the connectivity and my go-to method is generally to use mqtt as that is universal easy to implement and i've used it in many diy projects in the past but before i did that i just had a quick search to see if anyone had implemented this sensor with esb home since i really like the ease of use and native integration with home assistant and i came across this thread on the home assistant form from user cr logic and would you look at that he is using the exact same sensor that i am and has provided a ton of detail and code to go along with it this is amazing and he has done a really great job and the thread itself is a really good read and has lots of information about various tests that he and other users have done and is super useful cr logic uses an esp32 for his setup however where i am using an esp8266 so i will talk you through my exact setup i'm going to recommend the wemos d1 mini since that has a 5 volts output which works perfectly with this sensor firstly we need to work out or figure out the pin out first there are actually only three pins that you need to use here vcc ground and io2 using io2 only will give you a binary sensor in-home assistant that detects presence and works well however if you want to be able to adjust the cooldown period and detection distance which the esp home config allows you to do then we need to also wire up the rx and tx pins on the board the rx and tx pins on this sensor can be wired to many different gpio pins on the wemos but the io2 pin can only be wired to one pin on the wemos which is gpio16 or d0 that's because io2 needs to be connected to a pull-down resistor to stop it floating and the wemos only has one pin which is pull down which is gpio 16. with that in mind and with the idea to keep the setup as small and compact as possible by stacking the sensor on top of the esp rather than having them side by side i selected d1 and d2 as my rx and tx pins on the wemos and the reason for that will become apparent in just a second i then soldered on header pins to vcc and ground and rx and tx and what this will do is line up perfectly with the five volts and ground pins along with the d1 and d2 pins on the wemos meaning all we need to do is add a single wire for the io2 pin using the header for these pins is ideal because it means that we can stack the sensor on top of the wemos and it will nicely support the weight finally i soldered a semi flexible wire from io2 to gpio16 or d0 on the wemos d1 mini to finish off the connections next connect the wemos to your laptop so that we can upload the esp home code onto it if you're not sure how to install or create a basic configuration for esp home then i'll have a full guide linked up here for you to follow along with after creating a very basic config paste in the code from the link in the video description into your esp home config making sure to change the device name to suit this code is based on cr logic's excellent thread with the pin out changed for the wemos d1 mini so all props for the code go to him and all of the contributors from that thread save the code and install it onto your wemos and monitor the log output if done successfully you should see some output that looks like this notice the line of text being outputted every second this is the raw string coming from the sensor and don't worry you don't need to do anything with this as it's all handled in the esp home config but it is useful for debugging next head over to configuration devices and services and your esp home node should have been automatically detected make sure to hit the configure button to finish adding it to home assistant and once added we can now go in and view the entities you'll see that we have some parameters that we can configure called a distance and latency distance is pretty self-explanatory here and allows you to configure the detection distance of the sensor i would recommend not going above nine meters with this setting i found that i got false ghost readings whenever i went above this we also have the latency option and this is essentially the cooldown time from when it will change from detected to not detected after someone leaves the room i would recommend not setting the latency too low though so that the sensor doesn't flap and keep changing between on and off then we have our presence sensor which is being detected from the io2 pin on the board whenever someone is in the room or detected this sensor will change to on and whenever they leave the room it will change to off give it a test and make sure everything is working as you would expect all that was left to do now was to design and 3d print a case for the setup which i'll leave down in the description and let's see how it actually works i was pretty blown away at not only how fast this sensor can actually make a detection much faster than the three to five seconds of the fp1 but also how little motion it can actually detect like i can literally slide a couple of fingers into a room and it will manage to pick them up and detect them i guess it's in the name right millimeter wave but still it's kind of crazy one of the things to note is that this will literally detect the movement from anything so for example if you have a fan spinning in a room it's going to detect that or your blinds or curtain move with the wind it will detect that or if you open a door it will detect that too it's not smart enough to only look for humans it will detect the movement of anything so yes it will detect the movement of pets i know that was a question that lots of you had from the fp1 video from my testing so far it's also really solid at continuing to detect presence for hours on end when placed somewhere like your living room and is easily able to detect really small movements that a regular motion sensor wouldn't be able to i also tried it in our bedroom and for the most part it works really well but i was able to get it to turn off if i held my breath or with very slight breathing i know that sounds kind of silly as you would never do that but it did result in some slight flapping overnight when we were asleep the akara fp1 does not suffer from this in my experience not sure if that's because it's a 60 gigahertz sensor compared to the 24 gigahertz of this sensor and it's able to detect even smaller movements or it may just be that i need to adjust the position of my sensor to be more optimal i could also adjust the latency to be a little bit higher and that would also probably fix it i mentioned earlier about the speed that was a big issue with the acara fp1 is that it takes around three to five seconds before it will recognize that you are actually in the room and then once it does it works really well but it does mean that it's not quick enough to use for motion lights so is this problem solved with this sensor well the df robot sensor can detect really quickly i would say on par with a regular motion sensor from my experience and testing so far and certainly much quicker than the fp1 i would still want to pair this with a regular pir motion sensor for turning on lights and then use this sensor for turning them off again however since this is a diy project there is no reason that you couldn't also add a pir motion sensor into one of these using the other pins on the wemos d1 mini and have both of these working in this one unit in fact i believe that crlogic has also been doing some research into this in one of his other threads on this subject which is pretty cool the funny thing is though the millimeter wave that comes from the sensor actually bounces off walls and through doors if the distance is set correctly quite a few times when i was testing this i would have to literally shut a door behind me to stop it detecting me when i was just outside of the room so that means that in theory if you dial in the distance correctly for your room you could have this trigger when you were walking towards a room and literally a feet or two away from it so that the light came on just before you got inside of the room which would really help to improve the detection and reaction speed even more than a regular motion sensor one downside it has when compared to the fp1 is that it can't detect the direction of the movement so if you remember i mentioned in the fp1 video that it can detect when you're walking towards it or away from the sensor or left or right whereas the df robot sensor is unable to do that it can only detect that there is some form of motion and not the direction finally what about price so the total cost for this thing was around 35 pounds 30 pounds for the sensor delivered and five pounds for the wemos obviously i already had a 3d printer and a soldering iron and all of that stuff to make this so your costs may vary a little bit there but for the parts themselves that it is quite a bit cheaper than the acara fp1 if you are willing to give it a go yourself and of course i'll have links to everything down in the description i suspect that you guys are going to snatch up all of the stock of these like you always do but it is available in quite a few different places and a few different retailers so hopefully they will be restocked really quickly all in all this is a pretty cool little sensor and i was surprised at how well it works and how fast it can actually detect the teeniest amount of motion df robot actually suggests that you could place this under your bed for a bed present sensor which is a pretty neat alternative to using something like a load cell solution and could open up some really cool possibilities for automations but what do you guys think about this sensor are you planning on picking one up for yourself for a diy project and what else would you like to see this sensor do or be used for do let me know down in the comments if you're looking for something else to watch check out this video over here where i show you how to make a super reliable diy bed presence sensor which is so good for automations make sure to drop this video a like and get subscribed and i will see you in the next video you
Info
Channel: Everything Smart Home
Views: 91,945
Rating: undefined out of 5
Keywords: home automation, home assistant, smart home, Aqara Sensor, Aqara FP1 sensor, home assistant aqara, smart home tech, smart home gadgets, room presence detection, smart home automation, Aqara room detection, home assistant room detection, home assistant room presence, mmwave sensor, dfrobot mmwave sensor, wemos d1 mini, home automation ideas, home assistant guide, esphome guide, home assistant automation, aqara room presence, room detection
Id: VEqWlOeJ2YA
Channel Id: undefined
Length: 13min 27sec (807 seconds)
Published: Tue May 31 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.