Verify internal temp sensor is live via CPU stress test

- temp sensor confirmed responsive to die heating (27.6 -> 28.6 C under load)
- document quantization/calibration: readout sticks to ~1C steps ending in .6
  (inherent to ESP32-H2 internal sensor, not a bug)
- keep CPU_STRESS_TEST as a debug toggle (default off)
This commit is contained in:
temphummon dev 2026-09-24 18:10:12 +00:00
commit 96089c168f
2 changed files with 29 additions and 0 deletions

View file

@ -274,6 +274,17 @@ Current firmware (`main/temphummon.c`):
- Bit 1 of `f[13]` (`0x02`) is NOT used for °C (leaves the degree circle incomplete)
— `0x05` = °C (bits 0+2) is the correct full-degree rendering
### Internal temp sensor — accuracy/resolution notes (verified)
The internal CPU die sensor is **live** (a CPU-stress test during bring-up
raised its reading 27.6 → 28.6°C and held it, confirming the die heats). It
measures the **silicon die**, NOT ambient air — blowing on it barely changes it.
The readout is **coarsely quantized with a per-chip calibration offset**: values
appear stuck in ~1°C steps and always end in `.6` (e.g. 27.6 / 28.6). This is
an inherent limitation of the ESP32-H2 internal sensor, not a firmware bug.
For a real ambient thermometer, wire an **external I²C sensor** (BME280/SHT40)
instead — see TODO.
⚠️ The display uses a dot-matrix glyph style. A lone bit does not always
produce a clean segment; the erase flash (white frame) is normal before each
partial update.

View file

@ -59,6 +59,13 @@ static const uint8_t DIG_L[10][2] = {
#define ICON_BAT 0x10 /* battery/power */
#define ICON_BT_BAT 0x1D /* °C + Bluetooth + battery */
/* Debug: burn CPU for a while to stress the die and verify the internal
* temp sensor responds. Set to 1 to spin in a busy loop for STRESS_MS
* after each read (should raise/perturb the die temp).
* Verified: die rises 27.6 -> 28.6°C under load (sensor is live). */
#define CPU_STRESS_TEST 0
#define STRESS_MS 3000
static void epd_wait_busy(void) {
/* BUSY_N: LOW = busy, HIGH = ready */
while (gpio_get_level(PIN_BUSY) == 0) vTaskDelay(1);
@ -188,6 +195,17 @@ void app_main(void) {
ESP_ERROR_CHECK(temperature_sensor_get_celsius(tsens, &t));
ESP_LOGI("temphummon", "T: %.1f°C", (double)t);
#if CPU_STRESS_TEST
/* Burn CPU hard for STRESS_MS to heat the die. */
uint32_t ticks = pdMS_TO_TICKS(STRESS_MS);
uint32_t start = xTaskGetTickCount();
volatile uint32_t sink = 1;
while ((xTaskGetTickCount() - start) < ticks) {
for (uint32_t i = 0; i < 100000; i++) sink = sink * 131 + i; /* ~busy */
}
(void)sink;
#endif
uint8_t f[15]; memset(f, 0, 15);
render_temp(f, t);
render_humidity(f, 88.8f); /* fixed sample until a humidity sensor is wired */