Is your air healthy? Measure air quality using Nova SDS011, ESPHome, and Home Assistant.

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
today we're going to talk about the sds-011 particulate sensor that is used to measure air quality we're going to install this along with an esp8266 using esp home and get that all configured into home assistant we'll also even put together a grafana graph showing the trending of the air quality so let's jump over to the bench and let's get started [Music] before getting started with the actual construction or putting together of the device with the esp8266 i want to talk about a couple of specifications on the device and some details this is a pm 2.5 sensor it's a product models sds-01 a device that uses a laser scattering and gets particle concentrations between 0.3 to 10 micrometers and it has a digital output has a built-in fan uh it has a response time of less than 10 seconds it has easy integration using uart and we'll be using the uart bus on the esp8266 for this and has a high resolution this uses a laser light brings particles in and measures them via a laser light inside the device and one of the important things to think about when you're talking about particulate sensors is the service life it's a key parameter of a laser type dust sensor the diode in this sensor has a high quality its service life is up to eight thousand hours so if you need real-time data uh you can use it the default configuration that measures it every uh every second so we're not going to measure every second we don't need that kind of granularity for what i'm doing so we're gonna measure once every five minutes and by doing once every five minutes it prolongs the life of the device so the first thing we're going to do is we're going to go ahead and program the 8266 board with the proper of settings so that we can measure with this device let's get over to esp home in home assistant and we'll take care of that now okay so what we need to do first is we need to go into esp home and i already have this set up on my home assistant instance you need to make sure that you have esp home installed and running and if you've watched other videos you see that i have other stuff already going here i already created an air sensor configuration so i'm going to show you how the configuration looks here and then we'll flash it over to the esp8266 so clicking on edit we'll go through some of the settings here uh obviously uh the name is what you give it here air sensor uh platform esp8266 and when you first install this let me show you here uh when you first install this there's a little button down here and you click on add you'll name it you'll do your wi-fi ss id and wi-fi password and it creates this initial configuration file for you so we're going to go back into this and look at that now and that's where it sets the name and the platform and the board now the board name i changed because i needed the pin out to be correct uh it defaults to a different type of board than what i have i have the the mini or the d1 mini and so i had to put the d1 mini board as a specific specification here uh the other thing to think about or consider here is since you're using uart you're gonna want to use uh set the logger baud rate to zero so it's not sending out the logger information over the serial port on the same port that you're sending out your uart data from the sensor so make sure you uh set baud rate zero here it already has an entry for logger it just doesn't have this baud rate zero specification then you'll do your wi-fi ssid and password which you can configure in the wizard like i just showed you i use a secrets file and if you come up here uh with this closed and look at the secrets file this is where you can put all your secrets for stuff inside these configuration files this is not the same secrets file that home assistant has this is a secrets file specific to esp home this is the part where you need to specify what you're going to set up here now if you look at the particular information under esp home this is all the information you need now this is the data sheet and this is what i showed you earlier it's got all the information in here that you need if you want to learn how all of this works uh with that sensor the sizes uh the inlet salad fans all of the stuff that you use specifically to this or specifically for the sensor but we're concerned with the configuration here in esp home and so this is already set up for you with some some changes that i made so this is an example configuration entry and the changes i made is essentially i just copied this and i pasted it over here in my configuration file with with some changes you can rename the name of the sensor if you want to i left it as the default particulate matter less than 2.5 in particular matter less than 10 concentration the update interval is set to 5 minutes that's important if you want to prolong the life of the device if you don't specify this then what will happen is it will send you updates every second and i don't think necessarily you need that or want that the other thing i changed was the uart pin for this device the d1 mini has a number of pins here and the receive pin and the transmit pin are specified in order for it to be able to control the refresh or the update interval if you read through the documentation here it says the update interval the working period of the sd 11 will be changed if update interval is equal to zero minutes the sda11 will be set to continuous measure and will report new measurement measurement values approximately every second if you set it between 1 and 30 minutes it periodically turns on for 30 seconds before each measurement and then it shuts off for the remaining amount of time this can reduce power consumption and increases the lifetime of the sds 11. that's the other thing i didn't mention is it also reduces your power consumption overall now if we look up here the communication is done over uart so you have to have the uart bus in your configuration which is what we have specified here you have the receive pin connected to transmit pin of the sds-011 and optionally the transmit pin connected to the receive pin you need to set the bot rate to 9600 now you need both of these pins because what you need to be able to do is you need to be able to tell the device to turn on or off if you don't have this the update interval is not going to do anything so make sure you have receive and transmit specified in your configuration here so that it can control the device and turn it on or off and get those measurements and prolong the life of your device here's another note the configuration variable update interval reconfigures the sds-011 device the setting is still effective after power off this can affect the performance of other libraries the factory default is continuous measurement so just keep in mind if you're doing other stuff on this same device it may be affected by the update interval it may be worth your while just to use a dedicated esp board for this measurement so you can set this and not affect other libraries on the board okay so once you have this all set up then you can save it over here on the right i'll click on save close this and then over here under validate you would want to validate it again and it'll come through and tell you that everything is valid and gives you a green check mark and then you can just install it from here now i've already got it installed on the device and it and i've had it up and running for a little bit just to make sure the sensor works so what we're going to do now is we're going to go on over to the soldering iron and we're going to wire it up it's super simple and then we're going to get it up and running in home assistant once it's wired and after that we will show you a little bit of the measurements and show you some grafana graphs that i have built or agrophonograph that i've built with so over to the soldering soldering iron and let's get started on that this particular matter sensor comes with a couple of cables you can see this one here and it comes with another cable they the difference is that they have different ends on them here and they probably see that a little bit better here you can see that these cables have different types of ends on them this one is a female end and there's another cable that comes with it that actually has the the male ends but because it has the female ends on it what i'm going to do is i'm going to take this right here and i must solder this on the board everything we need is on one side so i'm going to solder it on this side of the board which means i need to flip it over and that way we have the ability just to plug it in without having to do any extra stuff with it so the way i'm going to do this is i'm going to get this thing down as far to the ground as i get it and then i can just set this in the connector and make sure it's even see if i can get that started in there just set it down on here it's where you need three or four hands get it to sit down there like that and then i can get it started and then i can come back and add in um get to stay there we're going to just get get these started and then make some adjustments if we need to so hold that there and use three or four hands to hold this in place and just want to touch the solder on there not too much you want to burn the the pads so i'm going to get that one started and i'm going to do this one on this other side and that way we can just hold it in place with the two soldering pads and i can go through and touch the rest of them up so that one looks good there and we'll just kind of touch touch it in here actually yep that went okay that one looks okay just put a little bit of solder on it on each of these pins i really see that one a little flux one on that one do this one again and everything we need is just on this this one side of the board receive uh and transmit and then we also need the um the ground and the five volts the the power for the particulate sensor is actually going to come from the 5 volt plug on this board let's get those all soldered in like like so my helping hands keeps moving it's supposed to be in one spot but it moves and one final one all right let me just get this one again it doesn't look like it has enough solder on it okay so we have all of our soldering done that makes it super simple to be able to solder this in place let's look here and see what it looks like take it off of here all right so we have our solder for all our pins uh on here a couple of those could look like they could use a little bit more solder let me go ahead and hit the d2 and d1 uh and even the five volts so let me just touch those up again it's a problem when you get old like me you have problems with seeing stuff with your glasses off or on as the case may be let me just tap a little bit more solder onto these and make sure that they're nice and covered with solder and i turned off the soldering iron there we go so just give it a little bit more what i'm trying to do is prevent actually damaging the board by getting it too hot so i'm just really just barely touching these to make sure they have a little bit of solder on there all right that looks a lot better than it did a minute ago all right let's take it off and take a look okay so we have all of those soldered on there they look nice and so what we have now is we have this this uh header board here or this board i guess it's called a header and all we have to do is then take the cables and i misspoke a minute ago these are this is a female board they actually with these esp8266 that i bought you can actually solder on uh the mailboard or the the mail header and then you could just plug stuff in directly the good news is this device actually came with two different kinds of cables and so we actually have uh a a male terminated cable here that we can just plug into here so we want receive and transmit and we'll look at the back side of this board here let's go ahead and plug this in you can see that this is keyed here so it only fits one way so we'll just plug it in this way and snap it in so it's nice and snapped in there and on the back side of this uh it comes noted with the pin out and because it does you don't need to do a lot of extra uh just figuring out where things go so we want transmit which is this blue one we want receive which is this green one so this is our these are our two data lines it was untangled there and then we also want ground so ground is the black one that makes sense because typically brown is black is ground and then we want our five volts so our five volts is this red one right here and so we're going to use that one right here now the rest of these have other purposes outside of our application today so we're not going to use those we just need these these right here now remember when you hook this up you need to invert resi transmit and receive because you're transmitting from this board and receiving on this board so you would have transmit out here i could focus transmit out on this one and then you would have over on this board right here so let's find the receive because i'll take the transmit out of the sensor and i'll plug the receive in here so this second pin is received so i'll go ahead and plug it in here and then of course green is trans are received from the the sensor and transmit from this board so i'll plug that one in here then we have our ground let's find ground on this esp board ground on the esp board is this second pin right here from the what is my left here you focus on it there we go there's ground and right next to it's the five volt pin so you've got ground and you've got five volts on there and so we're going to use both of those here we've got ground going here and then our red here is our five volts we'll plug that in so here we have uh three pins are not used and we can just kind of tuck these away you probably want to terminate these or cover them up so they don't get shorted out or anything i'll just kind of tuck them away like this for now so we can see what we're doing so here we have on the back side of this board we have our transfer receive 5 volts and ground connected to our transmit receive and 5 volts and ground on our esp8266 so now the next step is to go ahead and plug in this 8266 i'll assume that you already have it programmed you already sent the the information configuration that i showed you a little bit ago into the esp8266 and with that we'll go ahead and get um we'll go ahead and get this set up in uh yes and esp or in a home assistant and with that uh we'll start getting some measurements next step is to plug this into a power source i'm assuming again you have wi-fi hooked up and the wi-fi is what you're going to talk to you don't actually need to plug it into the pc that you're using all you need is power now and by powering it it should start sending data out at that five minute interval now i don't think it sends the first packet out until five minutes so you're going to have to wait a few minutes for it to actually do something once you power it back up so i'm going to get it powered up and then we'll jump over into esp home i'll show you one final step you need to do with the integration part of it because it's got to be detected first and then after that you should start seeing data come from the device all right jumping back into home assistant here if the air sensor or your new device whatever you called it is on and operating correctly and on your network it should be shown here and you can see that it's clear if it's red that means it's offline if it's blue or says update available it's on but it just needs an update in this case we have the latest update it looks like and we're ready to go with this so you can look at the logs to start off with and make sure it's doing what it's supposed to you want to connect wirelessly if that's how you've got it connected it'll take a second here to show you the logs and you what you're looking for is to make sure that it sees these uh sensors here so it's got a particular matter sensor uh for both the 2.5 and the 10.0 and again the the update frequency or update interval you set will determine when it sees the updates so sitting here you see uh there are no updates yet because mine is set to five minutes it will take up to five minutes for my first particular sensor uh reading to show up now what you can do while you're waiting uh for this to send its first update in fact what you need to do is you need to make sure that it's showing as an integration and home assistant typically it will get discovered as an integration and so you'll see a notification like this over here it'll say new devices discovered click on check it out and you'll see here that it's discovered the air sensor for esp home you can click on configure it'll ask you if you want to add the esp home node air sensor to home assistant you say submit you can give it an area or not and then you'll see here it should show up in your list and where we have air sensor now we have one device two entities those two entities are particular matter sensor 10 and particular matter sensor 2.5 so let's go back over to my production home assistant and we'll look at the developer tools developer tools is always a good place to see if your sensors are showing up here so what i want to search for is particular particulate sensor and see if i have anything here so i do i have a particulate matter sensor concentration of 58.6 which is pretty high actually and a particular matter uh 2 2.5 concentration of 21.1 now these were done oh you know what it is so i was soldering in here plus i have the door closed and it is automatically registering a higher concentration of matter than when i was looking at it earlier and i can tell you that by looking at my agriphonograph so now let's go over to grafana and let's see what we can do with this i already have created a grafana graph and i'll show you how i've how i went through and did that here so under environment you can see here already i have the particular matter running and i have had it running for a little bit but to create a graph like this one all we need to do is go into and add a panel add an empty panel and what you're looking for is you're looking for an entity id you can select the measurement first if you know what it is i didn't know what kind of measurement it was storing this under or how to search for that so i went for the entity id first so i'll look for entity id let me drag this down a little bit and i'll select the tag value and i'll search for particulate matter and we have both our 10.0 and our 2.5 here let me click on 2.5 and then you have to select the measurement over here it knows the entity id but it doesn't know what measurement to use for that entity id and this is where it gives you the the proper choice and you'll start to see your updates here if you've got the right kind of query set up here and then you can do a lot of stuff where you're setting different values and things here let me shrink this a little bit for you and then we can add our our 10 uh 10.0 concentration as well so same exact process entity id and i want to look for particulate matter and that's the 10 and my measurement is going to be in the same measurement uh or same type of measurement and i'm going to give it a a an alias because we need to know which one one's which so this is a 10.0 concentration or 10 concentration this is a 2 5 concentration so we have those here now you can see 2 5 and 10 0 here what i like to do on this is i want to go over here to the right hand side and i want to have a legend and i want to choose the value of the legend so last non-null value so i can see what it is here and i also like to have my null values connected so instead of having these dots i like to have a nice complete graph and this is what happens when you set that you can do all these settings these are all personal preference settings on how you want it to look if you want to look up what your what the value is for um healthy uh measurements for these things you can come down to the to the bottom here you can actually add these thresholds and i think 35 or something might be a value so if it gets above 35 and then i turn on the thresholds as lines i have gone above the healthy threshold for this value here now the thresholds differ between 10 and 2.5 concentration particle sizes so you'll have to play around and either create a different graph or not use this but anyway it's a reference point gives you an idea you know what kind of what kind of level you're getting in at what point it becomes unhealthy so this is very interesting that it shows basically me soldering in this room with the door closed with not a lot of ventilation and spiking these values and then of course when you're done with all this you just click on apply or save and save the dashboard and this gives you your your dashboard so we have a particulate sensor now measuring our air quality within the house here we have added it to esp8266 we have also um set our refresh interval to save or update interval to save uh the lifetime of the sensor or extend the lifetime of the sensor and now we've done a little bit of grafana work so i hope that was helpful to you if you have any questions put those down in the comments below hit me up on discord and we'll see on the next video [Music] you
Info
Channel: mostlychris
Views: 2,068
Rating: undefined out of 5
Keywords: Smart Home, Home Assistant, air quality monitor, pm2.5 sensor, pm2.5 and pm10 sensor, nova pm sensor sds011, sds011, sds11, sds001, particulate sensor, particulate, air quality detector, air quality meter, air quality
Id: kf-g4oc2wdE
Channel Id: undefined
Length: 23min 45sec (1425 seconds)
Published: Sun Dec 05 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.