Learning Objective
Compare sensor accuracy and understand waterproof sensors.
Precision Temperature (DS18B20)

Hardware: DS18B20 Waterproof Temperature Probe

Dashboard: DS18B20 Probe Reading Card
Theory: Waterproof Temperature Sensors
Specialized Sensors for Specialized Jobs
In previous week , you learned about the DHT11 sensor, which measures both temperature and humidity. While it's great for air temperature monitoring, what happens when you need to measure the temperature of liquids, like water in a swimming pool or a brewing system? The DHT11 would be destroyed by water/liquid! This week we're introducing the DS18B20 - a waterproof, high-precision temperature sensor designed specifically for harsh environments and liquid measurement.
How the DS18B20 Works
The DS18B20 is encased in a stainless steel probe with a waterproof cable, making it completely submersible. Inside, a digital thermometer uses a silicon bandgap temperature sensor that produces voltage proportional to absolute temperature. Unlike analog sensors, the DS18B20 converts temperature readings to digital data right inside the sensor, then sends that data to the ESP32 using the One-Wire protocol - a clever communication method that uses just a single data wire (plus power and ground) to transmit information. This digital approach eliminates noise and interference, providing more accurate and stable readings than the DHT11.
Technical Details: Precision and Range
The DS18B20 offers impressive specifications: temperature range from -55°C to +125°C, making it suitable for everything from arctic monitoring to industrial boiler systems. Its accuracy is ±0.5°C across the -10°C to +85°C range, significantly better than the DHT11's ±2°C accuracy. The sensor provides readings with 9-bit to 12-bit resolution (user selectable), giving precision down to 0.0625°C at the highest resolution. Conversion time is about 750ms at maximum resolution - slower than the DHT11, but the trade-off for superior accuracy is worth it for precision applications.
Real-World Applications
DS18B20 sensors are widely used in professional and industrial applications. Aquarium and pool monitors use them to maintain safe water temperatures for fish and swimmers. HVAC systems use them to monitor pipe temperatures and detect freezing risks. Solar hot water systems measure tank temperatures to optimize heating. 3D printers use similar sensors to monitor heated print beds and extruder temperatures.
For Teachers
This lesson teaches an important concept: choosing the right sensor for the job. Have students compare DHT11 and DS18B20 readings side-by-side to observe differences in stability and precision. Demonstrate waterproofing by briefly submerging the DS18B20 in water (do NOT try this with the DHT11!). Discuss the One-Wire protocol as an example of clever engineering - multiple DS18B20 sensors can share a single data wire, each with a unique ID. This is the foundation of sensor networks. Use this opportunity to discuss accuracy vs. precision and why different applications have different requirements.
For Parents
This week your child learns about sensor selection - understanding that different sensors are optimized for different applications. The DS18B20 demonstrates key engineering principles: specialized design (waterproofing), digital communication (reducing errors) and precision measurement (critical for industrial applications). Learning to compare sensor specifications and choose appropriate tools for specific tasks is essential engineering thinking. These skills apply beyond electronics: understanding requirements, evaluating options and selecting the best tool for the job are valuable in any technical or analytical career.
Hands-On Activity: Sensor Comparison
Activity Duration: 25-30 minutes
Students will connect the DS18B20 probe, compare its readings with the DHT11 and conduct a scientific comparison to determine which sensor is more stable and accurate.
Step-by-Step Instructions:
- Connect the DS18B20: Locate the DS18B20 sensor with its waterproof cable and stainless steel probe. Connect it to the 26 connector on your MakerBuddy IoT Board.
- Verify DHT11 Connection: Ensure your DHT11 is still connected from Week 10. You'll be comparing both sensors.
- Open Dashboard: Navigate to your web interface and locate both temperature sensor cards - one for DHT11 and one for DS18B20.
- Baseline Comparison: Record both temperature readings in normal room conditions. Note if there's a difference between the two sensors.
- Stability Test: Watch both readings for 2-3 minutes without touching anything. Which sensor's value fluctuates more? Which is more stable?
- Heat Test: Gently hold the DS18B20 probe in your closed fist for 60 seconds. Watch the temperature rise. How high does it go?
- Cooling Observation: Release the probe and watch the temperature drop back to room temperature. How long does it take to stabilize?
- Comparison Table: Create a table comparing: Initial reading, stability (±degrees variation), response time to heat and recovery time to normal.
What Students Should Observe:
- DS18B20 readings are more stable with less fluctuation (typically ±0.1°C vs DHT11's ±0.5-1°C)
- Both sensors should read similar temperatures, but DS18B20 is typically more accurate
- DS18B20 responds faster to temperature changes when held in hand
- The waterproof probe can be safely touched and handled without damage
- Temperature readings update every few seconds
- DS18B20 can measure higher temperatures than the human body safely
Safety Note
If testing with liquids, use room temperature or lukewarm water only. Do NOT test with boiling water or ice water in a classroom setting. Never submerge the DHT11 or any other non-waterproof sensors!
Challenge
Your Mission: Temperature Detective
You're a temperature scientist tasked with finding the hottest and coldest spots in your classroom. Use the DS18B20's precision to create a temperature map!
Challenge 1: Temperature Mapping
Measure and record the temperature at five different locations:
- Near a window (especially if sunny)
- Under your desk in the shade
- Near a computer or electronic device
- Center of the classroom
- Near a door or air vent
What's the temperature difference between the warmest and coolest spots? Why do you think these differences exist?
Challenge 2: Sensor Accuracy Test
If you have a thermometer in your classroom, compare its reading to both the DHT11 and DS18B20. Which sensor matches the thermometer more closely? Calculate the error for each sensor.
Discussion Questions:
- Why might you choose a DS18B20 over a DHT11 even though it only measures temperature (no humidity)?
- What applications require waterproof sensors? List at least three.
- If a DS18B20 reads 22.3125°C and a DHT11 reads 22°C, which is giving you more precision? Does that mean it's more accurate?
Bonus Challenge: Research the One-Wire protocol. Why is it called "one-wire" when the sensor actually has three wires? (Hint: One wire is for data, the others are for power and ground - only the data wire does the clever communication trick!)
Key Takeaways
✓ Waterproof Sensors
The DS18B20's stainless steel probe and sealed cable allow it to measure temperatures in liquids and harsh environments without damage. This specialized design opens up applications impossible with standard air-temperature sensors, such as swimming pool monitoring, industrial process control and underwater temperature measurement.
✓ One-Wire Protocol
One-Wire is a digital communication protocol that transmits data using just a single wire (plus power and ground), reducing wiring complexity. Multiple DS18B20 sensors can share the same data line, each identified by a unique 64-bit address, making it ideal for distributed temperature monitoring systems with dozens of sensors.
✓ Sensor Accuracy
The DS18B20 offers ±0.5°C accuracy compared to the DHT11's ±2°C, making it essential for applications requiring precision like laboratory equipment, medical devices and industrial process control. Higher accuracy comes from digital conversion inside the sensor, eliminating errors introduced by analog signal transmission and external interference.
✓ Temperature Comparison
Comparing sensors teaches critical thinking: understanding that precision (number of decimal places) is different from accuracy (closeness to true value) and that sensor selection depends on application requirements. Some applications need waterproofing, others need speed, others need both temperature and humidity - engineering is about choosing the right tool for the specific job.
Coming Up Next Week:
Week 12: Distance & Echolocation (HC-SR04)
