DHT 11 Temperature & Humidity Display
by JamesAllen in Circuits > Arduino
917 Views, 4 Favorites, 0 Comments
DHT 11 Temperature & Humidity Display
Parts Required (UK Shopping Stock)
Arduino Nano - https://www.amazon.co.uk/Arduino-compatible-Nano-CH340-USB/dp/B00ZABSNUS
DHT 11 Sensor - https://www.adafruit.com/product/386
1.3" OLED Green Screen https://www.amazon.co.uk/DSD-TECH-Screen-Supports-Arduino/dp/B07D9G11DZ
USB Micro Breakout Board - https://shop.pimoroni.com/products/adafruit-usb-micro-b-breakout-board
Tools Required -
Soldering Iron
Prototyping Board
Side Cutters
The Circuit
Step 1 - The Circuit
The DHT 11 Temperature sensor is a very simple temperature and humidity sensor. The basic components are a capacitive humidity sensor and a thermistor. There is some basic Analogue to Digital conversion which allows all the data needed to be output on one pin.
In this example, the DHT 11 connects to USB 5V and ground with the data pin connected to PIN2 of the Nano.
The Nano only needs 5V power and ground from the USB Breakout.
The OLED display uses 4 pins, 5V, GND, SCL and SDA. The SCL and SDA are the standard I2C pins which are universal for all I2C devices.
The pinout from the Arduino is as follows:
Pin 2 - DHT 11
Pin A4 - SDA
Pin A5 - SCL
The Code
The code is fairly straight forward and easy to upload to the Nano and is plug and play with no further configuration required.
You may need to install the following libraries if not already installed.
DHT.h - For the DHT11 Sensor
"U8glib.h - For the OLED Screen.
N.B If you have no display using this code, check the screen is correctly defined. It is "U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);" but may need to change if a different OLED panel is used. There are examples in the library which can test the screen.
Downloads
The Case
The case is a simple 2 piece design, the front snaps the screen in using 4 locator pins. The front assembly press fits into the housing. Light sanding or filing may be required for the 2 pieces to fit together.
There are holes for the DHT sensor on the top and the USB connector at the rear.
Print Settings
Printed on Ender 3
PLA White
20% Infill (Supports Required for Box)
Print time, c. 2-2.5 hours total
Conclusion
This is a great learning project on using sensors with the Arduino Nano. There is also the serial monitor (CTRL + M) to keep an eye on the data feed.
The learning objectives are:
Understanding Data from a Temperature Sensor Processing the data with the Microcontroller Output the Data onto a display (I2C)
There is a bug on the photos where the display says F but the temperature is in Celsius. This will be fixed.
Possible improvements/refinements are
Refine the 3D Design of the case Use the DHT22 sensor which sends data faster than the DHT 11. The sensor used in this project only updates every 2 seconds.
If you have any questions, feel free to leave a comment below.
Full files and any changes can be found here: https://github.com/jamesdallen91/DHT11