TubeSum

8 Essential Smart Home Sensors — Full Breakdown & Transcript

DIY Guide: 8 Essential Sensors to Give Your Smart Home Superpowers

0h 23m video Published Jun 30, 2024 Transcribed Jul 28, 2026 Hands On Katie Hands On Katie
Beginner 11 min read For: DIY enthusiasts and smart home beginners with basic familiarity with Home Assistant and an interest in microcontrollers.
AI Trust Score 90/100
✅ Highly Legit

"The title accurately promises a guide to eight sensors for smart home superpowers, and the video delivers exactly that."

AI Summary

This video provides a comprehensive introduction to integrating eight essential sensors with an ESP32 microcontroller and Home Assistant using ESPHome, enabling users to create a highly customizable smart home system. The presenter emphasizes the accessibility and low cost of these components, guiding viewers through the setup process and demonstrating how to wire and code each sensor.

[00:32]
Introduction to Superhero Senses for Smart Homes

The video introduces powerful, cheap components that give users 'superhero powers' to control heat, motion, light, sound, air, moisture, and more in their homes.

[01:36]
Accessibility of Components

The presenter stresses how accessible these components are, noting that knowing the component name (e.g., BME 280) makes it easy to find guides and tutorials online.

[02:17]
Prerequisites: Home Assistant and ESP32

Assumes the viewer has Home Assistant set up and an ESP32 chip with at least one sensor. Recommends watching other videos for Home Assistant setup.

[03:02]
Getting the ESP Chip Running

First step is plugging in the ESP32. The chip is Wi-Fi and Bluetooth enabled, with ultra-low power consumption, making it suitable for standalone devices anywhere with a USB port.

[04:06]
Installing ESPHome

ESPHome is installed as an add-on to Home Assistant via a provided link. It serves as a central hub for managing ESP chips, enabling over-the-air updates and code management.

[05:00]
Connecting ESP32 to ESPHome

Using a USB cable, the user connects the ESP32 to the computer and follows steps in ESPHome to install the initial OS, which automatically connects the device to Wi-Fi and Home Assistant.

[06:09]
Temperature Sensor: DHT22

The DHT22 is a simple temperature and humidity sensor with three pins (power, ground, data). Wiring involves connecting these to the ESP32, and coding in ESPHome requires specifying the platform, pin, and model.

[07:38]
Coding the Sensor in ESPHome

Code example for DHT22: define sensor, platform (DHT), pin (GPIO23), model (DHT22), and sensor values (temperature, humidity) with an update interval. The code is minimal and easy.

[09:54]
Viewing Sensor Data in Home Assistant

After installation, the sensor appears under Integrations in Home Assistant, showing live values. A dashboard graph can be created to track temperature and humidity over time.

[10:32]
Sensor Recommendations

The DHT22 is cheap but has limited accuracy. For better accuracy, recommend BME 280 or BME 680. The choice depends on the use case and budget.

[11:14]
Motion Sensor: HC-SR04

The HC-SR04 ultrasonic sensor measures distance using ultrasonic waves. Wiring is simple, and coding involves trigger and echo pins. Update interval should be adjusted based on use case (slow for room occupancy, fast for hands-free control).

[12:34]
LD2410 mmWave Sensor

The LD2410 mmWave sensor offers sub-millimeter sensitivity, detecting even breathing. It's suitable for presence detection with high precision.

[13:04]
Light Sensor: BH1750

The BH1750 detects light levels. Coding is similar to previous sensors, with an optional address parameter (default 0x23, alternative 0x5C).

[13:58]
Advanced Light Sensor: APDS9960

The APDS9960 recognizes colors, allowing different actions based on room color. It's a more advanced option.

[14:10]
Sound Sensor: KY038

The KY038 measures sound levels. Coding includes an attenuation variable (11 dB for 3.3V input) and filters to smooth out noise readings for a general noise level.

[15:44]
Air Particulate Sensor: HM3301

The HM3301 detects PM1, 2.5, and 10 particles using a fan. Wiring and coding are simple, useful for monitoring dust levels and air quality.

[16:40]
Soil Moisture Sensor: Capacitive

Capacitive soil moisture sensors measure moisture without corrosion. Coding requires calibration values for wet and dry, and a median filter to reduce noise.

[18:33]
Combined Sensor: BParasite

The BParasite is an open-source sensor that monitors moisture, temperature, humidity, and light, powered by a battery lasting years. Ideal for garden monitoring.

[19:14]
Load Sensor: HX711

The HX711 load sensor measures weight. Calibration requires a precise weight to set the scale factor. Useful for monitoring coffee beans, detecting pressure on mats, etc.

[20:00]
Capacitive Touch Sensor: MPR121

The MPR121 detects touch through materials, allowing creation of touch-sensitive buttons or surfaces.

[20:26]
Combining Sensors and Pre-built Solutions

Multiple sensors can be combined into all-in-one units. Companies like Apollo Automation offer pre-built solutions with multiple sensors.

[20:50]
Three Troubleshooting Tips

1) Connect directly to the device running ESPHome if struggling. 2) Check USB cable (use a cable tester). 3) Look at the data sheet for your exact microcontroller and sensor.

The video successfully demystifies the process of adding various sensors to a smart home using ESP32 and ESPHome, empowering viewers to create custom automation solutions. With the knowledge of these eight sensors, users can monitor and control their environment in ways previously reserved for expensive commercial systems.

Mentioned in this Video

Tutorial Checklist

1 03:02 Plug in the ESP32 chip to power it up.
2 04:06 Install ESPHome as an add-on to Home Assistant by visiting the provided link and following instructions.
3 05:00 Connect the ESP32 via USB and use ESPHome's 'Add Device' to install the initial OS, naming the device and connecting to Wi-Fi.
4 06:09 Wire the DHT22 sensor: connect power to 3.3V, ground to GND, and data to a GPIO pin (e.g., GPIO23).
5 08:13 In ESPHome, add sensor code: define platform as DHT, pin as GPIO23, model as DHT22, and add temperature and humidity sensors with an update interval.
6 09:29 Click 'Install' to compile and upload the code to the ESP32 over USB or over the air.
7 09:54 In Home Assistant, verify the sensor appears under Integrations and create a dashboard graph to display data.
8 11:14 For motion sensor HC-SR04: wire VCC to 5V, GND to GND, Trig to a GPIO pin, Echo to another GPIO pin. Code with trigger_pin and echo_pin.
9 13:04 For light sensor BH1750: wire VCC to 3.3V, GND to GND, SDA to GPIO21, SCL to GPIO22. Code with platform bh1750 and address if needed.
10 14:10 For sound sensor KY038: wire VCC to 3.3V, GND to GND, A0 to an ADC pin. Code with platform adc, pin, and attenuation: 11dB.
11 15:44 For air particulate sensor HM3301: wire VCC to 5V, GND to GND, SDA to GPIO21, SCL to GPIO22. Code with platform hm3301.
12 16:40 For soil moisture sensor: wire VCC to 3.3V, GND to GND, OUT to an ADC pin. Code with platform adc, and add calibration filters for dry and wet values.
13 19:14 For load sensor HX711: wire VCC to 5V, GND to GND, DT to GPIO, SCK to GPIO. Code with platform hx711 and calibrate using a known weight.
14 20:00 For capacitive touch sensor MPR121: wire VCC to 3.3V, GND to GND, SDA to GPIO21, SCL to GPIO22. Code with platform mpr121.

Study Flashcards (14)

What is the first step to get an ESP32 chip running?

easy Click to reveal answer

Plug it in.

03:02

What is ESPHome and what does it do?

medium Click to reveal answer

ESPHome is an add-on to Home Assistant that serves as a central hub for managing ESP chips, enabling over-the-air updates, code management, and debugging.

04:06

What are the three pins of a DHT22 sensor?

easy Click to reveal answer

Power, ground, and data.

06:51

What is the recommended temperature sensor for higher accuracy?

easy Click to reveal answer

BME 280 or BME 680.

10:45

How does the HC-SR04 motion sensor work?

medium Click to reveal answer

It sends out ultrasonic waves and measures the response times to detect distance.

11:28

What is the sensitivity of the LD2410 mmWave sensor?

medium Click to reveal answer

Sub-millimeter, capable of detecting even breathing.

12:34

What is the default I2C address for the BH1750 light sensor?

medium Click to reveal answer

0x23 (alternative 0x5C).

13:29

What attenuation value is needed for the KY038 sound sensor with a 3.3V input?

hard Click to reveal answer

11 dB.

14:42

What does the HM3301 air particulate sensor detect?

medium Click to reveal answer

PM1, 2.5, and 10 particles.

15:58

Why are capacitive soil moisture sensors preferred over resistive types?

medium Click to reveal answer

They are less prone to corrosion.

17:06

What is the BParasite sensor capable of?

hard Click to reveal answer

It monitors moisture, temperature, humidity, and light levels, powered by a battery that can last for years.

18:45

What is the first troubleshooting tip if a sensor isn't working?

easy Click to reveal answer

Connect directly to the device running ESPHome to eliminate network issues.

21:04

What is the second troubleshooting tip?

easy Click to reveal answer

Check your USB cable; use a cable tester to verify it's a data cable.

21:18

What is the third troubleshooting tip?

medium Click to reveal answer

Look at the data sheet for your exact microcontroller and sensor to check for changes in pinouts or specifications.

21:44

💡 Key Takeaways

💡

Accessibility of Components

Highlights how knowing the component name is half the battle, making it easy to find resources online.

01:36
🔧

ESPHome Simplifies Management

ESPHome centralizes management of multiple ESP devices, enabling over-the-air updates and easy code deployment.

04:06
🔧

Minimal Coding Required

ESPHome handles complex tasks like Wi-Fi and encryption, allowing users to focus on simple sensor code.

08:13
⚖️

Cost vs. Accuracy Trade-off

Demonstrates that cheap sensors like DHT22 are adequate for general use, but better sensors exist for higher accuracy.

10:32
🔧

Three Troubleshooting Tips

Provides practical, common-sense solutions to frequent issues, saving users time and frustration.

20:50

[00:00] If you had one superhero sense, what would it be? Now Superman can shoot lasers out of his eyes. But can he turn on your lighting automatically?

[00:15] Dr. Horrible can create a freeze ray and turn things to ice. But can he control his thermostats using Wi-Fi microcontrollers? And I'd say something about Deadpool, but he's a Welshman, so he's perfect.

[00:32] This video is designed to introduce you to some unbelievably powerful yet super-cheap components that you can master to give you superhero powers.

[00:45] If you want the powers of heat, motion, light, sound, air, moisture, road and much more, then you really need to watch this.

[01:10] I want to give you a short, sharp introduction to all of these senses so that you get that tingle of excitement of what you could accuse. I'm not going to be overly laborious,

[01:23] and this isn't meant to be a spoon-feed tutorial for each. Because there's masses of tutorials and guides already out there on all of these. These components are constantly getting upgraded.

[01:36] So what I want to do is give you a sense of how accessible this stuff is now. I want to give you the component names to then Google. This is actually half a secret. Once you know that such a thing exists,

[01:50] as a temperature sensor, and it's called a BME 280, where are you, my little lovely, then it's actually pretty easy to just Google BME 280 and get a detailed guide and videos on how to do everything

[02:05] on whichever chip that you're using. I'll start off fairly slowly to talk you through the process, and by the end, I'll just be flying through at a high level, and by then you'll be able to think for yourself.

[02:17] I'll assume a few things. One, that you have home assistant set up. If you don't know what this is, then watch my other videos. You really need to get it set up.

[02:29] Secondly, you should have an ESP32 chip and at least one of these sensors, because, well, that's what this whole video is about. Other than that, you just need to pay attention. Quiet down there at the back.

[02:46] Now, there are many variations of ESP42 chips. Some have cameras, others have LED screens on them, and you can use these when you get a bit more experienced, but I'm going to use a basic one to keep things simple.

[03:02] Let's start by getting the ESP chip running. Two things. First, plug it in. That's it. You've completed the first step. I'm being flippant but I want to stress throughout this how easy this stuff has become.

[03:17] This little chip is packed with useful components. It's Wi-Fi enabled, Bluetooth enabled, ultra-low power consumption and it has a surprisingly nifty little processor. What this means is that you've just created a standalone device that you can put anywhere

[03:34] in your home. If you think what room you have a plug or USB socket in, well, it's kind of everywhere, isn't it? And even if you wanted to attach a battery or solar panel, then the ultra-low power consumption makes these very effective and they can last a long time.

[03:51] So what we have now is a little microcontroller that's running happily away, but it's doing nothing. The rough equivalent of a PC that you've built and turned on, but there's no operating system. So the next step is to install ESP Home.

[04:06] This again is super simple. Visit this page. I've put this link in the description as well. Then click ESPHome and follow the simple instructions. This installs ESPHome as an add-on to Home Assistant.

[04:20] This is a central hub for all your ESP chips. It doesn't just handle installing code the first time, but it enables Wi-Fi connections which then allow over-the-air updates.

[04:33] So, you can have 20 devices in your house, and if you change some of the code, you can just click to install instantly to them all. You can also write code and debug it, validate code, check the logs,

[04:47] really everything that you need. We've now got a super powerful help for our devices and a chip running away mindlessly. What we want to do now is connect this chip to the hub

[05:00] and install a basic operating system to it. Once you've got your cable connected, you can just plug it in and click through Add Device in USB Home, and it should take you through the steps.

[05:13] Clicking Connect should pop up the USB port selector, and you can select your device there, and then you're away. It steps you through the process of installing the initial OS on the device, like naming your device.

[05:27] Once this is done, your device will be connected to your home Wi-Fi automatically, connected to your home assistant, and ready to rock forever more. You can disconnect it at this point if you want and all the updates you make will be done over the air So we have now in a matter of minutes set up ESP Home the active central hub for endless devices and connected your first ESP32 and installed the basic software

[05:57] We're basically done. The next step is about connecting up sensors. So let's go through eight of the most common to show just how easy it is. Let's start heating things up

[06:09] with a temperature sensor. Wouldn't it be cool, pardon the pun, if you could measure the temperature fluctuations around your house every second of the day? Imagine being able to trigger devices to turn on and off

[06:23] based on temperature thresholds. Well, that's super cheap and super easy. Let's start with the venerable DHT22. If you Google each of the sensor names in this video,

[06:37] you'll see just how cheap they often are. It'll shed new light on the mark-up you pay in all these commercial devices. The DHC22 is a very simple temperature sensor and a great place to start.

[06:51] It has three pins, power, ground and data. The first two just power the device and the last is how the sensor readings are sent to ESP home and home assistance. Now, to wire this up, you just need to connect each pin to the right place on the ESP32.

[07:09] It's pretty simple. The power goes to the power, the ground goes to the ground, and the data goes to one of the data pins. There are loads of pins on each chip. This gives you the ability to create even more complex sensors. Like, if you wanted a single chip

[07:26] that monitored temperature, light levels, noise and more, well, you'd just connect to different pins for each data feed. But we'll keep things simple for now.

[07:38] I've picked GPIO23 for my data. You need to remember that for your code later. Almost all ESP32s have the pins listed on the board, but you can also look up your model online

[07:51] to see all the diagrams and guides. So coding time. This is where the pen may drop on just how awesome ESPHome really is. It's already handled the bulk of the code for you, so you don't need to worry about Wi-Fi configuration or Bluetooth management, energy settings, encryption and all that stuff.

[08:13] You just need to code the sensor and that is as simple as you could imagine. We write sensor to let it know that the sensor is attached. Then we confirm the platform as DHT for this sensor as it's a DHT22.

[08:29] All this is available on the eSone site and they do a great job of giving sample code for everything. Then we put in the pin that it's connected to. As I said earlier, I'm using the GPIO-23.

[08:45] We put in the model number so it knows how to interact with it. This is all the code you need to set up your sensor. Now, to create sensor values that get tracked in Home Assistant, we just type what they

[09:00] are. So, temperature with the name of outdoor temperature. And we can also add humidity, which this sensor tracks in the same way. Now, I'm keeping this code super simple, but one more thing we'll add is the update

[09:16] interval. This is handy as it naturally will affect the amount of data that flows into Home Assistant and the energy use of the device. That's it. You've created your first sensor.

[09:29] You now just click to install it, and it'll do all the hard work for you. If in the future you wanted to change the frequency, name, sensors, or anything, you can just edit it from here

[09:42] and broadcast the new code over the air. Cool, eh? Let's quickly jump into Home Assistant, and you'll see under Integrations the new sensor is already appearing.

[09:54] Clicking on it and you can see the values heading through. How exciting! And finally, let's jump into a dashboard page. Create a graph. And bam!

[10:06] We've got a detailed sensor that tracks the temperature and humidity constantly. And how easy was that? We can use this sensor easily to trigger anything we want.

[10:18] change light colours, play sounds, turn on air conditioning, or simply gather the data to build your knowledge of temperature fluctuations. Final point, I'm deliberately picking the cheap components for each of these demos

[10:32] to make it as accessible as possible. There are definitely better sensors out there with improved accuracy. The temperature accuracy of the BHP22 is fine for general sensing,

[10:45] and the humidity is actually a proxy sensor by inverting the temperature. For most use cases, I'd actually recommend the BME 280 as its much higher accuracy is really handy.

[11:00] There's also the newer BME 680 which is even better but naturally the cost goes up a little each time. So just pick what suits your use case. You now have the power to install the temperature sensor.

[11:14] but my little acolyte I can see you crave more so let's get moving with motion sensors I assume you know now how to set up the EST32 chip and we can just jump directly to the wiring and the coding This is the HC They again very cheap and it works by sending ultrasonic waves out

[11:41] and then measuring the response times. Because there's two of them they can work much like two eyes do and just distances by the difference in response times. The wiring is very simple.

[11:56] Coding is very similar again, we just have a trigger pin to send out the pulse and an echo pin to read the waves bouncing back. Other than that, it's simple, eh?

[12:08] You already know what the update interval does. This is worth considering carefully for your use case. If you want a motion sensor for a room, you might actually want it to be quite slow so

[12:20] it's not hammering back up new things all the time and triggering on and off. If you want something like my hands-free light and music volume controller, well then you might want it to be much faster to allow a smooth control of light levels.

[12:34] This is where NM Wave Sensors come in. They're very similar, but their sensitivity is exceptional. Sub-millimeter as the name suggests. So they will detect you in the room as long as you're breathing.

[12:49] And if you're not, well, it might be a fitting end for your smart home to save the lighting and music in times of use using this mortal coil. Katie has been deactivated, though this is quite dramatic.

[13:04] Let's now grant you the power of light with lighting sensors. So this will use a BH1750, which is a little sensor that happily detects light levels.

[13:17] You're becoming an ESC pro now, so you know what to do. The code is very similar. Just define the name that you want for your sensor, the update interval, and that's it.

[13:29] There's an option value for the address that you can set if there are any issues. By default, it sets it to 0x20C. But if you have any problems, just add this and set to 0x5C and you'll be sorted.

[13:43] Again, all this is covered in brilliant detail on the ESC home site. Save, compile, and publish your code, and we now have a light sensor that you can use to do all sorts of cool things.

[13:58] Again, there are loads of even better sensors. The APGS9960 recognizes colors, so you can have it trigger a different action based on the color of the room.

[14:10] I'm not done with you yet. I could hear the squeal of excitement. I could measure it with my sound sensor. Let's use the KY038, a nifty little sensor that measures sound.

[14:26] I don't even need to tell you now what to do. You know the drill, and the code is very familiar. Only thing to call out is the attenuation variable. We're not getting through, Nadi. because the ADC or the analog to digital converter on the ESC chip is sensitive

[14:42] to the input voltage you need to cater for this. As you've got a 3.3 volt input you just need to enter 11 decibels and that's it. And as you're getting a little more comfortable I've added some filters to the code. These basically let it

[14:59] smooth out noise levels. If you imagine the normal sound waves of say you talking its very noisy waves, as it's literally noise. And let's say if you were in a dungeon,

[15:13] and the human ear would consider it noisy, that this sensor would more accurately describe it as quiet, punctuated by the sound of bits and tunes, until finally, silent.

[15:28] So to make it more useful, you want to average it out a little, to give you a general level of noise. That's it! Now you have a sensor in your house that monitors the sound level. You can also use it as a simple burglar detection for everyone.

[15:44] Sutton ninjas. Now I can hear you panting with anticipation. Is this the air you're breathing clean or dirty? Now let's think about an air particulate sensor.

[15:58] Things like the HM3301. This has a little fan that sucks in air, blows across a sensor and detects PM1, 2.5 and 10.

[16:10] The code is super simple, the wiring is super simple and it's sorted. I will paste the code in the description for each of these. You've now got a sensor that detects dust levels to let you know when you need to hoover or if you suffer from hay fever.

[16:27] fever. If you have a workshop, it can alert you to death levels being dangerous. There's so many cool uses of these sensors, but most importantly, it gives you the data about your

[16:40] environment so you can understand it better. Okay, hopefully that's got the juices flowing. So why don't we measure them? Unroast your sensor. Imagine every plant in your house

[16:53] being able to scream at you when it needs washing. Or a dashboard that shows all our moisture levels, the temperature in the rooms and the humidity levels.

[17:06] To do this, you just need one of these dudes, called a capacitive soil moisture sensor. There are loads of types, but I go with a capacitive sensor as they less prone to corrosion than the resistive types And naturally as they in soil and water it be getting a little bit exposed to that

[17:27] The code is simple. You just need to name the sensor and pins, as always, and set the attenuation for your device. You'll notice two filters. First, the calibration.

[17:40] As the device doesn't know what you're going to use it for, you need to set the values for what wet and dry means. If this was measuring whether your pond was drying up, then wet would be very wet,

[17:53] as it would be completely immersed in water. If it was measuring soil moisture, well then wet would be a much lower value. You can naturally set these values in Home Assistant too,

[18:05] but it's handy to control them from the device itself sometimes. You can test the values by checking the logs in ESP's home as you use the device, or just use Home Assistant to read state values for the sensor.

[18:18] I've also added a medium filter as another example of how you can filter out noise. This basically takes a medium size of three readings, and will send a new medium every time it takes a reading, less than the results.

[18:33] And that's it. You can now measure moisture super easily. But let's talk about one more example. when you start to get components like bee parasites.

[18:45] This is where you start to see that some options combine things. This nifty little open source approach monitors moisture, temperature, humidity and light levels and it all gets powered by a little battery that can last for years.

[19:02] So you could stick a bunch of these in your garden bed and have unbelievable details of how your plants are doing all in one. Okay, the HX711.

[19:14] This is a load sensor. The code is super simple and just needs a bit of calibration. So you'll need a precise weight. Say, put a one kilogram weight on it, and if it reads 810, then put that number into the filter.

[19:31] This can be used for lots of things. Obviously, the scale is handy. Again, you can get even more precise devices based on your use case. But you could easily have a device that monitors the amount of coffee beans left in your pot,

[19:46] or sense when someone steps on your doormat, whether someone is on a chair, or trigger when a present jewel is lifted from its safe, and so on. NPR-121 Capacitive Touch Sensor.

[20:00] These detect your touch, just like your phone screen. Different models have different ranges, but it's pretty cool to create a button on the material that senses through it,

[20:12] a device that triggers when you tap the material in different places. And finally, you'll very quickly see how you can start to put these senses together into combined all-in-one units.

[20:26] As you add more, inevitably it gets more complicated, but it's all achievable. companies like Apollo Automation are great examples love their stuff

[20:38] so if you want a quick office house solution with an absolute battery of sensors already available go for it you may think that this is all now easy and in many ways it is

[20:50] but there are three tips I'd like to share to save you hours of hobbanging things will of course not work sometimes But it's amazing how many of them will be down for one of these three reasons.

[21:04] Number one, connect directly to the device running ESP Home if you're struggling. This takes out lots of potential issues with your home network setup, device authentication and more.

[21:18] Number two, check your USB cable. I know, you're sure it's a data cable and it's definitely working. but you'll be amazed at how often this is the cause of problems.

[21:32] It's that chaos of USB standards again. Top tip. Get one of these. Just plug the cable in two places and bang,

[21:44] it tells you exactly what cable you've got. Number three. Look at the data sheet for your exact microcontroller and sensor. Just Google the name of it. Again, you'll be amazed at how often something changes with a new model and that's the source

[22:01] of your problems and you just need to change the data pin you're using or something similar. So that's it! You now have the power. But promise me you'll only use your powers for good.

[22:14] I hope this video has helped demystify some of these chips and sensors and you're able to fly off into the world to make great things. things. I'd like to thank the real superheroes

[22:27] of this video, who are soaring past my head. My Patreons and YouTube members. If you'd like to see more videos, then think about joining. The link's in the description as always.

[22:40] Oh, and many thanks to all of the wonderful developers of ESP Home who do such a great job in helping make the world of microelectronics accessible to everyone. who I'm out

⚡ Saved you 0h 23m reading this? Transcribe any YouTube video for free — no signup needed.