Tutorial - Multi-sensor setups for ESP32 & Home Assistant

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
this is a temperature and humidity sensor called a dht-11 and this is an upgraded version the shtc3 which basically does the same thing as a dht-11 except with better accuracy and a wider range of measurement but then there's also this one a BME 280. now this one throws in barometric pressure readings just in case you need to know what your altitude is and since we're all gathered here today let's not forget about the bme680 this root and tootin show off of a sensor does all of the above except it can also detect if the person right next to you has farted yeah it has a fart sensor kind of [Music] foreign [Music] to say that I am ill-equipped to test all of these sensors to their utmost performance and find out which one is the absolute best would be a complete understatement I mean I could hook them all up to see what the basic readings are but to be honest I don't really know which reading is correct sure hooking up multiple sensors and trying to find a common denominator is a great start but in the end that's still just doing an educated guess so that brings me to what I can do today which is give you an absolute basic understanding of the root differences show you how to wire them correctly to an esp32 and then face blast your eyeballs with the code you'll need to copy and paste into ESP home to get them to work correctly oh and yeah this tutorial works out the assumption that you understand very basic electronics that you're running home assistant and you're also using ESP home to install and configure esp32 which I know is a little niche but hey that's where I currently am in my learning curve of custom sensors so here we are alright so first up we have the dht-11 sensor now this little device is all about measuring temperature and humidity at an entry-level price option coming in at just one dollar and 20 cents per person makes this a perfect solution for some very basic applications now let's step things up a notch with the shtc3 similar to the dht11 it measures temperature and humidity but with enhanced accuracy and a broader measurement range this sensor runs off an i2c protocol and it's priced at three dollars and 20 cents each definitely recommended for some projects that might need some extra Precision but also still has a budget in mind next in line though is the BME 280. now this sensor brings more to the table by adding barometric pressure reads this is something that you would use to try to track altitude or maybe predict the weather change so if you're working on a project that requires more comprehensive data collection at 8.33 the BME 280 is a pretty good start but if you want to go a little bit deeper I introduce to you the BME 680. if you by any chance have a desire to build a fart sensor that may or may not scream wildly in the night fart detected every time someone farts then you may have to pay the premium price of 11.33 per sensor which isn't too bad considering you still get temperature humidity and barometric pressure readings from it so yeah all of these have the ability to give you temperature and humidity some just have a little better range and accuracy than others now if you want all of that plus the ability to monitor air quality with gas resistant measurements the BME 680 is the way to go ultimately though it depends on what your project requirements are and how much your budget is okay with all of that out of the way now I'm going to show you how to wire each sensor to your esp32 now three of these are using the i2c protocol so that means there are two data wires that need connecting from the sensors over to the esp32 this stands out a little bit because the dht-11 only requires a single data pin to be connected using the i2c protocol gives the advantage of being able to cram more sensors into a single device this is how we get things like the bme680 that has a temperature humidity barometric pressure and gas resistance sensors all tied into a tiny little thumb size PCB so let's start there take a look at the labels of the pens on the board two of these pins should have the labels SDA and scl which side note most likely the pins won't be soldered on so you might have to do that connect that SDA pin to the pin on your esp32 with the label of 22. after that connect the scl PIN to the pen on your esp32 labeled as 33. now the last two pins that we have to worry about here is the basic power and ground they should be labeled on your sensor for VCC as positive and G and D for ground because this project is so simple I'm just using a standard 5 volt USB adapter to power the esp32 this means that connecting the sensor's positive and negative pins are very easy simply connect that positive pen to the one on the esp32 labeled as 3.3 volt and then of course the negative to that negative pin right next to it labeled as G and D in total you should have four pins connected from the sensor over to the esp32 unless of course you're using a different type of power source and that stays the same even if you have a sensor like the BME 680 which actually has additional pins but those do different things and we're not going to worry about them right now if we go back to the basic sensor now the dht-11 it only calls for a single pen for data so in this example we can connect that PIN to the pin on the esp32 labeled as 22. and then of course connect the positive and the negative power to the esp32 3.3 volt and ground labels just like we do with the other sensors now that the sensor of your choosing is connected plug your esp32 into the computer that's actually running home assistant go through that quick process of setting up a new device through ESP home and when all that is finished click on that edit button in the ESP home script from here underneath all your basic settings like your Wi-Fi and your API key stuff like that it's just a matter of copying and pasting the code that I have in the description of this video down below to make things as simple as possible each piece of code is for each specific sensor so if you are running the bme680 make sure you get the right code if by any chance you're trying to wire more than one sensor or you have decided to use different pins on the sp-32 you will need to make the appropriate edits to your code to accommodate your changes and a little side note for the code that I have for the bme680 I did include a little bit of flare these are very basic changes I made that help simplify the output of the sensors and are not directly required for core functionality okay assuming you got this far everything's configured through ES SP home the last thing you're going to need to do is import these newly discovered ESP home sensors into home assistant doing so of course will allow you to view the sensor values create your own dashboards and even start to create automations and that's really pretty much it we've covered the basics of the sensors showing you how to wire them up and then provided you with the code needed to make them work seamlessly with home assistant past that it's up to you to decide what kind of project you want to create first before you go though I ask you do you want a challenge if so check out my last ESP home tutorial that covers how to control the speed of a pwm computer fan remotely using this very same esp32 do you think that you can combine these two tutorials to make a functional automatic fan that uses temperature to control the speed let me know what you think about that in the comments section down below well guys as always if you have any questions or comments let me know thank you for watching like And subscribe and have yourself a great day
Info
Channel: Byte My Bits
Views: 35,846
Rating: undefined out of 5
Keywords: home assistant, esphome, bme680, bme280, shtc3, dht, dht11, dht22, esp32, diy sensor, temperature, air pressure, humidity, gas resistance, gas sensor, setup, walkthrough
Id: M3YetBHXsaU
Channel Id: undefined
Length: 7min 19sec (439 seconds)
Published: Wed Aug 09 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.