Introduction: Pocket Temp Meter

About: Hello world;

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 Instructables is about the build process of this device, so let's get started with the build.

Supplies

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

Step 1: 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.

Step 2: 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/

Step 3: 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.

Step 4: 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.

Step 5: 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.

Step 6: 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.

Step 7: 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.

Step 8: RESULT SO FAR

Here's the result so far: the circuit is working, as you can see.

The AHT10 Sensor and ESP32C3 DEV Board, the project's main brain, are mounted on the back circuit. The SSD1306 OLED screen is located on the front circuit, and the I2C ports (SDA, SCL) and power lines (VCC and GND) connect the two boards.

Step 9: 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.instructables.com/Live-TEMP-Meter-With-XIAO-and-AHT10/

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 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;
}
}

To run this code, make sure to download and install the AHT10 Sensor library from the below link.

https://github.com/enjoyneering/AHT10

Step 10: 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.

Step 11: 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.

Step 12: 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.

Step 13: 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!