The DS18S20 and the DS18B20 are temperature sensors. They are both very similar giving the same accuracy and resolution. They only differ in how the data is presented to the user.
The DS18S20 was designed as a drop in replacement of the original DS1820. The 8-bit family code in the ROM code is different for these two devices. The DS18B20 is 28h; the DS18S20 retains the original 10h.
Actually I have used the DS18B20P version which is the parasitic power version of the DS18S20. Looking to buy or find the datasheet. Look here.
You need to wire DS18B20 PIN2 to an arduino digital pin and have a 4.7kOhm pullup on DS18B20 PIN2. Pin1 of the DS18B20 is connected to ground. Pin 3 of the DS18B20 is a No Connect (NC) pin.
The normal version needs 5V and ground. (See datasheets)
The DS18S20 lacks the configuration register that allows the DS18B20 to change resolution. The DS18S20 does have the two additional registers that are needed if greater than 9 bits of resolution is required.
The DS18S20 is factory configured to always perform 12-bit conversions. The 12-bit data is rounded to a 9-bit value and stored in the temperature register. To allow for greater than 9-bit resolution, a value for the Count Remain register is calculated. The Count Per °C register is set by the factory to be 16. Using the Count Remain and the Count Per °C registers and the formula below, up to 12-bit resolution can be obtained with the DS18S20.
- Unique 1-Wire® interface requires only one port pin for communication
- Each device has a unique 64-bit serial code stored in an onboard ROM
- Multidrop capability simplifies distributed temperature sensing applications
- Requires no external components
- Can be powered from data line. Power supply range is 3.0V to 5.5V
- Measures temperatures from –55°C to +125°C (–67°F to +257°F)
- ±0.5°C accuracy from –10°C to +85°C
- Thermometer resolution is user-selectable from 9 to 12 bits
- Converts temperature to 12-bit digital word in 750ms (max.)
- User-definable nonvolatile (NV) alarm settings
- Alarm search command identifies and addresses devices whose temperature is outside of programmed limits (temperature alarm condition)
- Applications include thermostatic controls, industrial systems, consumer products, thermometers, or any thermally sensitive system
I used the arduino digital pins to power the device rather like Todd did with the Nunchuck adapter.
This allows everything to be built onto a small PCB which fits into the digital PINS 0-7 on the arduino.
I will design a small PCB so that everyone can make this easily.
I use the library from Miles Burton which you can find here. http://milesburton.com/Main_Page?title=Dallas_Temperature_Control_Library
To use the power pins the library has to be slightly modified with an extra command to set the Power and Ground pins correctly.
This is quite easy to do as you can see below. I use arduino PIN2 to supply ground and PIN5 to supply 5V.
The code below sets these to ground and +5V respectively.
I use arduino Pin3 to read the DS18B20. This also has been modified in the program.
#define pwrpin PORTD5
#define gndpin PORTD2
DDRD |= _BV(pwrpin) | _BV(gndpin);
PORTD &=~ _BV(gndpin);
PORTD |= _BV(pwrpin);
delay(100); // wait for things to stabilize
Here you can download the sketch.
And here the two changed files for using the arduino pins as power supply. file1 & file 2.
Below you can see a picture of the breadboard with the DS18B20 and its resistor mounted on it and also the output from the Single.ino program i modified.
This site has the eagle part from which i have designed the small breakout board which plugs straight into the arduino Digital port pins 0-7
I have made a few and these and they are available in the shop now. With the small solder jumper you can select the input to PIN3 of the temperature sensor.
You can leave it unconnected which is the requirement for the DS18S20P or you can select +5V or ground depending which version of the temperature sensor you have.
DS18B20 schematic DS18B20 board
Hello, the demo program HKW581.ino... »
Sorry its holiday time. Responded... »
Hi, I am trying to... »