
- Stock: In Stock
- Model: A0301.DS18B20
DS18B20 Digital Temperature Sensor 🌡️
The DS18B20 is a high-precision digital temperature sensor that delivers 9- to 12‑bit resolution readings over a single-wire (1‑Wire) data bus. Ideal for Arduino, Raspberry Pi, and other microcontroller platforms, this proven device is a go-to choice for electronics components in HVAC, IoT, and data logging applications.
⚙️ Key Features
- Temperature Range: −55°C to +125°C
- Accuracy: ±0.5°C typical from −10°C to +85°C
- Configurable Resolution: 9–12 bits (default 12-bit)
- 1‑Wire Interface: Single data line supports multiple sensors on the same bus
- Unique 64‑bit Serial Code: Individually addressable for multi-drop networks
- Power Options: 3.0V to 5.5V supply or parasitic power from the data line
- Programmable Alarms: Upper and lower temperature thresholds
📐 Technical Notes for Engineers
Typical conversion time (per reading):
- 9‑bit: ~93.75 ms
- 10‑bit: ~187.5 ms
- 11‑bit: ~375 ms
- 12‑bit: ~750 ms
- Pull‑up resistor: 4.7 kΩ typical on the 1‑Wire data line (adjust for long cables/bus capacitance)
- Parasitic mode: Requires a strong pull‑up during conversions on long buses or high loads
- Logic levels: Compatible with 3.3V and 5V microcontroller I/O
🧰 Applications
- Temperature Measurement: HVAC, environmental monitoring, food safety/process control
- Industrial Automation: Closed-loop temperature regulation and process feedback
- Consumer & Home Automation: Smart thermostats and climate control
- Data Logging & IoT: Long-term temperature trending and alerts
🔌 Example Circuit (Arduino)
Connect the DS18B20 to an Arduino (works similarly with other modules and microcontrollers):
- VDD → 3.3V or 5V (according to your board voltage)
- GND → Ground
- DQ (Data) → Arduino digital pin (e.g., D2)
- Pull‑up: 4.7 kΩ between DQ and VDD
For parasitic power: tie VDD to GND and ensure a strong pull‑up on DQ during temperature conversions.
🛠️ Arduino Sample Code
Install the OneWire and DallasTemperature libraries via the Arduino Library Manager, then upload: #include #include // Data wire is connected to Arduino pin 2 #define ONE_WIRE_BUS 2OneWire oneWire(ONE_WIRE_BUS); DallasTemperature sensors(&oneWire);void setup() { Serial.begin(115200); sensors.begin(); }void loop() { sensors.requestTemperatures(); // Start temperature conversion float tempC = sensors.getTempCByIndex(0); // Index 0 for the first sensor on the bus Serial.print("Temperature: "); if (tempC == DEVICE_DISCONNECTED_C) { Serial.println("Sensor not found"); } else { Serial.print(tempC, 2); Serial.println(" °C"); } delay(1000); } 🔎 Explanation
- Libraries: OneWire handles the 1‑Wire bus; DallasTemperature simplifies sensor commands and resolution settings.
- Pin Definition: ONE_WIRE_BUS selects the Arduino digital pin used for the DQ line.
- Setup: Initializes serial output and starts the DallasTemperature driver.
- Loop: Triggers a conversion and prints the temperature (°C) once per second. Checks for sensor presence.
✅ Compatibility & Integration
- Arduino & Compatible Boards: Uno, Mega, Nano, Leonardo, etc.
- Raspberry Pi: Native 1‑Wire support via GPIO (e.g., w1-therm); ideal for IoT gateways.
- Other MCUs: ESP32/ESP8266, STM32, and most 3.3V/5V microcontroller platforms.
💡 Best Practices
- Use proper bus topology (avoid large star networks); keep wiring short or tune the pull‑up value for long cables.
- Place a local decoupling capacitor near the sensor when powered conventionally (e.g., 0.1 µF between VDD and GND).
- For multiple sensors, leverage the unique 64‑bit ID to enumerate devices and map locations.
- Set the resolution based on your performance needs: 9–10 bit for faster updates, 12 bit for highest precision.
Whether you’re building an Arduino prototype, a Raspberry Pi data logger, or integrating into industrial control, the DS18B20 digital temperature sensor offers a robust, accurate, and easy-to-wire solution for your electronics projects and modules.