The Module DS18N20 is a compact digital temperature sensor module that utilizes the DS18B20 1-Wire digital temperature sensor. It is widely used in various applications such as home automation systems, environmental monitoring, and industrial temperature control due to its ease of use, high accuracy, and ability to function over a wide temperature range.
The Module DS18N20 offers the following key technical specifications:
Specification | Value |
---|---|
Operating Voltage | 3.0V to 5.5V |
Output | Digital signal via 1-Wire bus |
Temperature Range | -55°C to +125°C (-67°F to +257°F) |
Accuracy | ±0.5°C from -10°C to +85°C |
Resolution | 9 to 12 bits (configurable) |
Unique 64-bit Serial Code | Yes (for multi-sensor networks) |
Pin Number | Name | Description |
---|---|---|
1 | VDD | Power supply (3.0V to 5.5V) |
2 | DQ | Data pin, 1-Wire communication bus |
3 | GND | Ground |
Q: Can I connect multiple DS18N20 sensors to the same 1-Wire bus? A: Yes, each DS18N20 has a unique 64-bit serial code which allows multiple sensors to be connected on the same bus.
Q: What is the maximum cable length for the DS18N20? A: The maximum cable length depends on the quality of the cable and the pull-up resistor value. For longer distances, a lower value resistor and/or a cable with lower resistance and capacitance should be used.
Q: How do I set the resolution of the DS18N20? A: The resolution can be set programmatically via the 1-Wire interface. Refer to the DS18B20 datasheet for detailed instructions.
Below is an example of how to interface the Module DS18N20 with an Arduino UNO:
#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is connected to pin 2 on the Arduino
#define ONE_WIRE_BUS 2
// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature sensor
DallasTemperature sensors(&oneWire);
void setup(void)
{
// Start serial communication for debugging
Serial.begin(9600);
// Start up the library
sensors.begin();
}
void loop(void)
{
// Call sensors.requestTemperatures() to issue a global temperature
// request to all devices on the bus
sensors.requestTemperatures();
// Fetch and print the temperature in Celsius
Serial.print("Temperature: ");
Serial.print(sensors.getTempCByIndex(0));
Serial.println("°C");
// Delay 1 second before next reading
delay(1000);
}
Remember to include the OneWire
and DallasTemperature
libraries in your Arduino IDE before compiling the code. This example demonstrates a simple setup to read the temperature and output it to the Serial Monitor.