IoT Temperature and Humidity Sensors
Introduction: IoT Temperature and Humidity Sensors
About a year ago, I felt like some rooms in my house were colder than other ones. I wanted to check for sure, so I built a few temperature and humidity sensors connected to my phone via wifi, and dispersed them in my house.
I could simply have picked up one thermometer, and moved it from room to room, but this way I can better see the temperature in real time, I can see how they evolve through the week or through the year, and I can see if the temperature in a room is completely off compared to the other ones. Plus, I can check the temperature and humidity when I'm away.
I wanted something very simple with no bells and whistles. I also wanted something small and neat looking since it will be installed permanently, this is why I designed my PCB, instead of using a breadboard.
My sensor simply plugs in a USB outlet to get the 5V power, this way there is no battery to change or recharge.
I am using and ESP8266 for the wifi connection because of its small size and cheap price.
I use the Blynk app to view the temperature and humidity on my phone, because of its simplicity of use, and because I already use this app for other IoT stuff in my house.
The total price per piece is about 23$ (not including shipping costs). Of course it can be cheaper or more expensive depending on where you source your components, and if you buy them in bulk.
Supplies:
* DHT22 temperature and humidity sensor
* ESP8266 wifi microcontroller
* LD1117V33 3.3V regulator
* 2x 10uF capacitors
* 10k resistor
* USB male type A connector
* custom-made PCB (or a solderable breadboard would work too)
* some female headers
* some 1/8" plexiglass
* a few PCB standoffs
Tools:
* Soldering iron
* Drill
* Eagle for PCB design
* an FT232RL USB to TTL Converter Module (to upload the code to the ESP8266)
Step 1: Design and Order Your PCB
Since I wanted a neat-looking and compact sensor, I decided to design and order my own PCB instead of using a breadboard. I used the Autocad Eagle software to design the PCB. It is free for personal use by hobbyists, with a few limitations (2 schematic sheets, 2 signal layers, and an 80cm2 board area, which is plenty enough for my needs). I usually first work on the schematics, and then on the board.
Schematics
What I do is that I first place all the components that I will need using the "add tool" button. I make sure that I have the Adafruit and Sparkfun libraries, which is where I order most of my components. 382
These libraries are downloadable from GitHub:
www.github.com/adafruit/Adafruit-Eagle-Library
www.github.com/sparkfun/SparkFun-Eagle-Librari...
Then I assemble the components by groups, such as power supply, sensors, microcontrollers, etc. Finally I link the components together, rotate them and move them around so that the scheme is easily readable.
In this example, the schematics is pretty straight forward. The power supply is 5V (from USB), but the ESP8266 uses 3.3V, hence the 3.3V regulator. I placed a capacitor on both the 5V and 3.3V. The DHT22 sensor is connected to 3.3V, ground, and the ESP's GPIO2. There is also a pullup resistor using the 10k resistor.
I found the following resource to be helpful when it comes to designing the schematics on Eagle: www.learn.sparkfun.com/tutorials/using-eagle-schematic
Board
Once the schematics is done, I start working on the board. The components and their connections are already placed automatically, but I still check them to make sure that there is no mistake.
I then rearrange the components to avoid the paths criss-crossing, and to make the paths as short as possible.
I then route the connections, using an appropriate width for the traces and clearance, and making sure that they are within the capabilities of the PCB manufacturer.
In this example, I have a ground plane at the back of the PCB, which is delimited by the dotted red line. To do this, I used the polygon tool.
The ESP8266 is clipped on female headers, which are soldered to the PCB. This way, the ESP8266 can be removed and reprogrammed down the road. 382