This tutorial has been updated to use version 1.0+ of the Arduino software, and compatible libraries. Please download the latest version of the Arduino software here: http://arduino.cc/en/Main/Software 1-Wire devices, such as the DS18B20 digital temperature sensor, are great to use with Arduino boards because you can connect many of them to a single IO pin. The freely available software libraries and example code make using 1-wire devices simple. There is only one problem we have seen with the examples on the web. If you have more than one device connected to a single pin, say an indoor temperature sensor, as well as an outdoor temperature sensor, how does your Arduino know which is which? The answer is in the ROM embedded in each 1-wire device. Every 1-wire device that is shipped from Maxim has a unique 64-bit serial code written to it's internal memory at the factory. You can use this number to address and identify individual sensors connected to a single Arduino pin. The method that we use here at hacktronics is to connect each sensor, one at a time, to an Arduino and run the sketch provided below. This Arduino sketch will extract the unique 64 bit code of the device and print it to the serial port. You can then copy that serial number and use it in your Arduino sketch to identify each sensor. Software used in this tutorial can be downloaded here: Arduino 1-Wire Address Finder Software
OneWire Arduino Library DallasTemperature Arduino Library Hardware used in this tutorial: - DS18B20 Digital Temperature Sensor - 4.7k Ohm (or so) pullup resistor - Solderless breadboard - Some wire jumpers - Arduino board (Uno, Mega, Duemilanove, etc.) Instructions: ----- If this is your first Arduino project, first go through our “Arduino: Getting Started” tutorial. ----- To obtain the unique serial number of your 1-Wire devices, follow this procedure for each device, one at a time. Use your solderless breadboard to make the connections: * You only need one pullup resistor for all 1-Wire devices connected to Arduino pin 3 ** See the DS18B20 datasheet for the pin diagram Software Arduino 1-Wire Address Finder Software
OneWire Arduino Library DallasTemperature Arduino Library
Unzip the OneWire and DallasTemperature archives and copy them into your Arduino libraries folder. For Windows users: My Documents -> Arduino -> libraries Mac users: <home directory> -> Documents -> Arduino -> Libraries Linux users: <home directory>/sketchbook/libraries Then restart the Arduino software. Download the Arduino 1-Wire Address Finder Software and unzip the folder. You will now have a folder called “one_wire_address_finder” Load the example program by clicking File->Sketchbook->Open Navigate to the "one_wire_address_finder" folder and select the "one_wire_address_finder.pde” file. Transfer the program to your Arduino by clicking the “Upload to I/O board” button. After uploading, open the Arduino serial monitor by clicking Tools->Serial Monitor. Verify that the baud rate is set to 9600. Press the reset button on your Arduino and you should see the address of your 1-Wire device! Happy hacking. Send feedback on this tutorial here.
|