Sensors
DS18B20 Waterproof Temperature Sensor
Rs. 250
Rs. 313
20% off
Available
In Stock (22 units) — Ready for Overnight Dispatch
Quantity:
(Max: 22)
⚡ 2-Hour University of Lahore (UOL) Express: Guaranteed fast delivery within 2 hours at UOL Defense Road Campus, Hostels & Departments.
100% Genuine Tested Silicon: Quality checked in hardware lab before packing
Anti-static ESD Packaging: Safe moisture barrier bubble packing
Fast Courier Delivery: TCS, Leopards & Trax overnight across Pakistan (Rs. 350)
Payment Flexibility: JazzCash, EasyPaisa, SadaPay, NayaPay & Bank Transfer
Product Overview & Details
The SparkFun DS18B20 Digital Temperature Sensor is a user-favorite for its accuracy, ease of use, and versatility. This sensor measures temperature in degrees Celsius with user-selectable resolution (9-12 bits) and a wide range of -55°C to +125°C. Here's why the DS18B20 is a must-have for your projects:
Key Features:
Unique 1-Wire Interface: Requires only one data pin for communication, simplifying wiring.
Multi-Sensor Support: Each sensor has a unique 64-bit ID, allowing you to use multiple sensors on a single bus.
Flexible Power Options: Powered directly from the data line (3.0V to 5.5V) or by an external source.
High Accuracy: Offers ±0.5°C accuracy from -10°C to +85°C.
Programmable Resolution: Choose between 9-12 bit resolution for optimal balance between precision and speed.
Alarm Functionality: Set temperature alarms for automated control in your projects.
Applications:
Arduino Projects: Ideal for data logging, temperature control systems, and more.
Thermostatic Controls: Monitor and regulate temperature in various applications.
Industrial Systems: Integrate precise temperature measurement into industrial processes.
Consumer Products: Enhance temperature control in appliances and devices.
Scientific Experiments: Conduct accurate and reliable temperature measurements.
Upgrade your projects with the SparkFun DS18B20 Digital Temperature Sensor and experience precise temperature monitoring at an affordable price.
Datasheet:
http://datasheets.maximintegrated.com/en/ds/DS18B20.pdf
Example code
#include <OneWire.h>
#include <DallasTemperature.h>
const int ONE_WIRE_BUS = 2;
const int GND_PIN = 8;
const int VCC_PIN = 7;
const int LED_PIN = LED_BUILTIN; // Pin 13 on Uno/Nano
const int REQUIRED_SAMPLES = 2;
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
DeviceAddress deviceAddress;
// Result status
bool testPassed = false;
void powerDownSocket() {
pinMode(ONE_WIRE_BUS, OUTPUT);
digitalWrite(ONE_WIRE_BUS, LOW);
digitalWrite(VCC_PIN, LOW);
digitalWrite(GND_PIN, LOW);
pinMode(VCC_PIN, OUTPUT);
pinMode(GND_PIN, OUTPUT);
}
void powerUpSocket() {
pinMode(GND_PIN, OUTPUT);
digitalWrite(GND_PIN, LOW);
pinMode(VCC_PIN, OUTPUT);
digitalWrite(VCC_PIN, HIGH);
pinMode(ONE_WIRE_BUS, INPUT);
delay(150); // Power-on stabilization delay
}
void printAddress(DeviceAddress addr) {
for (uint8_t i = 0; i < 8; i++) {
if (addr[i] < 16) Serial.print("0");
Serial.print(addr[i], HEX);
if (i < 7) Serial.print(":");
}
}
void setup() {
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, LOW);
Serial.begin(115200);
delay(100);
Serial.println("\n----------------------------------------");
Serial.println("Starting Test...");
powerUpSocket();
sensors.begin();
sensors.setWaitForConversion(true);
uint8_t count = sensors.getDeviceCount();
if (count == 0) {
Serial.println("[FAIL] -> No sensor detected. Check wiring/pull-up/orientation.");
powerDownSocket();
testPassed = false;
return;
}
if (!sensors.getAddress(deviceAddress, 0)) {
Serial.println("[FAIL] -> Address / CRC Error.");
powerDownSocket();
testPassed = false;
return;
}
Serial.print("ROM ID: ");
printAddress(deviceAddress);
Serial.println("\nTaking Samples:");
bool allSamplesValid = true;
float samples[REQUIRED_SAMPLES];
for (int i = 0; i < REQUIRED_SAMPLES; i++) {
sensors.requestTemperatures();
float tempC = sensors.getTempC(deviceAddress);
samples[i] = tempC;
Serial.print(" Sample ");
Serial.print(i + 1);
Serial.print("/");
Serial.print(REQUIRED_SAMPLES);
Serial.print(": ");
Serial.print(tempC, 2);
Serial.println(" °C");
if (tempC == DEVICE_DISCONNECTED_C || tempC == 85.0 || tempC < -50.0 || tempC > 120.0) {
allSamplesValid = false;
}
delay(100);
}
Serial.println("----------------------------------------");
Key Features:
Unique 1-Wire Interface: Requires only one data pin for communication, simplifying wiring.
Multi-Sensor Support: Each sensor has a unique 64-bit ID, allowing you to use multiple sensors on a single bus.
Flexible Power Options: Powered directly from the data line (3.0V to 5.5V) or by an external source.
High Accuracy: Offers ±0.5°C accuracy from -10°C to +85°C.
Programmable Resolution: Choose between 9-12 bit resolution for optimal balance between precision and speed.
Alarm Functionality: Set temperature alarms for automated control in your projects.
Applications:
Arduino Projects: Ideal for data logging, temperature control systems, and more.
Thermostatic Controls: Monitor and regulate temperature in various applications.
Industrial Systems: Integrate precise temperature measurement into industrial processes.
Consumer Products: Enhance temperature control in appliances and devices.
Scientific Experiments: Conduct accurate and reliable temperature measurements.
Upgrade your projects with the SparkFun DS18B20 Digital Temperature Sensor and experience precise temperature monitoring at an affordable price.
Datasheet:
http://datasheets.maximintegrated.com/en/ds/DS18B20.pdf
Example code
#include <OneWire.h>
#include <DallasTemperature.h>
const int ONE_WIRE_BUS = 2;
const int GND_PIN = 8;
const int VCC_PIN = 7;
const int LED_PIN = LED_BUILTIN; // Pin 13 on Uno/Nano
const int REQUIRED_SAMPLES = 2;
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
DeviceAddress deviceAddress;
// Result status
bool testPassed = false;
void powerDownSocket() {
pinMode(ONE_WIRE_BUS, OUTPUT);
digitalWrite(ONE_WIRE_BUS, LOW);
digitalWrite(VCC_PIN, LOW);
digitalWrite(GND_PIN, LOW);
pinMode(VCC_PIN, OUTPUT);
pinMode(GND_PIN, OUTPUT);
}
void powerUpSocket() {
pinMode(GND_PIN, OUTPUT);
digitalWrite(GND_PIN, LOW);
pinMode(VCC_PIN, OUTPUT);
digitalWrite(VCC_PIN, HIGH);
pinMode(ONE_WIRE_BUS, INPUT);
delay(150); // Power-on stabilization delay
}
void printAddress(DeviceAddress addr) {
for (uint8_t i = 0; i < 8; i++) {
if (addr[i] < 16) Serial.print("0");
Serial.print(addr[i], HEX);
if (i < 7) Serial.print(":");
}
}
void setup() {
pinMode(LED_PIN, OUTPUT);
digitalWrite(LED_PIN, LOW);
Serial.begin(115200);
delay(100);
Serial.println("\n----------------------------------------");
Serial.println("Starting Test...");
powerUpSocket();
sensors.begin();
sensors.setWaitForConversion(true);
uint8_t count = sensors.getDeviceCount();
if (count == 0) {
Serial.println("[FAIL] -> No sensor detected. Check wiring/pull-up/orientation.");
powerDownSocket();
testPassed = false;
return;
}
if (!sensors.getAddress(deviceAddress, 0)) {
Serial.println("[FAIL] -> Address / CRC Error.");
powerDownSocket();
testPassed = false;
return;
}
Serial.print("ROM ID: ");
printAddress(deviceAddress);
Serial.println("\nTaking Samples:");
bool allSamplesValid = true;
float samples[REQUIRED_SAMPLES];
for (int i = 0; i < REQUIRED_SAMPLES; i++) {
sensors.requestTemperatures();
float tempC = sensors.getTempC(deviceAddress);
samples[i] = tempC;
Serial.print(" Sample ");
Serial.print(i + 1);
Serial.print("/");
Serial.print(REQUIRED_SAMPLES);
Serial.print(": ");
Serial.print(tempC, 2);
Serial.println(" °C");
if (tempC == DEVICE_DISCONNECTED_C || tempC == 85.0 || tempC < -50.0 || tempC > 120.0) {
allSamplesValid = false;
}
delay(100);
}
Serial.println("----------------------------------------");
Technical Specifications & Pinouts
Authentic Hardware: Bench-tested Grade A component | Category Type: Sensor Module | Unique 1-Wire Interface: Requires only one data pin for communication, simplifying wiring. | Multi-Sensor Support: Each sensor has a unique 64-bit ID, allowing you to use multiple sensors on a single bus. | Flexible Power Options: Powered directly from the data line (3.0V to 5.5V) or by an external source.