Pocket Temp Meter
Greetings and welcome back.
So here's something portable and useful: the Pocket TEMP Meter project.
As the name suggests, this is a compact, useful temperature and humidity meter made of an ESP32C3-based development board, an SSD1306 OLED display, an AHT10 sensor, a LiPo cell, and 3D printed parts.
Here, TEMP values are taken using the AHT10 temperature and humidity sensor, which displays the data on the OLED screen. We were able to reduce the device's size to a tiny 25x25x48mm formfactor, which makes it perfect for carrying around in our pockets and letting us collect temperature readings whenever and wherever we want.
This is made possible by the small battery and relatively compact components utilized in the build.
The whole article is about the build process of this device, so let's get started with the build.
Materials required
These were the components used in this build:
- SSD1306 Display (Got from PCBWAY's Gift Shop)
- ESP32C3 DEV Board Beetle
- 3D-printed parts
- AHT10 Temp Sensor
- Prototyping Board
- LiPo cell, 3.7V-100mAh cell
- M2 Screws
- Wires
SSD1306 OLED Screen
The 0.91-inch SSD1306 OLED Display is a compact and versatile screen commonly used in electronic projects and devices. Featuring OLED (Organic Light-Emitting Diode) technology, this display provides crisp and vibrant visuals with high contrast and wide viewing angles. The SSD1306 controller chip is employed to drive the display, enabling compatibility with various microcontrollers and single-board computers.
With a resolution typically around 128x32 pixels or 128x64 pixels, the 0.91-inch OLED display offers a small form factor suitable for applications where space is limited.
We're using a 128x32-pixel display in this project.
Its monochromatic display capability makes it energy-efficient, well-suited for battery-powered devices. The I2C communication protocol is commonly used for interfacing with the display, ensuring ease of integration into different projects.
These displays find applications in a wide range of DIY electronics, wearable gadgets, and prototyping projects, where real-time information or simple graphics are required in a compact form. The 0.91-inch SSD1306 OLED Display's versatility, small size, and energy efficiency make it a popular choice among hobbyists and developers for enhancing user interfaces in various electronic creations.
PCBWAY GIFTSHOP
https://www.pcbway.com/project/gifts_detail/0_91__OLED_LCD_Display_Module.html
As for sourcing the OLED display, we got it from PCBWAY's Giftshop.
PCBWAY Gift Shop is an online marketplace where you can get a variety of electronics modules and boards for their genuine price, or you could use the PCBWAY currency, which is called beans.
You get beans after ordering something from PCBWAY as reward points, or you can also get them by posting any project in the PCBWAY community.
Check PCBWAY out for great PCB service from here: https://www.pcbway.com/
Breadboard Setup
This is the breadboard setup, the first level of the project.
It is made up of the SSD1306 display and the ESP32C3 DEV board connected to an AHT10 temperature and humidity sensor on a breadboard with jumper wires.
We linked the VCC of the AHT10 Sensor, the SSD1306 Display, and the ESP32 DEV Board.
next, we connected GND of all three modules together
Finally, we linked the I2C pins of the AHT10 sensor, the display, and the ESP32 DEV board in parallel.
We loaded the attached code into the ESP32 DEV Board, and our setup is working and displaying TEMP data on the SSD1306 display.
LEVEL 2
After completing Level 1 of this project, which was to make a simple running breadboard version, let's level up this project and make a proper circuit on a prototyping board.
Two 42 mm by 22 mm prototyping PCBs will be used for LEVEL 2, and all three modules will be soldered onto them.
The SSD1306 OLED screen will be placed in the center of the front PCB, while the ESP32 DEV Board and AHT10 Sensor will be mounted on the back PCB.
There will be a little LiPo cell placed between the front and rear PCBs.
Let's have a look at the assembly process.
CIRCUIT ASSEMBLY: ESP32 and AHT10 PCB
- We begin by assembling the ESP32C3 DEV board and the AHT10 sensor onto the prototype board, then soldering their pads to securely connect them to the board.
- Next, we connected both of their VCC pins together with GND and then the two I2C pins together as well.
- In our case, the ESP32C3 Beetle DEV Board's SDA and SCL pins were GPIO8 and GPIO9.
CIRCUIT ASSEMBLY: SSD1306 Screen
- After that, we put the SSD1306 screen in the middle and soldered its pins to secure it to the prototype board. That was all that was required to assemble the SSD1306 display circuit.
CIRCUIT ASSEMBLY: Combining both Circuits together
- The front PCB and the back PCB will now be connected by four more wires that we have added to the SSD1306 Display's terminals. These wires are VCC of the SSD1306 going to VCC of the ESP32, GND to GND, SCL to SCL, and SDA to SDA.
CODE
This code is the same as the one that I used for my previous project, which was a live temperature meter for my motorcycle.
https://www.hackster.io/Arnov_Sharma_makes/live-temp-meter-with-xiao-and-aht10-c482ea
This code essentially demonstrates how to use the AHT10 sensor library to read temperature and humidity, display the results on an OLED screen, and handle errors. The delays between measurements are implemented to avoid heating the sensor
#include <Wire.h> #include <AHTxx.h> #include <Adafruit_SSD1306.h> #include <Adafruit_GFX.h> #define OLED_WIDTH 128 #define OLED_HEIGHT 32 #define OLED_ADDR 0x3C Adafruit_SSD1306 display(OLED_WIDTH, OLED_HEIGHT); float ahtValue; //to store T/RH result AHTxx aht10(AHTXX_ADDRESS_X38, AHT1x_SENSOR); //sensor address, sensor type void setup() { #if defined(ESP8266) WiFi.persistent(false); //disable saving wifi config into SDK flash area WiFi.forceSleepBegin(); //disable AP & station by calling "WiFi.mode(WIFI_OFF)" & put modem to sleep#endif display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR); display.clearDisplay(); Serial.begin(115200); Serial.println(); while (aht10.begin() != true) //for ESP-01 use aht10.begin(0, 2); { Serial.println(F("AHT1x not connected or fail to load calibration coefficient")); //(F()) save string to flash & keeps dynamic memory free delay(5000); } Serial.println(F("AHT10 OK")); //Wire.setClock(400000); //experimental I2C speed! 400KHz, default 100KHz } void loop() { /* DEMO - 1, every temperature or humidity call will read 6-bytes over I2C, total 12-bytes */ Serial.println(); Serial.println(F("DEMO 1: read 12-bytes")); ahtValue = aht10.readTemperature(); //read 6-bytes via I2C, takes 80 milliseconds display.clearDisplay(); display.setTextSize(2); display.setTextColor(WHITE); display.setCursor(30, 0); display.println(F("Temp-")); // Serial.print(F("Temperature...: ")); if (ahtValue != AHTXX_ERROR) //AHTXX_ERROR = 255, library returns 255 if error occurs { display.setTextSize(2); display.setTextColor(WHITE); display.setCursor(35, 25); display.println(ahtValue); display.display(); // Serial.print(ahtValue); } else { printStatus(); //print temperature command status if (aht10.softReset() == true) Serial.println(F("reset success")); //as the last chance to make it aliveelse Serial.println(F("reset failed")); } delay(2000); //measurement with high frequency leads to heating of the sensor, see NOTE ahtValue = aht10.readHumidity(); //read another 6-bytes via I2C, takes 80 milliseconds display.clearDisplay(); display.setTextSize(2); display.setTextColor(WHITE); display.setCursor(30, 0); display.println(F("Humd-")); // Serial.print(F("Humd-")); if (ahtValue != AHTXX_ERROR) //AHTXX_ERROR = 255, library returns 255 if error occurs { display.setTextSize(2); display.setTextColor(WHITE); display.setCursor(35, 25); display.println(ahtValue); display.display(); // Serial.println(F(" +-2%")); } else { printStatus(); //print humidity command status } delay(2000); //measurement with high frequency leads to heating of the sensor, see NOTE /* DEMO - 2, temperature call will read 6-bytes via I2C, humidity will use same 6-bytes */ Serial.println(); Serial.println(F("DEMO 2: read 6-byte")); ahtValue = aht10.readTemperature(); //read 6-bytes via I2C, takes 80 milliseconds Serial.print(F("Temperature: ")); if (ahtValue != AHTXX_ERROR) //AHTXX_ERROR = 255, library returns 255 if error occurs { Serial.print(ahtValue); Serial.println(F(" +-0.3C")); } else { printStatus(); //print temperature command status } ahtValue = aht10.readHumidity(AHTXX_USE_READ_DATA); //use 6-bytes from temperature reading, takes zero milliseconds!!! Serial.print(F("Humidity...: ")); if (ahtValue != AHTXX_ERROR) //AHTXX_ERROR = 255, library returns 255 if error occurs { Serial.print(ahtValue); Serial.println(F(" +-2%")); } else { printStatus(); //print temperature command status not humidity!!! RH measurement use same 6-bytes from T measurement } delay(10000); //recomended polling frequency 8sec..30sec } void printStatus() { switch (aht10.getStatus()) { case AHTXX_NO_ERROR: Serial.println(F("no error")); break; case AHTXX_BUSY_ERROR: Serial.println(F("sensor busy, increase polling time")); break; case AHTXX_ACK_ERROR: Serial.println(F("sensor didn't return ACK, not connected, broken, long wires (reduce speed), bus locked by slave (increase stretch limit)")); break; case AHTXX_DATA_ERROR: Serial.println(F("received data smaller than expected, not connected, broken, long wires (reduce speed), bus locked by slave (increase stretch limit)")); break; case AHTXX_CRC8_ERROR: Serial.println(F("computed CRC8 not match received CRC8, this feature supported only by AHT2x sensors")); break; default: Serial.println(F("unknown status")); break; } }
To run this code, make sure to download and install the AHT10 Sensor library from the below link.
https://github.com/enjoyneering/AHT10
Adding LiPo cell to Circuit
We are using a little 3.7V 100mAh LiPo cell for portable power, and we have linked its positive terminals to the battery connector of the ESP32C3 Beetle Board. GND is connected to a sliding switch that we added to the front PCB later.
To turn this configuration on and off, a slide switch is linked between the ESP32 DEV board's GND and the battery's negative terminal.
The circuit has now been assembled.
3D ENCLOSURE DESIGN
By first creating a model of the circuit in Fusion360 and then constructing an enclosure around it, we were able to create a basic enclosure for the circuit setup.
The plan was to create a two-part enclosure, the lower body of which would be used to slide both circuits (front and back). The ESP32 and AHT10 sensors are exposed on the rear, allowing us to reprogram the ESP32 and obtain accurate environmental readings from the back side.
The lid, which secures the circuit from above, was modeled next. Two M2 screw holes were created, which will be used to fasten the lid to the lower body.
Once the design was finished, we exported the two mesh files and used my ender 3 printer to 3D print them, using green PLA for the lid and transparent PLA for the base.
ASSEMBLY
- The final assembly process begins by first taking the lower body part and sliding the front circuit, battery, and back circuit in their place.
- Next, we place the lid on top of the lower body and use two M2 screws to secure both of them permanently.
The pocket temperature and humidity meter is now ready.
RESULT
So here's the result of this simple build: a small, compact temperature and humidity meter made from scratch using a custom circuit and 3D-printed parts.
In the event that you want to collect temperature readings at different points in a row, the AHT10's accurate temperature readings are useful. The goal was to utilize this small meter, which is easy to take around and portable, to test the humidity and temperature of two different rooms at my place of work.
As for Level 3 of this project, I will be using a custom PCB in the next iteration of this project, so stay tuned for that.
I have included all the files, so you may try making one on your own.
Leave a comment if you need any help regarding this project. This is it for today, folks.
Thanks to PCBWAY for supporting this project.
You guys can check them out if you need great PCB and stencil service for less cost and great quality.
And I'll be back with a new project pretty soon!
#include <Wire.h>
#include <AHTxx.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_GFX.h>
#define OLED_WIDTH 128
#define OLED_HEIGHT 32
#define OLED_ADDR 0x3C
Adafruit_SSD1306 display(OLED_WIDTH, OLED_HEIGHT);
float ahtValue; //to store T/RH result
AHTxx aht10(AHTXX_ADDRESS_X38, AHT1x_SENSOR); //sensor address, sensor type
void setup()
{
#if defined(ESP8266)
WiFi.persistent(false); //disable saving wifi config into SDK flash area
WiFi.forceSleepBegin(); //disable AP & station by calling "WiFi.mode(WIFI_OFF)" & put modem to sleep
#endif
display.begin(SSD1306_SWITCHCAPVCC, OLED_ADDR);
display.clearDisplay();
Serial.begin(115200);
Serial.println();
while (aht10.begin() != true) //for ESP-01 use aht10.begin(0, 2);
{
Serial.println(F("AHT1x not connected or fail to load calibration coefficient")); //(F()) save string to flash & keeps dynamic memory free
delay(5000);
}
Serial.println(F("AHT10 OK"));
//Wire.setClock(400000); //experimental I2C speed! 400KHz, default 100KHz
}
void loop()
{
/* DEMO - 1, every temperature or humidity call will read 6-bytes over I2C, total 12-bytes */
Serial.println();
Serial.println(F("DEMO 1: read 12-bytes"));
ahtValue = aht10.readTemperature(); //read 6-bytes via I2C, takes 80 milliseconds
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(30, 0);
display.println(F("Temp-"));
// Serial.print(F("Temperature...: "));
if (ahtValue != AHTXX_ERROR) //AHTXX_ERROR = 255, library returns 255 if error occurs
{
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(35, 25);
display.println(ahtValue);
display.display();
// Serial.print(ahtValue);
}
else
{
printStatus(); //print temperature command status
if (aht10.softReset() == true) Serial.println(F("reset success")); //as the last chance to make it alive
else Serial.println(F("reset failed"));
}
delay(2000); //measurement with high frequency leads to heating of the sensor, see NOTE
ahtValue = aht10.readHumidity(); //read another 6-bytes via I2C, takes 80 milliseconds
display.clearDisplay();
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(30, 0);
display.println(F("Humd-"));
// Serial.print(F("Humd-"));
if (ahtValue != AHTXX_ERROR) //AHTXX_ERROR = 255, library returns 255 if error occurs
{
display.setTextSize(2);
display.setTextColor(WHITE);
display.setCursor(35, 25);
display.println(ahtValue);
display.display();
// Serial.println(F(" +-2%"));
}
else
{
printStatus(); //print humidity command status
}
delay(2000); //measurement with high frequency leads to heating of the sensor, see NOTE
/* DEMO - 2, temperature call will read 6-bytes via I2C, humidity will use same 6-bytes */
Serial.println();
Serial.println(F("DEMO 2: read 6-byte"));
ahtValue = aht10.readTemperature(); //read 6-bytes via I2C, takes 80 milliseconds
Serial.print(F("Temperature: "));
if (ahtValue != AHTXX_ERROR) //AHTXX_ERROR = 255, library returns 255 if error occurs
{
Serial.print(ahtValue);
Serial.println(F(" +-0.3C"));
}
else
{
printStatus(); //print temperature command status
}
ahtValue = aht10.readHumidity(AHTXX_USE_READ_DATA); //use 6-bytes from temperature reading, takes zero milliseconds!!!
Serial.print(F("Humidity...: "));
if (ahtValue != AHTXX_ERROR) //AHTXX_ERROR = 255, library returns 255 if error occurs
{
Serial.print(ahtValue);
Serial.println(F(" +-2%"));
}
else
{
printStatus(); //print temperature command status not humidity!!! RH measurement use same 6-bytes from T measurement
}
delay(10000); //recomended polling frequency 8sec..30sec
}
void printStatus()
{
switch (aht10.getStatus())
{
case AHTXX_NO_ERROR:
Serial.println(F("no error"));
break;
case AHTXX_BUSY_ERROR:
Serial.println(F("sensor busy, increase polling time"));
break;
case AHTXX_ACK_ERROR:
Serial.println(F("sensor didn't return ACK, not connected, broken, long wires (reduce speed), bus locked by slave (increase stretch limit)"));
break;
case AHTXX_DATA_ERROR:
Serial.println(F("received data smaller than expected, not connected, broken, long wires (reduce speed), bus locked by slave (increase stretch limit)"));
break;
case AHTXX_CRC8_ERROR:
Serial.println(F("computed CRC8 not match received CRC8, this feature supported only by AHT2x sensors"));
break;
default:
Serial.println(F("unknown status"));
break;
}
}
Pocket Temp Meter
- Comments(0)
- Likes(0)
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by Arnov Arnov sharma
- WALKPi PCB Version Greetings everyone and welcome back, This is the WalkPi, a homebrew audio player that plays music fr...
- Delete Button XL Greetings everyone and welcome back, and here's something fun and useful.In essence, the Delete Butt...
- Arduino Retro Game Controller Greetings everyone and welcome back. Here's something fun.The Arduino Retro Game Controller was buil...
- Super Power Buck Converter Greetings everyone and welcome back!Here's something powerful, The SUPER POWER BUCK CONVERTER BOARD ...
- Pocket Temp Meter Greetings and welcome back.So here's something portable and useful: the Pocket TEMP Meter project.As...
- Pico Powered DC Fan Driver Hello everyone and welcome back.So here's something cool: a 5V to 12V DC motor driver based around a...
- Mini Solar Light Project with a Twist Greetings.This is the Cube Light, a Small and compact cube-shaped emergency solar light that boasts ...
- PALPi V5 Handheld Retro Game Console Hey, Guys what's up?So this is PALPi which is a Raspberry Pi Zero W Based Handheld Retro Game Consol...
- DIY Thermometer with TTGO T Display and DS18B20 Greetings.So this is the DIY Thermometer made entirely from scratch using a TTGO T display board and...
- Motion Trigger Circuit with and without Microcontroller GreetingsHere's a tutorial on how to use an HC-SR505 PIR Module with and without a microcontroller t...
- Motor Driver Board Atmega328PU and HC01 Hey, what's up folks here's something super cool and useful if you're making a basic Robot Setup, A ...
- Power Block Hey Everyone what's up!So this is Power block, a DIY UPS that can be used to power a bunch of 5V Ope...
- Goku PCB Badge V2 Hey everyone what's up!So here's something SUPER cool, A PCB Board themed after Goku from Dragon Bal...
- RGB Mixinator V2 Hey Everyone how you doin!So here's a fun little project that utilizes an Arduino Nano, THE MIXINATO...
- Gengar PCB Art Hey guys and how you doing!So this is the GENGAR PCB Badge or a Blinky Board which is based around 5...
- R2D2 Mini Edition So here's something special, A Mini R2D2 PCB that speaks ASTROMECH.Astromech is a fictional language...
- C-3PO Blinky Board Hey guys and how you doing!So this is the C3P0 PCB Badge or a Blinky Board which is based around 555...
- WALKPi Breadboard Version Greetings everyone and welcome back, Here's something loud and musical.Similar to a traditional walk...
-
-
kmMiniSchield MIDI I/O - IN/OUT/THROUGH MIDI extension for kmMidiMini
74 0 0 -
DIY Laser Power Meter with Arduino
86 0 2 -
-
-
Box & Bolt, 3D Printed Cardboard Crafting Tools
120 0 2 -
-
A DIY Soldering Station Perfect for Learning (Floppy Soldering Station 3.0)
416 0 1 -
Custom Mechanic Keyboard - STM32
243 0 3