Let's build a room sensor - Part 1 - Temperature, Humidity, and Bluetooth

Home Automator
8 Mar 202429:13

Summary

TLDRThis tutorial covers the basics of creating a room sensor using ESP development boards and various sensors, including Bluetooth temperature and humidity sensors (DHT22), light sensors (BH1750), and presence detectors. The video details the setup, pin configurations, and coding in ESPHome, emphasizing practical applications like gas sensors for kitchens and distance sensors for garages. The tutorial aims to build a comprehensive room sensor, with future videos adding more features and sensors. It also includes a demonstration of integrating the sensor data into Home Assistant for monitoring room conditions.

Takeaways

  • πŸ“‘ The tutorial covers the basics of using a room sensor with various devices.
  • πŸ“Ά You need a basic setup for devices as described in the ESP Foundation tutorial.
  • 🌑️ The focus starts with Bluetooth temperature and humidity sensors, specifically using a DHT22.
  • πŸ› οΈ Additional sensors like light, CO2, TVOC, and movement detection will be added in future videos.
  • πŸ’‘ The tutorial will also explore adding touch screens to control lights or open doors.
  • πŸ“‹ The bill of materials includes ESP development boards (ESP32 or ESP8266), suitable USB cables, and capacitors.
  • πŸ”§ The DHT22 sensor is preferred over the DHT11 due to better temperature and humidity range and resolution.
  • πŸ“ Important differences between DHT11 and DHT22 include temperature range, humidity range, and sampling period.
  • πŸ“ The video provides guidance on wiring and coding for the DHT22 sensor.
  • πŸ”„ The tutorial uses Home Assistant and ESPHome software, detailing the setup and configuration process.

Q & A

  • What is the primary focus of this tutorial?

    -The tutorial focuses on setting up a room sensor using various sensors, including a Bluetooth temperature and humidity sensor, with the aim of creating a comprehensive room sensor system.

  • Which temperature and humidity sensor is being used in the tutorial?

    -The tutorial uses the DHT22 temperature and humidity sensor.

  • What additional sensors are mentioned for future videos?

    -Future videos will include sensors for illumination, eCO2, TVOC, movement detection using a PIR sensor, and presence detection using a millimeter wave sensor.

  • What are the primary differences between the DHT11 and DHT22 sensors?

    -The DHT11 has a temperature range of 0 to 50Β°C and a humidity range of 20 to 90%, with a 1% and 1Β°C resolution. The DHT22 has a temperature range of -40 to 80Β°C and a humidity range of 0 to 100%, with a 0.1% and 0.1Β°C resolution.

  • What is the purpose of the 10 microfarad capacitor mentioned in the tutorial?

    -The 10 microfarad capacitor makes it easier to upload firmware via the USB port.

  • What software is required for this project?

    -The required software includes Home Assistant and ESPHome.

  • Why is it important to check the pin assignments for each ESP model?

    -Pin assignments vary between different ESP models, and using the wrong pin configuration can damage the microcontroller.

  • What are some use cases for the sensors mentioned in the tutorial?

    -Use cases include detecting gas in the kitchen, using a distance sensor in the garage for parking, and monitoring room conditions such as temperature, humidity, and presence.

  • How does the Bluetooth proxy function in the tutorial?

    -The Bluetooth proxy extends the Bluetooth range of the Home Assistant machine, allowing it to communicate with Bluetooth devices beyond its direct range.

  • What should be considered when using the Bluetooth Low Energy Tracker Hub?

    -The Bluetooth Low Energy Tracker Hub is processor-intensive and can interfere with other functionalities like the web server, so it should be used sparingly and only when necessary.

  • What is the purpose of having unique IDs for sensors in Home Assistant?

    -Unique IDs allow for manipulation and changes within Home Assistant, making it easier to manage and interact with the sensors.

  • What are the steps to add the DHT22 sensor to the ESPHome configuration?

    -The steps include adding the DHT22 sensor to the GPIO pin (e.g., GPIO26), defining the sensor platform in the ESPHome configuration file, and specifying the update interval.

  • What additional features are planned for future tutorials?

    -Future tutorials will cover adding a light sensor, more presence and movement sensors, and building specific sensors for different rooms like the kitchen and garage.

  • What is the benefit of using i2c in sensor configurations?

    -Using i2c allows for flexibility and chaining of multiple sensors, making it easier to expand and customize the sensor setup.

  • How can the data from the sensors be displayed in Home Assistant?

    -Data from the sensors can be added to the Home Assistant dashboard, where it can be visualized using various types of cards, such as temperature and humidity gauges.

Outlines

00:00

🏠 Introduction to Home Automation Sensor Tutorial

This paragraph introduces a home automation tutorial series by Automator South Africa. It covers the basics of setting up a room sensor using various devices, starting with a Bluetooth temperature and humidity sensor, specifically the DHT22. The tutorial will expand to include additional sensors like eCO2, TVOC, movement detection, and potentially a touchscreen for control. The presenter intends to create a comprehensive room sensor setup that viewers can customize. They also invite viewer suggestions for additional sensors and remind viewers to engage with the content through likes, subscriptions, and comments.

05:00

πŸ” Exploring Sensor Capabilities and Differences

The second paragraph delves into the specifics of the temperature and humidity sensors, contrasting the DHT11 with the DHT22. It highlights the broader temperature and humidity range of the DHT22, as well as its higher resolution and slower sampling rate. The paragraph also emphasizes the importance of consulting pin assignment diagrams for different microcontrollers and discusses the differences between the DHT11 and DHT22 in terms of sensitivity and range. The presenter plans to replace the DHT sensors with a BME280 and SHT40 to demonstrate I2C capabilities.

10:03

πŸ› οΈ Setting Up the DHT22 Sensor with ESP Home

This paragraph describes the process of setting up the DHT22 sensor with ESP Home. It covers the pinout connections required for the sensor, including VCC, data, and ground. The presenter discusses the use of a 10 microfarad capacitor to facilitate firmware updates via USB and the choice of GPIO26 for the data pin. The paragraph also includes a brief mention of coding in ESP Home, with an emphasis on the importance of using the correct documentation for the microcontroller being used.

15:06

πŸ“‘ Discussing Bluetooth Integration in Home Assistant

The fourth paragraph focuses on the integration of Bluetooth in Home Assistant. It explains the functionality of the Bluetooth proxy and Bluetooth Low Energy (BLE) tracker hub, including their roles in extending Bluetooth range and tracking devices. The presenter warns about the intensive processor usage of the BLE tracker hub and advises against its use unless necessary. The paragraph also touches on the use of the proxy for monitoring devices like the Mopa Pro gas bottle fill monitor and the importance of using the web server for debugging and additional functionalities.

20:08

🌑️ Adding the DHT22 to ESP Home and Testing

In this paragraph, the presenter adds the DHT22 sensor integration to the ESP Home configuration. They provide a code snippet for the DHT platform, specifying the GPIO pin, sensor name, and model. The update interval for the sensor is set to 30 seconds. The presenter then demonstrates an Over-The-Air (OTA) update of the ESP32 device and confirms that the sensor is functioning correctly by displaying the temperature and humidity readings in Home Assistant.

25:11

πŸ“Š Creating a Dashboard for Sensor Data

The final paragraph discusses the creation of a dashboard in Home Assistant to display sensor data. The presenter demonstrates how to add cards for room temperature and humidity to the dashboard, using the data from the DHT22 sensor. They provide a step-by-step guide on configuring the cards, including setting the minimum and maximum values and choosing the display format. The paragraph concludes with a preview of the dashboard and a reminder that future tutorials will cover additional sensors and functionalities.

Mindmap

Keywords

πŸ’‘ESP32

The ESP32 is a powerful and versatile microcontroller with integrated Wi-Fi and Bluetooth capabilities. In the video, it serves as the main development board for building various sensors and devices for a smart home setup. The tutorial uses the ESP32 to connect and control different sensors, highlighting its importance in the project's foundation.

πŸ’‘DHT22

The DHT22 is a temperature and humidity sensor. The video uses this sensor to measure environmental conditions within a room. It is chosen for its wide temperature range (-40 to 80Β°C) and humidity range (0 to 100%), providing accurate and reliable data for home automation systems.

πŸ’‘Home Assistant

Home Assistant is an open-source home automation platform. In the tutorial, it serves as the software backbone for integrating and managing the various sensors connected to the ESP32. The use of Home Assistant allows for centralized control and monitoring of the smart home setup.

πŸ’‘Bluetooth Proxy

A Bluetooth proxy extends the Bluetooth capabilities of the Home Assistant server beyond its typical range. The video explains how to use the ESP32 as a Bluetooth proxy to connect remote Bluetooth devices to the home automation system, enhancing the system's reach and functionality.

πŸ’‘BME280

The BME280 is another sensor module used for measuring temperature, humidity, and pressure. The video mentions it as an alternative to the DHT22, demonstrating the flexibility of the system to incorporate different sensors based on availability and requirements.

πŸ’‘I2C

I2C (Inter-Integrated Circuit) is a communication protocol used to connect low-speed devices to microcontrollers. The video discusses the advantages of using I2C, such as the ability to chain multiple sensors together, making it a preferred method for expanding the sensor network in the home automation project.

πŸ’‘Pin Assignments

Pin assignments refer to the specific pins on a microcontroller used to connect external devices. The video emphasizes the importance of correct pin assignments for different sensors and modules, as incorrect connections can lead to device malfunctions or damage.

πŸ’‘ESPHome

ESPHome is a system for controlling ESP8266/ESP32 boards by simple yet powerful configuration files and control them remotely through Home Assistant or other platforms. The video uses ESPHome to write and upload the firmware needed to run the sensors on the ESP32, streamlining the setup process.

πŸ’‘Capacitor

A capacitor is an electronic component that stores and releases electrical energy. In the video, a 10 microfarad capacitor is used to stabilize the power supply to the ESP32, ensuring reliable firmware uploads and preventing reset issues during operation.

πŸ’‘PIR Sensor

A PIR (Passive Infrared) sensor detects motion by measuring changes in infrared radiation. The video plans to add a PIR sensor for movement detection, enabling the home automation system to respond to the presence of people in a room, such as turning on lights or triggering alarms.

πŸ’‘Dashboard

A dashboard in the context of the video is a user interface for monitoring and controlling the home automation system. The tutorial shows how to add sensor data to the Home Assistant dashboard, providing a visual representation of the environmental conditions and allowing for easy interaction with the system.

πŸ’‘Humidity Range

Humidity range refers to the range of humidity levels that a sensor can accurately measure. The video compares the DHT11 and DHT22, noting that the DHT22 has a broader humidity range (0 to 100%) compared to the DHT11 (20 to 90%), making the DHT22 more suitable for a wider range of applications.

Highlights

Introduction to Home Automator South Africa tutorial covering the basics of a room sensor setup.

Explanation of Bluetooth temperature and humidity sensors, specifically the DHT22.

Outline of additional sensors to be covered in future videos: illumination, eco2, TVOC, and movement detection using a PIR sensor.

Plans to add a screen and touch functionality to switch on lights or open doors.

Customization of sensors for specific rooms, like gas sensors for the kitchen and distance sensors for the garage.

Detailed list of materials needed: ESP development board, suitable USB cable, 10 microfarad capacitor, breadboard, jumper wires, and DHT22 sensor.

Explanation of the differences between DHT11 and DHT22 sensors in terms of temperature range, humidity range, and resolution.

Importance of correct pin assignments for different ESP boards and how to find manufacturer pinout diagrams.

Steps to prepare the breadboard and wiring for the DHT22 sensor.

Introduction to YAML coding in ESPHome for setting up the DHT22 sensor.

Explanation of Bluetooth proxy and Bluetooth low energy tracker hub functionalities in Home Assistant.

Compilation and installation process of the ESP32 with the new YAML code.

Verification of the DHT22 sensor data in Home Assistant dashboard, showing temperature and humidity readings.

Plan to add a light sensor in the next tutorial and details about future quick tutorial videos.

Reminder to like, subscribe, and hit the notification bell for more tutorials.

Transcripts

play00:02

[Music]

play00:09

hello hello hello and welcome to a home

play00:13

automator South Africa tutorial today

play00:16

will be covering the basics of a room

play00:18

sensor to be able to successfully

play00:21

complete this tutorial you will need the

play00:24

basic setup for all devices my ESP

play00:28

Foundation tutorial today we will start

play00:32

with the Bluetooth temperature and

play00:35

humidity sensors now the temperature and

play00:37

humidity sensor is the same device uh

play00:40

it's going to be in my case a

play00:43

dht22 I will talk about it a little bit

play00:46

more a little later on in this video

play00:49

after that we'll be adding some more

play00:51

sensors

play00:53

elimination

play00:55

eco2

play00:57

tvoc movement DET detection using using

play01:00

a p sensor presence

play01:03

detection with a millimet wave

play01:07

sensor we might add a screen

play01:11

and if I have time touch to the screen

play01:15

to be able to switch on lights or uh

play01:18

open doors something like that I will

play01:22

add all of these sensors over the coming

play01:26

videos I don't know when these videos

play01:28

are going to come out but I am going to

play01:31

try to make them as regular as I can at

play01:34

the end of the project I intend to have

play01:36

a full room sensor that works for all of

play01:40

us you can subtract from it you can add

play01:43

from it but also what I will be doing is

play01:46

at the very end of this is add some

play01:50

specific for example in the kitchen you

play01:52

may need a gas sensor for either natural

play01:56

gas or

play01:58

LPG and we will work on building such a

play02:02

sensor for the kitchen in the garage you

play02:05

might want to have a distance sensor for

play02:08

when you park we will then build one of

play02:11

those as well so all of this is in the

play02:14

planning and there will be others I'm

play02:16

sure if you have any ideas of what we

play02:20

could do for room sensor please don't

play02:23

hesitate put it in the comments below I

play02:25

read all of my comments I reply to all

play02:28

of my comments

play02:30

a little self- serving reminder don't

play02:33

forget to like subscribe and hit that

play02:37

notification Bell also all of my

play02:40

tutorials have time codes or chapters

play02:43

attached to them

play02:52

below before we start building I'd like

play02:56

to give you the bill of

play02:58

material we we're going to start with

play03:00

the ESP development board mine is an ESP

play03:04

32s board but any ESP

play03:09

8266 or 32 will work you might have to

play03:15

readjust some of the pins a suitable USB

play03:18

cable in my case my USB cable is a micro

play03:23

USB a 10 microfarad capacitor now this

play03:27

is not required but it makes it easier

play03:30

to dump the firmware using the USB port

play03:35

and I'll explain to you later why a

play03:40

brakeboard some bre brakeboard jumper

play03:44

wires you shap breadboard jumper wires

play03:47

this is an

play03:49

option this is optional but it will make

play03:52

your life much easier easier I

play03:56

promise and obviously either a DHT 11 or

play04:00

22 temperature and humidity sensor

play04:02

module you can use a

play04:05

dhd1 I will be using a dht22 and I will

play04:09

explain to you why later in the coming

play04:12

videos we will also

play04:14

add a

play04:18

bh1750 light

play04:21

sensor and we will talk about the

play04:24

advantages of using i squ c or

play04:28

i2c

play04:31

then we'll add a gp3 a

play04:35

quality s sensor

play04:37

module uh this sensor module is the only

play04:41

one that I could find in South Africa at

play04:43

the time of recording there are IDs they

play04:46

all work pretty much the same so if I do

play04:49

this one you'll know how to do the

play04:52

rest a p sensor for movement

play04:57

detection then we will talk talk a bit

play05:00

about universal asynchronous receiver

play05:02

transmitter or

play05:04

art and the protocol behind it and then

play05:08

we'll add an LD

play05:10

2410 C presence radar sensor that is a

play05:17

tricky one so it might be longer than

play05:20

the

play05:21

rest um and at the end I will replace a

play05:25

DHT 11 or 22 with a BME

play05:30

280 and an sht 40 just to show you what

play05:35

we can do with

play05:37

i2c um i2c allows us quite a lot of

play05:42

flexibility and chaining of

play05:52

sensors software wise the requirements

play05:55

are very simple we need home assistant

play05:57

and we need espo that is it nothing

play06:02

else so instead of carrying on and

play06:06

talking about things how about we start

play06:16

building before we carry on I'd like to

play06:19

talk quickly about something that's

play06:21

relatively

play06:22

important for each device that we are

play06:25

going to use be it an ESP 32 32s 32 S2

play06:30

C3 or an

play06:34

esp8266 there are pin assignments to

play06:38

them and these are usually done for

play06:41

manufacturer for example an ESP 32 cam

play06:45

will not have exactly the same pin

play06:48

assignments as a ESP 32 D1 mini and the

play06:53

D1 mini would not have the same pin

play06:56

locations as another esp32 to to find

play07:00

which pins you have for the given ESP or

play07:05

any other microcontroller you will have

play07:08

to find the manufacturer pin out diagram

play07:13

and this is what we have in front of us

play07:15

the binard

play07:16

diagram this is the one that I use which

play07:20

is the espb

play07:23

32s from from AI thinker this is the uh

play07:27

the the board uh that we are going to be

play07:30

using right through and that we have

play07:32

already been using in previous tutorials

play07:36

I will leave a link below with the

play07:40

address of where you can get this

play07:42

diagram and a little bit more about this

play07:44

specific node

play07:46

MCU today we will be using GP

play07:52

io26 which the arrow is pointing out

play07:55

right now okay I think this was uh

play07:59

something that was very important you do

play08:01

need to get the documentation for your

play08:04

MCU and not all mcus have the same pin

play08:08

diagrams I got CAU out thinking that uh

play08:12

the node MCU and another MCU had the

play08:16

same pin assignment at the same place

play08:18

this is a good way to blow up one of

play08:20

your

play08:23

microcontrollers before we continue I'd

play08:25

like to speak about the differences in

play08:27

between the DHT l and the

play08:30

dht22 although you can use either of

play08:33

them there are major differences to them

play08:36

not in the wiring but in their

play08:39

sensitivity and in their range so to

play08:43

give you a fair idea of what the

play08:45

differences are the temperature range of

play08:48

the DHT 11 is from 0 to 50Β°

play08:53

C whereas the DHD 22 is from - 40 to 80Β°

play09:01

C the humidity range for the DHD 11 is

play09:06

in between 20 and 90% whereas the TW DHD

play09:11

22 ranges from 0 to

play09:15

100% additionally there are some

play09:18

resolution changes between the

play09:21

two for the humidity and temperature the

play09:25

DHT 11 has a 1% one degree

play09:31

step whereas the

play09:33

dht22 has a 0.1% step on

play09:39

both lastly and possibly not as

play09:42

important but worth

play09:44

remembering is the sampling

play09:47

period the dht11 can sample at one time

play09:51

a second whereas the

play09:54

dht22 two seconds to refresh so you

play09:58

cannot request the data from the

play10:03

dht22 faster than that now the ESP home

play10:08

libraries takes care of all of this so

play10:12

you don't have to worry too much about

play10:14

it I just wanted to make sure that you

play10:16

understood the differences between the

play10:19

two now in this project you can use

play10:21

either and the pin outs are exactly the

play10:25

same so let's move on to that

play10:29

the first pinout I'm going to talk about

play10:32

is the VCC or power

play10:35

pinout for the

play10:38

dht22 the power can be in between 3.5

play10:42

volts and 5.5

play10:45

volts the second one is going to be the

play10:48

data now we are getting serial data out

play10:51

of this it is a digital

play10:55

output so we do not need an analog pin

play10:58

and the is reason why I chose

play11:02

gp26 the last pin is ground obviously

play11:06

it's going to go back to the ground now

play11:08

you're going to see all of this in more

play11:10

details shortly when I show you how to

play11:13

wire

play11:15

it as you can see I have prepared the

play11:18

brakeboard with uh all we need uh you

play11:22

can see the dht22 this white little uh

play11:27

block over there so let me just explain

play11:30

to you what I've

play11:31

done I have hooked up the

play11:36

VCC to the positive

play11:39

rail the ground to the negative rail

play11:44

these rails run this

play11:47

way uh whereas these rails run this way

play11:51

okay so the next one that I need to talk

play11:56

to you about is the 10 microfarad

play11:59

uh capacitor which is only there so that

play12:03

we can actually use the serial

play12:06

in without having to push any of the

play12:10

button particularly this button over

play12:13

here the data the serial data from the

play12:18

dht22 as you can see comes into GPO

play12:23

26 let's go and do some code and see if

play12:26

all of this

play12:27

works

play12:34

here we are we are ready to do some yaml

play12:36

code in ESP home but before we do some

play12:40

things that I wanted to point out the

play12:43

first thing is that our version

play12:47

of Home assistant is now 20

play12:51

24.

play12:54

3.0 and the second one is that our ESP

play13:00

home version is currently 20 24.2 do2

play13:05

both of them have changed during the

play13:07

time that I Was preparing for this

play13:09

recording and uh I thought I would tell

play13:12

you where I am now so that we are on the

play13:15

same

play13:16

footing okay so we can go straight to

play13:20

spom and I would like to show you a

play13:23

little something I'm going to go into

play13:26

our last tutorial regarding SP home and

play13:29

I am going to scroll all the way down

play13:32

and you will see here we have 202 lines

play13:37

why have I done that well I want to show

play13:40

you this one now this is a brand new

play13:43

device I primed it like I primed the

play13:46

original one that I did in my first

play13:50

tutorial where I show you how I prepare

play13:53

my ESP home

play13:55

devices and you will see that this

play13:58

device

play13:59

also has

play14:01

202 lines and that's because both of

play14:05

them are using exactly the same code at

play14:09

the exception of what is in the

play14:12

substitution variables I have just

play14:14

change the name and put a new IP address

play14:18

we can move on and start doing some

play14:26

code the first thing that I'm going to

play14:28

do is I'm going to go just under the

play14:29

Wi-Fi and this is because I like to have

play14:32

some order Wi-Fi is a communication

play14:35

system and so it's Bluetooth so I am

play14:38

going to put bluetooth under Wi-Fi I

play14:41

have this prepared and it is in in

play14:45

another the screen so I'm going to copy

play14:47

the code here and I am going to paste it

play14:49

right for

play14:51

you

play14:52

um I know that caching will give us some

play14:56

problems and I also know that

play15:00

um

play15:02

my code is not quite correct so I'm

play15:06

going to go and fetch this device

play15:07

internal

play15:10

name and I am going to change the device

play15:14

name to device internal name why does

play15:17

the cach service doesn't work well the

play15:19

cach service is a ESP IDF function just

play15:24

so that I explain to you there are two

play15:26

ways of compiling

play15:29

there is the Arduino framework or the

play15:32

ESP IDF framework oddly enough as I

play15:35

think I explained in the previous one

play15:38

the Arduino FR framework for

play15:41

esp32 actually leverages entirely from

play15:46

the ESP IDF framework now let's go

play15:50

through Bluetooth I am going to just

play15:53

scroll it a bit up so that we can all

play15:56

see it here we are uh the Bluetooth

play15:59

proxy as you know very well know extends

play16:03

the home assistant machine's Bluetooth

play16:08

abilities Beyond its range so wherever

play16:12

you're proxy it plays the game of

play16:16

switching from the BL whatever the

play16:19

Bluetooth signal is on the one side and

play16:22

outside of the range of the home

play16:24

assistant machine and it forwards that

play16:27

to the home assistant machine

play16:29

or the other way around so it's

play16:31

basically like having a long cable with

play16:33

a Bluetooth dongle at the end to extend

play16:37

the range of Bluetooth that is all well

play16:40

and fine and it's not a problem the next

play16:42

one is the Bluetooth low energy tracker

play16:46

Hub the Bluetooth low energy tracker Hub

play16:49

is very intensive on the

play16:53

processor so we need to use this

play16:56

sparingly in fact I would even

play16:58

discourage you from using it unless you

play17:01

know exactly that you're going to need

play17:03

it in that

play17:05

position and that's because you lose the

play17:08

ability to do other things uh web server

play17:11

being one of

play17:12

them the uh tracker and the web server

play17:16

at the same time do not work I have

play17:19

tried on many occasions and I end up

play17:23

with a microprocessor that just reboots

play17:27

and reboots and boots or boots randomly

play17:29

for no reason whatsoever if you are

play17:32

going to have a Bluetooth device or many

play17:35

Bluetooth device in a room sure use it

play17:39

if you're not going to have any

play17:41

Bluetooth device in that room comment it

play17:43

out rather have the web server it's far

play17:46

more useful and I think I explained why

play17:50

it is useful it allows us to debug but

play17:54

beyond all of that it also allows

play17:57

further things

play17:59

which I will talk about in one of my

play18:02

quickies it is related to the way that

play18:07

we can connect an ESP 32 ESP home device

play18:12

to a new network so the Bluetooth proxy

play18:17

is active equals true means exactly what

play18:20

it says here it is I'm a proxy I'm

play18:22

active use me the Bluetooth low energy

play18:26

tracker Hub at

play18:28

okay fine I'm going to scan for stuff

play18:32

that I can track that announces itself

play18:35

and uh I'm going to do that at every

play18:39

1,100 milliseconds or 1.1 second why

play18:44

would that be useful I have a mo M Pro

play18:49

Bluetooth device which allows me to

play18:52

monitor my guas bottle fill so I know

play18:56

when I get too low

play18:58

about 10% it actually sends out an alert

play19:01

to me through home assistant it is a

play19:04

Bluetooth device and it is outside of

play19:06

the range of my home assistant server I

play19:10

use it there I also use the same uh

play19:14

esp32 to monitor any gas leak around the

play19:18

bottle there is a good case for that I

play19:21

am going to stop about Bluetooth at this

play19:24

point in time we will treat Bluetooth

play19:27

device is in more details especially I

play19:30

think the the mopa pro and I'm hoping

play19:34

I've got the name right because it is an

play19:36

interesting device I am going to compile

play19:40

and install this so let's go to install

play19:43

and because it's been primed with my

play19:45

code already I know that it has Wireless

play19:49

ability a few moments

play19:52

later we are waiting for the esp32 to

play19:56

respond and there we are

play19:58

it is responding I would like to show

play20:01

you that the blle is indeed installed

play20:05

and you can see it right

play20:08

there and

play20:10

uh there we are we are now reading data

play20:14

from our

play20:20

ESP now let's talk about adding the

play20:26

dht22 I think that we I've covered the

play20:29

dht22 in uh enough details previously so

play20:34

all I'm going to do is add the code and

play20:36

explain to you what the code does I am

play20:38

going to go down and uh go all the way

play20:42

down to my sensors uh area there it is

play20:47

sensors sensors area I am going to do

play20:51

some space for

play20:53

us and uh go back a little bit and just

play20:56

paste my code so so here is the code I

play20:59

like meat code so I will do this okay so

play21:02

the platform is

play21:04

DHT

play21:06

the gpio that we opted for is a GPO

play21:14

26 and I chose that one for a good

play21:18

reason and I will be honest with you I

play21:21

can't remember why then after that it's

play21:24

simply temperature and as you see name

play21:27

temperature

play21:29

ID and humidity name humidity and an ID

play21:33

now I have a tendency to put IDs to

play21:36

everything and that's because in home

play21:39

assistant if you've got an ID you can

play21:41

actually do some manipulation and

play21:44

changes inside of Home assistant uh that

play21:47

you can't do if you're not if you do not

play21:50

have a unique

play21:51

ID okay the model is a

play21:54

dht22 yes if you use a DHT 11 it would

play21:58

be dht11

play22:00

and

play22:01

lastly update interval is the update

play22:05

interval that I set at the top of the

play22:08

file now just to show you what that

play22:11

update interval is set at right now it

play22:13

is 30 seconds okay let's go back over

play22:16

there and this is everything we need to

play22:20

do just to get a dht22 to work I will be

play22:25

honest with you I'm going to cross

play22:26

fingers and touch wood and hope that it

play22:29

works as I said the esp32 is primed and

play22:34

we can do an

play22:38

OT and ply and here we go it's going to

play22:42

be much faster than the last one now the

play22:44

last one took a little bit of

play22:46

time uh it had to download certain

play22:49

things and it had to do a few other

play22:51

things like compile everything this time

play22:56

we only compiling two

play22:59

so it should be pretty

play23:03

fast there we are and it is uploading it

play23:07

a few moments

play23:09

later now we are waiting for the device

play23:12

to respond back after

play23:20

reboot and here we

play23:22

are okay I am going to scroll down a

play23:24

little bit so that you can see where the

play23:27

DH T is being

play23:30

initialized and we're going to go down

play23:32

and we are starting to get data so I

play23:36

must of pray to the right computer

play23:38

guards and we are getting actually 20

play23:42

28.1 Dees and

play23:44

40.3% humidity which is highly likely we

play23:48

have a storm outside and uh it is

play23:52

raining and uh the temperatures right

play23:55

now are very high okay and yes it is 1

play24:00

p.m. that covers everything I wanted to

play24:02

show you inside of ESP home so I am just

play24:05

going to go stop I am going to CL

play24:09

close and our device is indeed online

play24:12

and I get a notification a new device

play24:17

has been

play24:19

discovered I am going to dismiss it

play24:21

because I do these things I'm going to

play24:23

go to settings device and

play24:26

services and you you are going to see oh

play24:29

I was talking about the mo mopa check

play24:32

and it is available to me right here

play24:35

right now and through that uh Bluetooth

play24:40

proxy uh it is a Bluetooth one it is

play24:43

sitting on the other side of the room of

play24:45

the wall so obviously it will pick it up

play24:48

the one that it did not pick up is the

play24:51

ESP home device that I want us to use I

play24:56

see why I Prime the ESP Home Room sensor

play25:00

device previously so we're going to go

play25:02

into it and as you can see the humidity

play25:05

is appearing the temperature is

play25:07

appearing and all of the other things

play25:10

that we have set up is appearing so how

play25:14

do we go about putting that into the

play25:16

dashbo I'm not going to go into funny

play25:19

things today um I will have a separate

play25:23

video regarding how to build a dashboard

play25:25

with yl I know there are new function

play25:27

ities drag and drop that was introduced

play25:30

in this version of Home assistant I'm

play25:32

still a bit old style I like the control

play25:35

that I have when I do things by code but

play25:39

just to demonstrate how well all of this

play25:41

works we are going to just go add to

play25:44

dashboard and this is what it will look

play25:47

like and we are going to just add it to

play25:50

the

play25:50

dashboard if we come back to overview

play25:54

here we are the this is the data that we

play25:57

have right now we do not have any fancy

play26:01

I don't think we've got anything fancy

play26:03

that we can do with it a little longer

play26:06

than a few minutes

play26:07

later here we've got a we've got one um

play26:12

and uh right now that's a signal sensor

play26:15

but what we want is let's use the temp

play26:18

oops let let's use the

play26:22

temperature the the temperature the room

play26:25

temperature sensor and and the units and

play26:28

everything else is good we are going to

play26:31

put a

play26:34

Time ah if I could spell

play26:38

temp right

play26:40

here and I guess we should say GR in

play26:45

front uh the unit is um degrees

play26:49

Centigrade we're not going to change

play26:51

there the minimum um I'm not going to

play26:55

change the maximum uh let's let's put

play26:58

the minimum at zero because it's a room

play27:00

temperature and the maximum we are going

play27:03

to put at 40 what do you think so we can

play27:05

display it as a

play27:07

needle go as a needle gauge I don't like

play27:11

that severity no that's fine okay so we

play27:15

are going to save that and we are now

play27:18

with a room temperature of

play27:21

22. oh

play27:24

28.2 uh to I wonder if no it's not there

play27:30

yet okay and we can add another card

play27:35

same one if I can find it again here he

play27:38

is and we are going to take this and we

play27:43

are going to say humidity and humidity

play27:50

obviously

play27:52

humity and as I was about to say

play27:56

humidity starts at zero and the maximum

play27:58

is 100 and we're going to save that and

play28:01

now we have both room temperature and

play28:05

room humidity available to us on the

play28:13

dashboard I am going to wrap off for

play28:16

today and the next one I will be adding

play28:21

a light sensor and it is going to be a

play28:25

quicker in fact the next few are

play28:27

probably going to be all quickies until

play28:31

I do presentence and U movement which I

play28:35

will possibly do at in in one single

play28:39

tutorial anyway I think we've covered

play28:41

this very well if you liked the video

play28:45

obviously please do not hesitate to

play28:47

click the like button if you want more

play28:50

of these hit that subscribe button and

play28:55

if you want to be notified hit that Bell

play28:58

icon this is Pascal signing off until

play29:01

the next tutorial have a great

play29:05

[Music]

play29:11

one

Rate This
β˜…
β˜…
β˜…
β˜…
β˜…

5.0 / 5 (0 votes)

Related Tags
Room SensorESP32DIY TutorialHome AutomationTemperature SensorHumidity SensorSmart HomeTech GuideArduinoElectronics