Projects / Hot car cabin logger

Hot car cabin logger

Beginner1 hGuided buildReviewed

Build it step by step

0 of 7 done
  1. ESP32SHT3125.4°C

    Wire the sensor

    Connect the SHT31 and check the reading on the serial monitor.

  2. ESP32SHT31MICROSSANDIS25.4°C

    Add the SD module

    Connect the SPI lines and format the card as FAT32.

  3. ESP32

    Upload the sketch

    Check that CAR.CSV is created.

  4. ESP32

    Choose a safe test

    Stay with the car with an adult, on a sunny day, for no more than an hour.

  5. ESP32

    Place the logger

    At seat height, out of direct sun on the sensor.

  6. ESP32SHT31MICROSSANDIS25.4°C

    Read the card

    Open CAR.CSV in a spreadsheet and draw the graph.

  7. ESP32SHT3125.4°C

    Share the result

    Show how fast the temperature rose compared with outside.

In short

How do you build a hot car cabin logger?

A logger shows how hot a parked car gets, to show the danger to children and pets. You need Seeed XIAO ESP32C3, SHT31 temperature and humidity sensor, MicroSD Card Module, SanDisk microSD card 32 GB (A1, Class 10) and Li-Po battery 3.7 V 500 mAh. It takes 7 steps and about 60 minutes.

Level
Beginner
Time
About 60 min
Parts
5

Parts list

Tick what you already own. It saves to My Garage, so “Build with what I have” knows.

Wiring

FromToWhy
SHT31 VCCXIAO 3V3Power
SHT31 GNDXIAO GNDGround
SHT31 SDAXIAO D4I2C data
SHT31 SCLXIAO D5I2C clock
SD module VCCXIAO 3V3Power, use a 3.3 V module
SD module GNDXIAO GNDGround
SD module CSXIAO D2Chip select
SD module SCKXIAO D8SPI clock
SD module MISOXIAO D9SPI data from the card
SD module MOSIXIAO D10SPI data to the card
Li-po batteryXIAO battery pads, observe + and -Power and charging

Code

Never leave a child or a pet in a parked car, even for a minute. This logger is for showing how fast the cabin heats up, and you should always stay with the car or place it in a safe test setting with an adult. Cabin temperatures can reach 60 °C and above on a sunny day, which is hotter than a Li-po battery should be allowed to get, so keep the battery shaded and do not leave it in a hot car for long; for a long test use a power bank kept in shade or run a short test of an hour. There is no clock in this build, so times are minutes from power-up; note when you started. The SHT31 itself is rated up to 125 °C. Arduino IDE with the ESP32 boards package, board "XIAO_ESP32C3".

Runs on a virtual Seeed XIAO ESP32-C3 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).

// Libraries: Adafruit SHT31, SD (built in). Board: XIAO_ESP32C3.
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <Adafruit_SHT31.h>

Adafruit_SHT31 sht;
const byte CS = D2;
unsigned long minutes = 0;

void setup() {
  Serial.begin(115200);
  Wire.begin(D4, D5);
  if (!sht.begin(0x44)) { Serial.println("SHT31 not found"); while (1) delay(1000); }
  if (!SD.begin(CS)) { Serial.println("SD failed"); while (1) delay(1000); }
  if (!SD.exists("/CAR.CSV")) {
    File f = SD.open("/CAR.CSV", FILE_WRITE);
    f.println("minutes,temperature_c,humidity_pct");
    f.close();
  }
}

void loop() {
  float t = sht.readTemperature(), h = sht.readHumidity();
  if (!isnan(t) && !isnan(h)) {
    File f = SD.open("/CAR.CSV", FILE_APPEND);
    if (f) { f.print(minutes); f.print(","); f.print(t, 1); f.print(","); f.println(h, 1); f.close(); }
    Serial.printf("%lu min  %.1f C  %.0f %%\n", minutes, t, h);
  }
  minutes++;
  delay(60000);                          // one reading a minute
}

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 Seeed XIAO ESP32-C3 with its sensors at their default values. Your numbers will follow your real readings, but the format should match.

SHT31 not found

Test checklist

What you should see at each check. If a reading is far off, stop and use the troubleshooting list.

CheckExpected
Power upCAR.CSV created
Every minuteA new line on the card
Sunny day testTemperature rising well above the outside air
Spreadsheet chartA steady climb over the hour

If it does not work

SD failed

Check the wiring, FAT32 format and the CS pin.

SHT31 not found

Check SDA and SCL and the address 0x44.

Readings too high in sun

Shade the sensor from direct sunshine.

Battery very warm

Stop the test and shade it.

Still stuck? Find the fault step by step with your multimeter →

Ask Lark AI

Common questions

What parts do I need for the hot car cabin logger?

Seeed XIAO ESP32C3, SHT31 temperature and humidity sensor, MicroSD Card Module, SanDisk microSD card 32 GB (A1, Class 10) and Li-Po battery 3.7 V 500 mAh.

How long does the hot car cabin logger take to build?

About 60 minutes for a beginner maker, in 7 steps.

How do I know the hot car cabin logger works?

Power up: CAR.CSV created. Every minute: A new line on the card. Sunny day test: Temperature rising well above the outside air.

SD failed: what should I check?

Check the wiring, FAT32 format and the CS pin.

SHT31 not found: what should I check?

Check SDA and SCL and the address 0x44.

Readings too high in sun: what should I check?

Shade the sensor from direct sunshine.

Battery very warm: what should I check?

Stop the test and shade it.