Free code › Project #1

ESP32-S3 DS18B20 Wi-Fi temperature sensor

A $15 build that puts a live temperature graph on your phone. Sparky's first free project: an ESP32-S3-DevKitC-1-N16R8 reads a waterproof DS18B20 probe every 30 seconds and sends it - over verified HTTPS - to your free homeautomation.com dashboard.

No coding needed: flash it, then set up Wi-Fi from your phone
Install from your browser (Chrome/Edge) or download the full PlatformIO project (free zip).
Install from browser Download source

Parts list

PartQtyNotes
ESP32-S3-DevKitC-1-N16R8116 MB flash, 8 MB PSRAM. Other S3 DevKitC variants work with small platformio.ini changes.Check price
DS18B20 waterproof probe1Stainless tip, 1-3 m cable. Red = VDD, black = GND, yellow = DATA.Check price
4.7 kΩ resistor1The 1-Wire pull-up (yellow-violet-red bands). Some probe kits include one on a little adapter board.Check price
Breadboard + jumper wires1Full-size breadboard; the DevKitC is wide, so it covers one row of holes on each side.Check price
USB-C data cable1Must be a data cable - many "charge only" cables won't show up as a port.Check price

Wiring

Wiring diagram: DS18B20 VDD to 3V3, GND to GND, DATA to GPIO4 with a 4.7k resistor from GPIO4 to 3V3

DS18B20 wireESP32-S3 pinNotes
VDD (red)3V33.3 V - not 5 V.
GND (black)GNDAny GND pin.
DATA (yellow)GPIO4+ 4.7 kΩ from GPIO4 to 3V3.

Why GPIO4? It's a plain GPIO with no side jobs. We stay away from the strapping pins (GPIO0, 3, 45, 46), the native USB pins (GPIO19/20) and GPIO35-37, which the octal PSRAM on N16R8 modules uses internally.

Wi-Fi setup from your phone (no code edits)

The firmware has its own setup page, so nobody has to edit a file before compiling. Here is what you see:

  1. Power the board. With nothing saved yet, the LED pulses blue and the board opens an open Wi-Fi network named Sparky-Setup-XXXX (XXXX = the last 4 characters of its MAC address, printed on the serial monitor too).
  2. Get your device key first. Your phone has no internet while it is on the setup network, so sign up, tap Create device + key on the dashboard and copy the key (it starts with hak_).
  3. Join Sparky-Setup-XXXX on your phone. The setup page pops up by itself (Android: "Sign in to network", iPhone: a captive sheet). If not, browse to http://192.168.4.1.
  4. Pick your Wi-Fi from the scanned list (signal bars, Refresh, or "Other / hidden network"), type its password, paste the device key, optionally name the device. The Advanced section holds the ingest URL (default https://api.istuff.io/v1/ingest).
  5. Save & connect. The board test-connects (LED blinks blue fast). On success the page shows the board's new IP and name, the settings are stored in the board's flash, and it restarts into normal mode. On failure it tells you what went wrong and stays in setup.
  6. Watch your dashboard. Readings arrive every 30 seconds.
Sparky setup page on a phone: header with Sparky, the device-key tip and a scanned list of Wi-Fi networks with signal bars
Pick your network
Setup page after saving: green message that the sensor joined Wi-Fi and its new IP address
Connected - it restarts
Setup page showing a red message that the router refused the connection, probably a wrong Wi-Fi password
Wrong password? You stay here
Read-only status page on the home network showing temperature, last post, signal and uptime
LAN status page

Screenshots are the real setup page rendered at phone size. The page is about 15 KB (8 KB compressed) and works with no internet at all.

Starting over: hold the BOOT button for 5 seconds while the board is running (the LED flickers purple/white, then turns green). Release it and the board erases the saved Wi-Fi and key and reboots into setup mode. If the saved Wi-Fi is unreachable for about 3 minutes (new router, moved house), the setup network reopens by itself while the board keeps retrying.

Security note: the setup network is open so the page pops up on every phone, which means your Wi-Fi password travels unencrypted over a few metres of air for a few seconds. Do setup at home, not in a crowded place, or build with -DSETUP_AP_PASSWORD="\"yourpass\"" for a password-protected setup network (printed on the serial monitor).

Flash it from your browser

No PlatformIO, no drivers to compile anything: plug the board in and click. Works in Chrome or Edge on Windows, macOS, Linux or ChromeOS (Web Serial; Firefox and Safari can't do this).

This browser can't flash over USB. Use Chrome or Edge on a computer, or build from source. Browser flashing only works on a secure (https) page.

  1. Plug the ESP32-S3-DevKitC-1 into your computer with a USB data cable (either USB-C port works for flashing).
  2. Click Install, choose the board in the browser's port list (USB JTAG/serial debug unit or CP210x/CH343) and confirm. First install on a used board: tick Erase device. Updating a working sensor: leave it unticked so your Wi-Fi settings survive.
  3. Wait about a minute, then follow the phone setup above. Nothing to type into code.

Prefer another tool? Download factory.bin (1013 KB, merged image for address 0x0), sha256 00e59eec2f57b692… and run esptool.py --chip esp32s3 --baud 460800 write_flash 0x0 factory.bin.

How it works

  • Every 30 s the board reads the probe at 12-bit resolution (0.0625 °C steps).
  • It POSTs {"temp_c":21.44,"temp_f":70.59,"rssi":-58,"uptime":1234,"sensor_ok":1} to https://api.istuff.io/v1/ingest with your device key. https://homeautomation.com/api/v1/ingest still works as a legacy alias.
  • The server certificate is verified against the embedded ISRG Root X1/X2 - no setInsecure() shortcuts.
  • If the server says "too soon" (HTTP 429), it waits exactly the Retry-After seconds.
  • Wi-Fi drops? It reconnects on its own. Bad readings (-127 °C disconnected, 85 °C power-on value) are retried and never graphed.
  • On your home network the board also serves a small read-only status page at http://sparky-XXXX.local/ (or its IP): current temperature, last post result, signal and uptime. Settings can only be changed with the BOOT-button reset.

Status LED

The onboard RGB LED is on GPIO48 on DevKitC-1 v1.0 boards. v1.1 boards use GPIO38 - add -DRGB_LED_PIN=38 to build_flags if yours stays dark.

blue pulseSetup mode: join Sparky-Setup-XXXX
blue fast blinkTesting the Wi-Fi you entered
blue slow blinkWi-Fi is down, retrying
green flashReading accepted (steady green = setup saved, restarting)
yellow blipServer asked to wait (429)
red blipSensor problem - check wiring and the pull-up
purple blipNetwork/TLS/server error, retrying in 60 s
white blipDevice key rejected (401): hold BOOT 5 s and enter a fresh key

Or build it from source (PlatformIO)

  1. Create a free dashboard account and click Create device + key.
  2. Download the project zip and unzip it.
  3. Open the folder in VS Code with PlatformIO, then Build and Upload to the port labelled USB. First time? Follow the PlatformIO guide.
  4. Join Sparky-Setup-XXXX with your phone, enter Wi-Fi + key, and watch your dashboard.

Optional: copy include/secrets.example.h to include/secrets.h and fill it in to bake Wi-Fi and key into the firmware to bake Wi-Fi and key into the firmware. It is only used while nothing is saved on the board.

License

PolyForm Noncommercial 1.0.0: free for personal, hobby and educational use; commercial use needs a license (contact us). The firmware source and the prebuilt firmware above are covered; the homeautomation.com website and dashboard are not part of this release.