شحن مجاني للأوردرات فوق
1000 ج
رمضان كريم
Precision 1-Wire Interface Temperature Measurement for Arduino and Microcontrollers
The DS18B20 is a digital temperature sensor with ±0.5°C accuracy over the range of -10°C to +85°C. It uses the 1-Wire communication protocol, allowing multiple sensors to be connected on a single data line.
±0.5°C from -10°C to +85°C
1-Wire interface (single data line)
Multiple sensors on one bus
Can operate without external power
| Temperature Range | -55°C to +125°C |
|---|---|
| Accuracy | ±0.5°C (-10°C to +85°C) |
| Resolution | User-selectable 9-12 bits |
| Supply Voltage | 3.0V to 5.5V |
| Current Draw | 1mA (active), 750nA (standby) |
| Conversion Time | 750ms max (12-bit resolution) |
| Interface | 1-Wire |
| Package Options | TO-92, SOIC, µSOP |
| Pin | Description | Connection |
|---|---|---|
| 1 (GND) | Ground | GND |
| 2 (DQ) | Data I/O (1-Wire) | Digital Pin (with 4.7KΩ pull-up) |
| 3 (VDD) | Power Supply (optional) | 3.3V-5V (for powered mode) |

#include <OneWire.h> #include <DallasTemperature.h>
#define ONE_WIRE_BUS 2 // Data wire connected to digital pin 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
void setup() {
Serial.begin(9600);
sensors.begin();
}
void loop() {
sensors.requestTemperatures(); // Send command to all sensors
float tempC = sensors.getTempCByIndex(0); // First sensor
Serial.print("Temperature: ");
Serial.print(tempC);
Serial.println("°C");
delay(1000);
}
void loop() {
sensors.requestTemperatures(); // Send command to all sensors
float tempC = sensors.getTempCByIndex(0); // First sensor
Serial.print("Temperature: ");
Serial.print(tempC);
Serial.println("°C");
delay(1000);
}
void setHighResolution() {
sensors.setResolution(12); // 9-12 bits (0.0625°C resolution)
Serial.print("Resolution: ");
Serial.println(sensors.getResolution());
}
float getTempF() {
float tempC = sensors.getTempCByIndex(0);
return DallasTemperature::toFahrenheit(tempC);
}
No account yet?
Create an Account
Recent Comments