A small box that displays the surrounding air's current temperature and humidity on a small circular LCD. Managed by a powerful wifi/bluetooth-capable chip, the ESP32-WROOM, it reads data from a DHT11 sensor and updates the small display on a regular interval with the current temperature and humidity data.
Here is a showcase gallery of the finished device, including images of the inner electronics, outer shell, and design work. Below are sections detailing the actual step-by-step development process for the device.
Start to finish of how I developed the device.
During the summer I had the idea to create a small device that continently displays the temperature of the room that you are in, and I decided I wanted to develop that idea and create something out of it. To begin, I developed a simple sketch of what I thought the device would look like as well as a general schematic for the electronics of the device. After sketching the general schematic of the electronics (seen at the bottom), I hopped into KiCad and got to work translating it into the program. I used Fab Academy's Fab KiCad library to get a host of schematics I'd need for the project, it can be found here. Note that I chose to use an Atmel chip instead of a Nano from my original schematic once I was in the program. For reference of pinouts on the 1614, I used somebody else's documentation found here. I ultimately got to the point of adding the screen to my schematic, at which point I realized the chip I selected may not be capable of storing the libraries that might be needed to display the graphics I would need on the screen. I did lots of digging and experimenting, with ChatGPT helping a lot, and ultimately found that the 1614 would thankfully meet my needs as the libraries and program I wanted to upload would take about 6 kb of space and the 1614 has around 16 kb of flash storage on it. For code and wiring references, I used this tutorial. Using the pinouts provided on this tutorial for the screen I drew a custom symbol in KiCad for the screen: I then added this custom symbol to my schematic and then using this source I compared where the pins were going on the Uno to correctly translate them to my chip. I came up with this schematic finally: I then hopped into KiCad's PCB design tool and began routing traces between all my components, and it was very difficult. I unfortunately ended up having to add 3 0 Ohm resistors to get the job down to jump gaps on the board that were otherwise impossible, and I came up with this: And here is how it is going to look in 3D: I now developed a Bill of Materials (BOM) for the project, as seen below:
Item | Quantity | Price | Link |
---|---|---|---|
ATtiny1614 | 1 | $0.90 | Link to buy |
L7805 | 1 | $0.33 | Link to buy |
DH11 | 1 | $1.73 | Link to buy |
Horizontal Headers | 1 | $0.23 | Link to buy |
0Ω Resistor | 3 | $0.30 | Link to buy |
330Ω Resistor | 2 | $0.20 | Link to buy |
4.7kΩ Resistor | 1 | $0.10 | Link to buy |
100Ω Resistor | 1 | $0.18 | Link to buy |
220Ω Resistor | 1 | $0.10 | Link to buy |
TFT Screen | 1 | $6.00 | Link to buy |
Manufactured PCB | 1 | $2.00 | Link to buy |
Shipping & Handling | 1 | $24.79 | |
Total | 14 | $39.86 |
I also made note from here that I needed to have a resistor from VCC to the IO pin of the sensor if I wasn't using the typical DHT11 module that is typically sold, so I implimented that into my KiCad design as well. I also had to adjust the voltage divider resistances from 330 and 640 to 100 and 220 due to the former being rarer values of resistance (640 specifically). Overall the manufacturing of the PCB and parts total just under $40, though most of that is shipping so in bulk the cost is way lower to make these. I decided before I order everything I'd do a comprehensive electronics review to make sure everything was designed correctly, so I did that next.
I then built a prototype using an Arduino Uno in tandem with the screen. I configured code and wiring, but ultimately found that the Uno had no where near enough storage space to hold the necessary libraries to run the program, meaning my 1614 would also be incapable of doing so, which was a surprise to what I thought I had determined to be safe earlier. I then as a result switched to an ESP32 board and used a similar setup and was able to get the screen working properly with the ESP32 displaying the temperature and humidity to the screen from a DHT11 sensor. From here, I moved to doing CAD work for housing. With this chip switch, notably, I also decided to ditch the custom PCB approach I was initially going for.
I wired the circular LCD pins as follows:
Screen Pin | ESP32 Pin |
---|---|
RST | D4 |
CS | D5 |
DC | D21 |
SDA | D22 |
SCL | D18 |
GND | GND |
VCC | 3V3 |
And here is the code I used that allowed the screen to initialize and display information:
#include <Adafruit_GFX.h>
#include <Adafruit_GC9A01A.h>
// Define the pins used for the display
#define TFT_CS 5
#define TFT_RST 4
#define TFT_DC 21
#define TFT_MOSI 23
#define TFT_SCK 18
// Create an instance of the display
Adafruit_GC9A01A tft = Adafruit_GC9A01A(TFT_CS, TFT_DC, TFT_RST);
void setup() {
// Initialize the display
Serial.begin(9600);
tft.begin();
tft.setRotation(1); // Optional: Rotate the display
tft.fillScreen(GC9A01A_BLACK); // Clear the screen with black color
// Set text color and size
tft.setTextColor(GC9A01A_WHITE);
tft.setTextSize(8);
}
void loop() {
int f = 72;
int h = 55;
tft.fillScreen(GC9A01A_BLACK);
tft.setCursor(80, 50);
tft.println((int)f);
tft.setCursor(55, 140);
tft.print((int)h);
tft.println("%");
delay(2000);
}
The final code for the entire project goes as follows:
#include <Adafruit_GFX.h>
#include <Adafruit_GC9A01A.h>
// Define the pins used for the display
#define TFT_CS 5
#define TFT_RST 4
#define TFT_DC 21
#define TFT_MOSI 23
#define TFT_SCK 18
#include "DHT.h"
#define DHTPIN 15
#define DHTTYPE DHT11 // DHT 11
DHT dht(DHTPIN, DHTTYPE);
// Create an instance of the display
Adafruit_GC9A01A tft = Adafruit_GC9A01A(TFT_CS, TFT_DC, TFT_RST);
void setup() {
// Initialize the display
Serial.begin(9600);
dht.begin();
tft.begin();
tft.setRotation(1); // Optional: Rotate the display
tft.fillScreen(GC9A01A_BLACK); // Clear the screen with black color
// Set text color and size
tft.setTextColor(GC9A01A_WHITE);
tft.setTextSize(8);
}
void loop() {
float h = dht.readHumidity();
float f = dht.readTemperature(true);
if (isnan(h) || isnan(f)) {
return;
}
tft.fillScreen(GC9A01A_BLACK);
tft.setCursor(80, 50);
tft.println((int)f);
tft.setCursor(55, 140);
tft.print((int)h);
tft.println("%");
delay(2000);
}
Note that the DHT11 sensor is hooked up as follows:
DHT11 Pin | ESP32 Pin |
---|---|
VCC | 3.3V |
Data | D15 | GND | GND |
Ultimately, the CAD work for the electronics housing/box as a whole came out as follows:
I was happy with the design, as this was a few iterations in, and decided to print it out on my Bambu Labs A1. I did so, and assembled the device, and things fit together well. It features 6 nuts that are inserted during the print, both M2 and M3, that get sealed within the 3D print. This means I don't have to use any adhesives like glue which can be annoying and bad looking. It also means I don't have to fumble with bolting things in each and every time. All in all, it made it much easier to develop the project and put all of the electronics in place. I put everything together (as seen in the photos at the top of the page) and it turned out well. I plugged it in through the barrel jack to the VIN of the ESP board to test the device. At first, it was working just fine. However, after it running for less than a minute, the screen stopped updating and the smell coming from the box indicated to me that I burned a component inside. As it turns out, unlike any Arduino board I've used, the ESP32 development board I was using (the ESP32-S3 I believe) did not have a built in 5v regulator on its VIN connection, meaning I was pumping 12v directly into the device on accident, something I did not even consider could happen. I ended up as a result burning out my ESP board entirely. I immediately implemented an L7805 5v regulator to the input power lines to prevent this from happening in the future and I ordered a new ESP32 board of the same kind.
I printed that previous design, and everything fit accordingly. There was one issue however: the screen I used displays the info sideways, and the orientation I thought that the screen should be at to display text properly was wrong. I went back into the design and moved the mounting for the screen 90 degrees. I also, after some testing, realized the DHT11 needed to be outside of the box exposed to the air, as it was heating up inside the box with the electronics and giving false readings. I also moved the female barrel jack upward on the rear of the box. With all that, the design was done:
With that, I printed it out, and everything was working great!