Super useful sensor you've never heard of! (Probably)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
alright guys welcome back - it kind of works and today we have a really cool little sensor here now I've been sitting on this for just a little while and what this is is it's an air quality dust sensor and so that sounds kind of boring but actually it's really useful so if you live in a city or you're taking care of elderly people or anything like that where air quality matters this is a really useful thing to have and what's even cooler it's really easy to hook up so basically the way that this sensor works is inside of this little metal box we have a LED and we have a sensor so what we do is we shine the LED and this little circle here is hollow so air can freely pass through it we've shined the LED through this little hollow area where air can pass through and on the other side or maybe there's a mirror in there there's a sensor that lets us pick up how much light is reflected and how much light passes straight through so that's basically how this works and it's really easy to set up the code is really easy so this should really be a fun short little video for you guys here today yes so now that we have sort of a little introduction here let's get it wired up and take a look at the code and then we'll get to see what the air quality is like in my basement alright guys so to wire this up it conveniently comes with this little connector here with broken out little hookup wires so we plug that in and this sensor will run from 3.3 volts or maybe even down to 2.7 or something like that all the way up to 5 volts now today I'm going to use a wii most d1 mini to control this sensor and read it so this runs on 3.3 volts which means we need this to run on 3.3 volts so you might think that you can just plug power and ground into the 3.3 volt and ground pin on here and while that should work for some reason when I'm trying to do it or when I've tried to do it it kills the power on here maybe the regulator isn't powerful enough to run the ESP and this in theory this should only draw 20 milliamps so I'm not sure why that doesn't work but whatever the case may be we're going to have to have some kind of something in between so what I have for that is this little regulator that I built here and this is using an HT 7 3 3 3 regulator and a big capacitor because I just had this already put together if you're curious about this I do have a nice little video talking about how to build these little regulators with couple of capacitors and everything now you might wonder well if this can run on 5 volts why not just power it off of the 5 volt rail to begin with the reason for that is the ESP here that we must do on many the analog input pin only tolerates 3.3 volts so if we power this with 5 volts our analog output will go up to 5 volts which will not be good for our module here so that's why we have the regulator so the way that we wire this up let's start with the regulator to the ESP we're going to run 5 volts into the center line and then the left little line here this will be ground so on the arm on my ESP I'll plug that into 5 volts and then into ground just like that so there's power to the regulator now I'm here red and black are power and ground so we will plug power into the right side there so that's the regulated output and then ground black will go to the ground pin that connects to the ESP so there we go we got power all wired up and now we have you'll notice two more wires left so this sensor is not quite straight forward in just reading the analog output remember there's a little LED in here so when this is running we've at least shouldn't I don't know if it's impossible but you shouldn't run that led continuously and just take readings so there's a separate pin broken out on here it is called a LED and it is this yellow wire and this yellow wire we're going to just connect straight up to d1 digital at input output 1 which leaves us one last wire which is the blue wire and the blue wire is our analog output so we will put that on a zero and there we go now clearly it's not the most pretty wiring job here but it is pretty simple at least so now that we have this wired up let's go and take a look at the code and then we'll be able to see the air quality in here all right guys so here's the code and it's only really about 80 lines of code including the comments so honestly this time it actually is pretty short so up at the top we have a couple of libraries we're including of course we're using ESP helper and Metro you guys know I love that and then we have this wave share sharp dust sensor dot H that is the library that I found that lets us basically take readings and modify the data into usable particle counts which is pretty cool so I will note this is not my library however I did have to modify it a little bit in order to make it usable on the ESP basically I changed it to assume 3.3 volts instead of 5 volts so I will include a link to this library from my github repository but just know I didn't write it I give full credit to whoever did write it so coming down we have a couple macros for time I loved of those little macros there makes you know timing things out a lot easier and then we have ESP helper setup so you guys have seen this you know what that's all about and coming down into some of the other variables here we have a topic that we're gonna post to so I'm posting to slash home slash dust though you can change that to be whatever you want here are our pin definitions so again the LED is going to be on d1 and the input pin is a zero and then we create an instance of the wave share sensor and create a timer basically I want to post two mqtt once every 10 seconds so this timer will just make that easy coming down to setup we start the serial line I always find that useful for debugging wait a little bit and then setup our pins and print out that we're starting up while ESP helper it starts up and gets connected to everything and print out when we're finished pretty simple so far right guys alright in loop we have basically have one if statement and everything happens in there so if we're connected to Wi-Fi and MQTT it's a little bit pointless for us to take readings if we're not connected to anything where we can share that data and the timer has gone off so again once every 10 seconds we're going to start the process of taking a reading to take a reading what we do is we turn on that little LED inside of the sensor wait a little bit of time so specifically 280 microseconds take a analog digital reading and then turn off the LED so that's the process for taking a reading coming down here these are the two lines that really kind of configure that data into something useful so we take our analog value that we read and we run run it through a little filtering algorithm that's part of that library and then in order to get the density which is in micro grams per meter cubed we run this little conversion function here and that just will give us our density so then we just print that out to the serial line again always nice to have some debugging and post it to MQTT so honestly that that's all this is it's a really nice short program and you guys can modify it in you know put it into your own projects I've tried to kind of scale it back to be nice and simple for you guys all right so now that we've seen how that all works let's check it out and see it running in real time so right before we check out the sensor in action you might have noticed some cool tracking shots at the start of this video for the past couple weeks I've been working on a project to make a desktop dolly for shots like those and for time-lapse and builds for larger projects and stuff like that the reason I bring this up is because of document and quite a bit of my process in building that dolly and I'm going to be posting it as behind the scenes project for my patreon supporters if you'd like to see that build and other behind-the-scenes stuff from it kinda works definitely go and check out the icon works patreon page at patreon.com slash it kind of works all right now let's get back to this cool little sensor all right so here you can see I've got the sensor all powered up and on the computer there you can see the real-time graphing data every 10 seconds and you will note that I do have the unit set up to be micrograms per meter squared so you can actually see you'll note that it kind of has this climb at the beginning I'm not entirely sure why maybe the sensor needs to warm up or something but it always starts out low and then climbs to a fairly steady state value just a weird low quirk of the sensor and we can see it's at about a hundred and twenty which according to the sensors datasheet not very good air quality but not arrabal down here in the basement and as a test of this sensor what I have is a little piece of cardboard here and I'm gonna light that up and then blow it out and just can't right ooh get smoke over to the sensor and we'll see if we get any surprising changes in the graph all right so I got a little flame on there let that burn for a moment and now try to get that smoke as close as we can to going inside of the sensor oh wow look at that that is a nice big spike and change in the sensors readings so that's really cool we can see in real time the air quality in the basement here changed just from a little bit of smoke coming off of this cardboard that's really cool so anyway guys this is a really cool little sensor and I hope to maybe install this maybe a couple of these around the house just because you know I I was looking earlier and upstairs is not nearly as bad as down here is somewhere in the 60s to 70s and I think it's really cool so if you guys liked this video definitely get subscribed to the channel and if you need any help with the sensor or anything else go to it kinda works comm slash forum alright guys thanks for watching I'll see you all later
Info
Channel: ItKindaWorks
Views: 32,571
Rating: undefined out of 5
Keywords: Arduino, ESP8266, ESP-01, ESP-12, ESP-07, NodeMCU, Wemos D1 Mini, Programming, Software, DIY, Weekend Project, tutorial, IoT, internet of things, home automation, dust, sensor, hardware, beginner, sharp, IOS, homekit, waveshare, GP2Y1010AU0F, air quality, smog, smoke, smoke sensor, home improvement, home monitoring, quality of life
Id: qmbKK4IUYNc
Channel Id: undefined
Length: 12min 33sec (753 seconds)
Published: Thu Jul 19 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.