Smart Home Demystified!
How to create a simple IOT based home monitoring system.
Part I : The Theory.
1.Data is Key!
As we move towards smart cities and automation IOT devices play a key role as Data acquisition devices and as individual processing node points in the Network cluster.
Data in a smart city needs to come from a lower level like our Homes. This data when analyzed will help us to derive our requirements as well as manage our resources as a home owner or as a whole country state. we can create such a device very easily.
2. The Hardware.
ESP-01 (Sends data using WiFi to a database)
ESP-01 is an 3.3V device DO NOT USE 5V!
For handling all the networking stuff we use a ESP-01 module which comes with [ Wi-Fi 2.4 GHz, 32-bit Microcontroller, 3GPIO pins].
DHT-11 / DHT-22 (Sensor for measuring the Temperature/Humidity)
DHT sensors are compatible with 5V as well as 3.3V.
DHT sensors are used for measuring the temperature as well as relative humidity of air. The main difference between the DHT-11 & DHT-22 are,
Temperature Range:
- DHT11: -20 to 60℃
- DHT22: -40 to 80℃
Temperature Accuracy:
- DHT11: ±2%
- DHT22: ±0.5%
Humidity Range:
- DHT11: 5 to 95% RH
- DHT22: 0 to 100%RH
Humidity Accuracy:
- DHT11: ±5%
- DHT22: ±2%
USB-to-TTL converter (Used for Programming the ESP-01 Module)
The USB to TTL converters are required for programming purposes so we can program the ESP-01 with the code required to interface with the sensor.
A 3.3V power Source
Our ESP-01 and the DHT module works on a 3.3V so having a stable power supply will be required.
3. The Software.
Whole Development Environment for programming ESP/ARDUINO.
Also helps us to manage the Libraries and dependencies which make programming these devices less hectic and more fun.
The Data we acquire is sent to a feed made in Adafruit IO.
You just need to make an account and create feeds, Temperature and Humidity in our case.
You’ll get a Adafruit Key from this tab on the website which we will require later on.
Also You’ll need two feeds for our data that we are going to send that can be done on Feeds on the website.
PART II : Build it UP!
1. The Connections
We need to connect the ESP module to the USB-to-TTL converter by which we can program the ESP.
“TO PROGRAM THE ESP-01 THE GPIO0 PIN NEEDS TO BE SET TO LOW”
The ESP Module is not that BreadBoard friendly so you’ll probably need to use breadboard wires and stuff to rig it up. ( In my case I created a custom connector to connect it to the breadboard.)
2. Programming the ESP
Once Everything is set up set the port in Arduino IDE to the COM Port your USB-to-TTL uses.
Also install the AdafruitIO, DHT and ESP8266 libraries from the Arduino Library Manager.
If your code is successfully loaded on the ESP then you’ll need to remove the GPIO0 pin connected to LOW. To run it from internal Flash Memory.
Reference code is available at my GITHUB
3. Connecting the DHT-11
Once the GPIO2 pin of ESP is connected to the Data pin of DHT module and VCC and GND are connected both devices will do their job and you’ll successfully see the data on your Adafruit IO feed.
Using these two feeds we can create a Dashboard which will help us to visualize data. After doing this the data can be seen as follows.