ESP ZeroCode AI · Community
temperature meter
Create a counter with a 4-digit display that shows the temperature from the connected temperature sensor.
What it does
- A 4-digit display shows the temperature measured by the connected temperature sensor.
- The temperature is shown with one decimal place and no unit letter.
- When the sensor stops answering, the display shows ----.
Manual
Summary
A standalone temperature meter. An SHT31-D digital temperature sensor on the I2C bus is read every second and its reading is shown on a 4-digit TM1637 7-segment display as a temperature in degrees Celsius with one decimal place (e.g. `23.5`). The device needs no network, no phone app and no account: it starts measuring and displaying as soon as it is powered over USB.
Hardware
chip: esp32c3 — board: ESP32-C3-DevKitM-1 (esp32-c3-devkitm-1); micro-USB connector; the board is the only power source. — parts: name: 4-digit 7-segment display module on TM1637 — the user's own module — supply: 3.3 V from the board's 3V3 pin — wiring: CLK → GPIO4, DIO → GPIO5, VCC → 3V3, GND → GND — note: The TM1637 uses its own 2-wire protocol on CLK/DIO; it is not I2C. Segments light from the display's own driver; no series resistors or level shifting are needed at 3.3 V. · name: SHT31-D temperature sensor (I2C) — replaces the TMP102 at the user's request, so the virtual device can model the sensor — supply: 3.3 V from the board's 3V3 pin (VIN pin) — wiring: SDA → GPIO6, SCL → GPIO7, VIN → 3V3, GND → GND; ADR and ALR pins left unconnected — address: 0x44 (SHT31-D default with ADR low) — note: Driven by the catalog's SHT3x block (drivers/sht3x over peripherals/i2c_bus), not by hand-written sensor code. The sensor also reports relative humidity; only its temperature is used and displayed. — unused_board_hardware: The board's on-board WS2812 LED on GPIO8 and BOOT button on GPIO9 are not used. GPIO18/GPIO19 are the USB pins and GPIO20/GPIO21 the console pins — none of the four is wired to a part. — how_this_was_settled: Board, display type, pins, supplies and the 3.3 V rail were proposed by the AI and agreed by the user. The sensor started as a TMP102 (the user's own part) and was replaced with the SHT31-D on the user's decision, after the virtual device could not model a TMP102 — the SHT31-D is catalog-driven and simulatable.
Behaviour
power_on: Within a second or two of power being applied the display lights up and shows the current temperature. No button press and no setup is needed. — update_rate: The SHT31-D is read every 1 s and the display is rewritten every 1 s (AI's choice — the user specified no rate). — display_format: One decimal place, no unit letter (user's choice). 23.5 °C shows as `23.5`; the decimal point is the module's own point between the second and third digit. — negative_values: The leading digit position carries the minus sign, e.g. `-5.2` and `-0.4`. A positive reading below 10 °C leaves the first digit blank so the point stays in place (` 5.2`). A negative reading that is smaller than one tenth rounds to zero and shows `-0.0`, keeping its sign. — format_overflow: AI's choice (the user did not specify): with the point fixed after digit 2, one decimal fits from -9.9 to 99.9 °C. Outside that the decimal place is dropped and whole degrees are shown, rounded to nearest — 100.4 °C shows `100`, -10.6 °C shows `-11`. Rounding halves go away from zero, and tenths are computed from the sensor's own fixed-point reading rather than a float (firmware choice). — power_up_display: Firmware choice: `----` is written to the display at start-up before the first read succeeds, so the module never shows stale or blank digits. — invalid_readings: AI's choice: a reading the sensor flags as invalid is never shown as a number; the failure display is used instead. A decoded temperature outside a sane measuring range (below -55 °C or above +128 °C) is treated as invalid too, so bus noise or a different part answering at 0x44 shows `----` rather than a nonsensical number. — sensor_failure: When the SHT31-D does not answer, the display shows `----` (user's choice), with the decimal point off. The first failed read is retried on the next 1 s cycle; `----` is shown from the moment a read fails and stays until a read succeeds. — sensor_recovery: As soon as a read succeeds the real temperature replaces `----` on the next update — no reboot, no user action. — brightness: AI's choice: the display is driven at the TM1637's maximum brightness, fixed; no dimming and no day/night rule.
Inputs outputs
input: The SHT31-D temperature reading over I2C — the only sensor. Its relative-humidity reading is published but not used. — output: The 4-digit 7-segment display — the only output. Its content is fully determined by the rules in `behaviour`. — console: Serial console over the board's micro-USB port, with the built-in `reboot`, `mem` and `factory_reset` commands, plus the diagnostic commands every framework-less build carries (`uptime`, `chip`, `version`, `log`, `heap`) and a boot count / boot reason / watchdog log line at start-up. Diagnostics only; the product needs no console input to work.
Connectivity
None. No Wi-Fi, no Bluetooth, no cloud and no phone app: no framework is selected, so the device never joins a network and has no network time. Nothing about the product depends on the time of day, so there is no timezone.
Onboarding
There is none beyond flashing. The person flashes the build from the product page's Run button, then My board, in Chrome, Edge or Firefox 151+ on a computer, with the board connected over a micro-USB cable. After that, power over the same micro-USB connector is all the device needs. No credentials, no device data, no account.
Power
USB powered from the board's micro-USB connector (5 V). Not a battery product; there is no battery, no deep sleep and no power-saving behaviour.
Factory reset
The product stores no settings, so it needs no user-facing factory reset. The console `factory_reset` command is still available and simply reboots the device into the same state.
Failure modes
sensor_unplugged_or_dead: The display shows `----` and keeps retrying every second; plugging the sensor back in restores the reading by itself. — display_unplugged_or_dead: The temperature is still read and the console keeps working; there is nothing on the display. The device does not reboot or lock up on a missing display. — power_cut: On power-up the device starts reading and displaying again with no user action; there is no state to lose. — network_down: Not applicable — the product has no network.
What the person must supply
An ESP32-C3-DevKitM-1 board. · A computer with Chrome, Edge or Firefox 151+ and a micro-USB cable, to flash the firmware once. · A 4-digit TM1637 display module and an SHT31-D I2C temperature sensor, wired as listed in `hardware` (four wires each, both from the board's 3V3 and GND pins). The SHT31-D replaces the TMP102 the person originally had: it is a part to be obtained, because the virtual device and the firmware catalog support it and the TMP102 neither.
Published 30 Nov 2026 · version 2
Firmware and source licensed Apache-2.0; photos and text CC-BY-4.0.
The firmware includes open-source software — open-source licences and notices; some components may be used only with Espressif chips.
Built with ESP ZeroCode AI — describe a device, get production firmware.
Terms of Service · Privacy Policy · Cookie Policy