Engine Temperature Monitoring with ESP32 & DS18B20
Build a multi-point engine-temperature monitoring system with an ESP32, DS18B20 one-wire probes, and ESPHome/Home Assistant. This guide reflects every technical step and detail from the video, including wiring, ESPHome YAML, OTA workflow, dashboard setup, history analysis, and an alternator over-temperature automation.
🧭 What You’ll Build
- ✅ ESP32 “remote hub” reading 1–5+ DS18B20 probes on a single 1-Wire bus
- ✅ Robust wiring using a breakout board and optional terminal block
- ✅ Home Assistant dashboards with needle gauges & severity colors
- ✅ Weekly history analysis to learn normal operating ranges
- ✅ Alert automation: alternator > 100 °C → siren; optional relay cooling
🧰 Parts & Tools
- ✅ ESP32 dev board + small breakout board (for sturdier wiring)
- ✅ DS18B20 waterproof probes (buy long; you can trim to length)
- ✅ One 4.7 kΩ pull-up resistor (entire 1-Wire bus shares a single resistor)
- ✅ Wires, cable ties, and an optional small terminal block (if 4–5 probes crowd the breakout)
- ✅ Protective enclosure for the ESP32 (hot-glue or screw it in; helps in engine bay)
- ✅ Stable 3.3/5 V power supply for the ESP32
🔧 Wiring (One-Wire Bus on GPIO25
)
- ✅ Red →
3.3V
- ✅ Yellow (data) →
GPIO25
(often labeledP25
) - ✅ Black →
GND
- ✅ 4.7 kΩ resistor between
3.3V
andGPIO25
(data line) - ✅ Multiple probes: join all Reds → 3.3V, all Yellows → GPIO25, all Blacks → GND
💡 Breakout Board Tips
- ✅ Line up pin names/numbers and press the ESP32 in evenly so pins seat fully.
- ✅ Use a terminal block if you’re adding 4–5 probes and space runs out.
- ✅ Enclose the ESP32 near the engine to protect from dust and oil.
📍 Recommended Probe Locations
- ✅ Raw-water elbow
- ✅ Alternator body (against a mounting lug)
- ✅ Coolant area (near gauge entry)
- ✅ Next to the thermostat
⚙️ ESPHome Setup (Firmware)
- Open ESPHome (in Home Assistant) → your ESP32 device → Edit.
- Copy the DS18B20 YAML from the Dallas Temperature code page and paste it at the end of your YAML.
- If starting with a single probe, delete the other three entries. Keep indentation precise (two spaces).
- Save the YAML.
- Click ⋮ (three dots) → Validate to check for errors.
- Click ⋮ → Install → Wirelessly (OTA). Wait for compile & upload (you’ll see a green “success”).
- Stay on the screen to view logs. When the DS18B20 is discovered, double-click its address and press Ctrl+C to copy.
- Replace the placeholder address in your sensor entry with the copied address. Save → Validate → Install (OTA) again.
- Confirm readings (for example:
30.1 °C
). Default update interval is10s
. - To add more probes: wire to the same bus, power up, copy each new address from logs, add a sensor entry, then Save/Validate/Install.
📊 Home Assistant Dashboard
- Create a dashboard named Engine and choose the engine icon.
- Start with an empty dashboard (Take control), then Add card → Gauge.
- For the raw-water elbow gauge: Range
0–100 °C
, Style Needle, Severity: Yellow30 °C
, Red42 °C
. - Repeat for coolant, thermostat, and alternator sensors.
📈 History & Interpretation
Open History, set the start date to view Last week, and review temperatures. Typical examples seen: raw-water elbow ≈ 38–40 °C; coolant ≈ 75 °C. Probes are attached externally (not inside the engine), so absolute readings may be a few degrees off, but consistency is what matters for early warnings.
🚨 Automation Example
- Trigger: Alternator temperature > 100 °C.
- Action: Sound the onboard Neo siren.
- Enhancement: Drive a relay to reduce alternator field current so it cools while staying online.
🛠️ Build Tips
- ✅ Label sensors in ESPHome to match their physical locations.
- ✅ Secure probes tightly with cable ties for consistent surface contact.
- ✅ Use a protective enclosure and strain-relief in the engine bay.
🎬 Video Transcript
Introduction
I’m Rob from Smart Boat Innovations. In this video we set up engine-temperature monitoring — our first project using the super-useful ESP32 microcontroller. Off-the-shelf Zigbee temperature sensors can’t handle engine-bay extremes, so we’ll use a DS18B20 one-wire sensor. It handles about 125 °C and is relatively waterproof, and you can buy a pack of five for under $15 on AliExpress. The ESP32 will act as a remote hub with numerous ports for these sensors. If you haven’t set up an ESP32 yet, there’s a separate quick-start video.
On my boat I have four sensors: coolant area, near the thermostat, raw-water elbow, and the alternator. This gives early warnings before anything becomes critical. For example, my raw-water elbow is normally between 38–40 °C; I set an alert at 42 °C to catch issues like a worn impeller, intake blockage, or no water flow. The alternator probe is especially useful with lithium batteries, which can work alternators harder. You can also review historical engine-temperature trends over time. Let’s get started.
ESP32 & DS18B20 Overview
Here’s the ESP32. Please see my earlier video on powering it and adding it to Home Assistant. I like to use a small breakout board: it makes wiring easier and the ESP32 less fragile — more robust once pressed in. Line up the pins and press evenly until fully seated. Make sure the pin numbers and names match between the ESP32 and the breakout board.
For this project we’re using the DS18B20 temperature sensor (also called Dallas). It’s a “one-wire” sensor: data on the yellow wire; red and black are power. Buy long probes so you can trim to length. You need a 4.7 kΩ resistor for the bus; it’s one resistor total regardless of how many probes you connect.
I like to mount the ESP32 in a protective box, especially near the engine, to keep dust and oil out. Fix it with hot glue or screws. If you’re adding four or five probes, a small terminal block helps when the breakout board runs out of space.
Wiring
Red → 3.3 V; Yellow (data) → GPIO25 (P25); Black → GND. Bend the resistor so it bridges 3.3 V and GPIO25. With multiple probes, all Reds join to 3.3 V, all Yellows to GPIO25, and all Blacks to GND. Don’t forget a stable power supply for the ESP32.
Placing Sensors on the Engine
Cable-tie probes snugly to what you want to measure: one on the raw-water elbow; one on the alternator (against a mounting lug); one near the coolant gauge entry; and one next to the thermostat.
Adding to Home Assistant (ESPHome)
In ESPHome/Home Assistant, open your ESP32 device and edit its configuration. To make life easier, copy the DS18B20 YAML from the Dallas Temperature code page and paste it at the end of your YAML. For this demo we’ll keep just one probe entry — delete the other three — being careful with indentation (two spaces). Save.
Click the three dots (⋮) and choose Validate to check for mistakes; it should show “Configuration is valid.” Then choose Install → Wirelessly (OTA). ESPHome compiles and uploads; you’ll see the upload bar and then a green success. Stay on that screen for logs.
When it boots, you’ll see the DS18B20 discovered with its unique address (the “key”). Double-click it and press Ctrl+C to copy. There may be an error because the sample used a placeholder address, so paste the real address into your sensor definition. Save → Validate → Install again. Now the error disappears and you’ll see a temperature reading, e.g., 30.1 °C. The sample uses a 10 s update interval, so a new value appears roughly every 10 seconds.
To add additional sensors, repeat: wire to the same bus, power up, watch the log for each new address, add a sensor entry per address, then Save/Validate/Install. Do that for every sensor.
Dashboard Gauges
Create a new dashboard called Engine and select the engine icon. Start with an empty dashboard (Take control), then add a Gauge card. For a raw-water elbow gauge use a range of 0–100 °C, style Needle, and severity colors: Yellow at 30 °C, Red at 42 °C. That’s your basic gauge.
Four Gauges & Analytics
On my boat I run four temperature sensors (raw-water exhaust, coolant, thermostat, alternator). With the engine at normal operating temperature, you can switch to the History view and set the start date to see the last week. My coolant area is around ~75 °C. These probes measure external surfaces, not internal coolant, so absolute values can be a few degrees off — that’s fine, because consistency is what matters.
Automation Example
Add a quick automation for the alternator temperature: if it goes above 100 °C, trigger the Neo siren. A future improvement is to drive a relay to reduce alternator field current so it cools while still operating.