DS18B20 Temperature Sensor & Raspberry Pi | 1-Wire
- Marques : Analog Devices Inc./Maxim Integrated
- Télécharger: DS18B20 Datasheet PDF
- Prix: enquête
- En stock: 8,857
- Type de capteur : Numérique, local
- Type de sortie : 1-Wire®
- Caractéristiques: Output Switch, Programmable Limit, Programmable Resolution
- Emballer: TO-226-3, TO-92-3 (TO-226AA)

Livraison GRATUITE pour les commandes supérieures à HK$250.00

Réponse rapide, devis rapide

Expédition rapide, pas de soucis après-vente

Chaîne originale, garantie de produits authentiques
DS18B20 Temperature Sensor Tutorial
DS18B20 waterproof probe waterproof probe
The DS18B20 is a popular digital temperature sensor known for being incredibly easy to use, thanks to its simple One-Wire interface, which means you only need one data line to communicate. It can measure temperatures from -55°C up to +125°C with a good accuracy of ±0.5°C, making it suitable for most everyday applications. Another handy feature is that each DS18B20 sensor comes with a unique ID, allowing you to connect multiple sensors on a single data wire—great for monitoring temperatures at several locations simultaneously, like indoor/outdoor home monitoring, aquarium temperature control, or greenhouse temperature management.
DS18B20 pinout
Numéro de code PIN | Nom de la broche | Description |
---|---|---|
1 | GND | Ground pin (0 V) |
2 | DQ | Data input/output (One-Wire bus) |
3 | VDD | Power supply voltage (3.0–5.5 V)
|
-
When connecting DS18B20, make sure you place a pull-up resistor (usually 4.7kΩ) between the DQ (data) pin and the VDD line for proper communication.
DS18B20 equivalent sensor
Sensor Model | Communication Protocol | Temperature Range (°C) | Accuracy (°C) | Resolution | Tension d'alimentation | Type de colis | Notable Features |
---|---|---|---|---|---|---|---|
DS18B20 | 1-Wire | -55 to +125 | ±0.5 (typical) | 9–12 bits | 3.0–5.5 V | TO-92, Waterproof Probe | Unique 64-bit ID, supports multiple sensors on one bus |
DS18S20 | 1-Wire | -55 to +125 | ±0.5 | 9 bits | 3.0–5.5 V | TO-92 | Legacy version, compatible with DS18B20 systems |
LMT01 | Pulse Count (2-wire) | -50 to +150 | ±0.5 | 13 bits | 2.0–5.5 V | TO-92 | High accuracy, can be enclosed for waterproof applications |
DHT22 (AM2302) | Single-Wire Digital | -40 to +80 | ±0.5 | 16 bits | 3.3–6.0 V | Plastic Enclosure | Measures both temperature and humidity |
BME280 | I²C/SPI | -40 to +85 | ±0.5 | 16 bits | 1.8–3.6 V | LGA | Measures temperature, humidity, and pressure |
When selecting an alternative sensor to the DS18B20, it’s important to consider key factors such as temperature range, accuracy, and the communication protocol required by your application. For straightforward replacements, the DS18S20 is a reliable choice due to its compatibility, while sensors like LMT01 offer improved accuracy and versatility for more demanding scenarios. If your application also requires additional data such as humidity or pressure, DHT22 and BME280 become strong contenders, despite their different communication protocols. Always match your choice to your project’s specific environmental conditions and functional requirements.
DS18B20 temperature sensor circuit
-
DS18B20 Sensor:
-
Pin 1 (GND): Connected to ground.
-
Pin 2 (I/O): Data pin, communicates with the microcontroller (MCU).
-
Pin 3 (VDD): Connected to a positive power supply (typically 3.3V or 5V).
-
-
Pull-up Resistor (R3):
-
A 4.7kΩ resistor connected between the data pin (I/O) and VCC, essential for proper communication.
-
-
Microcontroller Pin (P2.4):
-
Connected to the DS18B20 data pin for sending commands and receiving temperature data.
-
Working Principle:
The DS18B20 uses a single-wire protocol (“1-Wire”) to communicate with the MCU, meaning only one wire is necessary for both sending and receiving data. To ensure stable data communication, the data line requires a pull-up resistor (typically 4.7kΩ) connected to the power supply (VCC).
DS18B20 one wire protocol
The DS18B20 uses a One-Wire protocol:
-
Single-Wire Communication:
Only one data line (DQ) is required for bidirectional communication. Both the master device and the DS18B20 communicate with each other over this single line. -
Master-Slave Mode:
The master (such as an Arduino or other microcontroller) issues all commands. The DS18B20 responds according to these commands, but never initiates communication on its own.
The One-Wire protocol allows multiple DS18B20 sensors to be connected to the same data line. Each sensor has its own unique 64-bit address, which the master device uses to select and communicate with a specific sensor.