Build it step by step
0 of 6 doneWire the sensor and screen
Connect both on the I2C bus.
Check the readings
Compare with another thermometer or hygrometer.
Set the limit
Choose DAMP to suit your storage needs.
Mount it
Fix the board on the wall near the parts boxes.
Log a day
Capture the Serial output in a spreadsheet.
React
Add silica gel or a dehumidifier when it warns.
How do you build a lab environment board?
A wall display shows bench temperature and humidity and warns when it is too damp for storing parts. You need ESP32 DevKit V1, SHT31 temperature and humidity sensor, SSD1306 OLED Display and 5 V 2 A USB adapter. It takes 6 steps and about 30 minutes.
- Level
- Beginner
- Time
- About 30 min
- Parts
- 4
Parts list
- Development BoardsBuyESP32 DevKit V1 × 1
- SensorsBuy
- DisplaysBuy
- PowerBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| SHT31 SDA, SCL | ESP32 GPIO21, GPIO22 | I2C |
| SHT31 VCC, GND | ESP32 3V3, GND | Power |
| OLED SDA, SCL | ESP32 GPIO21, GPIO22 | I2C, same bus |
| OLED VCC, GND | ESP32 3V3, GND | Power |
| 5 V USB adapter | ESP32 USB | Power |
Code
Arduino IDE with the ESP32 boards package, board "ESP32 Dev Module". Install "Adafruit SHT31 Library" and "U8g2". Most electronic components and PCBs store best below about 60 percent humidity, and moisture-sensitive chips need to be dry. Mount the sensor on a wall away from the soldering station's heat and fumes. Add silica gel to the parts boxes if the warning appears often.
Runs on a virtual ESP32 Dev Module in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
#include <Wire.h>
#include <Adafruit_SHT31.h>
#include <U8x8lib.h>
Adafruit_SHT31 sht;
U8X8_SSD1306_128X64_NONAME_HW_I2C oled(U8X8_PIN_NONE);
const float DAMP = 60.0; // percent humidity above which parts storage is at risk
float minT = 99, maxT = -99, minH = 100, maxH = 0;
unsigned long dampSecs = 0;
void setup() {
Serial.begin(115200);
Wire.begin(21, 22);
sht.begin(0x44);
oled.begin();
oled.setFont(u8x8_font_chroma48medium8_r);
}
void loop() {
float t = sht.readTemperature(), h = sht.readHumidity();
if (!isnan(t) && !isnan(h)) {
minT = min(minT, t); maxT = max(maxT, t); minH = min(minH, h); maxH = max(maxH, h);
if (h > DAMP) dampSecs += 5;
char b[17], v[8];
dtostrf(t, 4, 1, v); snprintf(b, sizeof b, "Temp %s C ", v); oled.drawString(0, 0, b);
dtostrf(h, 4, 1, v); snprintf(b, sizeof b, "Hum %s %% ", v); oled.drawString(0, 2, b);
snprintf(b, sizeof b, "Max %2d/%2d %% ", (int)maxH, (int)minH); oled.drawString(0, 4, b);
snprintf(b, sizeof b, "Damp %lu min ", dampSecs / 60); oled.drawString(0, 6, b);
oled.setInverseFont(h > DAMP);
oled.drawString(0, 7, h > DAMP ? "TOO DAMP " : "Storage OK ");
oled.setInverseFont(0);
Serial.printf("%.1f,%.1f\n", t, h); // paste into a spreadsheet to log the day
}
delay(5000);
}What the serial monitor should show
Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual ESP32 Dev Module with its sensors at their default values. Your numbers will follow your real readings, but the format should match.
0.0,0.0
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Normal room | Storage OK |
| Breathe on the sensor | Humidity rises and may flash TOO DAMP |
| Min and max | Track the day's extremes |
| Damp minutes | Accumulate while above the limit |
If it does not work
Shows nan
Check SHT31 wiring and the 0x44 address.
Temperature reads high
Keep the sensor away from the ESP32 and heat sources.
OLED blank
Check the I2C address and wiring.
Humidity looks wrong
Let it settle for a few minutes after moving rooms.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the lab environment board?
ESP32 DevKit V1, SHT31 temperature and humidity sensor, SSD1306 OLED Display and 5 V 2 A USB adapter.
How long does the lab environment board take to build?
About 30 minutes for a beginner maker, in 6 steps.
How do I know the lab environment board works?
Normal room: Storage OK. Breathe on the sensor: Humidity rises and may flash TOO DAMP. Min and max: Track the day's extremes.
Shows nan: what should I check?
Check SHT31 wiring and the 0x44 address.
Temperature reads high: what should I check?
Keep the sensor away from the ESP32 and heat sources.
OLED blank: what should I check?
Check the I2C address and wiring.
Humidity looks wrong: what should I check?
Let it settle for a few minutes after moving rooms.
