DS18S20 Temperature Sensor
recent experience with passive / USB hardware and the digitemp software for Win / Linux
The 1-wire temperature sensor Dallas DS1820 is very popular for intelligent remote computerised temperature measurements. Adaption to the RS232 serial port of an PC is easy and can be operated with fairly long leads (5 - 20 m).
Passive RS 232 adapter
The device DS1820 was recently redesigned, functionally improved and is now (2004+) available only as device DS18S20. The web-wide published circuit for the passive adapter aka DS9097 (here or here) is simple but does not always work as expected. Running my prototype like the standard circuit (DS9097) the software package "digitemp" recognized the individual DS18S20 device properly by the component ID but displayed 85C under all conditions (aka "I cannot measure").
In the Dallas product information it was mentioned that during conversion the DS18S20 draws "considerable" current (~ 2mA) and is sensitive to supply / DQ voltage variations, especially in 'parasitic mode' (two-wires without external supply). The only solution that made it work here was including an additional continous supply circuit for the sensor(s) based on an idea published by Marcel Tränhardt.
The circuit is just slightly more complex than the published standard DS9097 circuit. Resistor R3 generates an additional voltage drop in the DTR line. The R4 - C4 combination charges C1 to about 4 volts (DC), enough to operate one or several DS18S20. Resistor R2 is optional to provide some impedance matching for the RXD line and can be replaced by a wire bridge for cost reasons depending on the line properties.
Using the RS232-connection of a laptop or portable computer may lead to insufficient operation due to not enough voltage of the data lines. Sometimes the signal levels are just +/- 5 volts instead of +/- 12 volts. A decoded temperatur of "85" indicates system malfunction.
Parts list /bill of materials:
enclosed a photo of a prototype. To improve the thermal response time a nickel
coin was glued into the front side of the box and the sensor bonded to the inner
Below there is the screen printout of the digitemp Win version operating the DS18S20 above..
new USB-to-1-wire adapter details
|As the standard USB supply of computers is 4.5 ...5.5 volts, a direct use of that USB supply powering the 1-wire bus may be insufficient. A simple pullup resistor provides very limited current supply at higher node voltages. Therefore a 100 kHz oscillator using some gates of a 74HC14 hex inverter provides a square wave with about 5 volt amplitude that is rectified and added to the supply voltage generating just less than 10 volts DC, about 9.3 volts. The rectified square wave is filtered with two tantal capacitors. To provide 2.5 mA as a 1.wire-bus pulldown current a resistor of about 3.9 kOhm is needed.|
|The 3uH coil is used to reduce the peak currents in the rectifier circuit and reduce EMI noise. At this low voltage and high frequency the use of schottky diodes for rectification is highly recommended.|
|Supplying the 1-wire-bus from a higher than nominal voltage source improves the bus-provided current at higher bus voltages. A current source would provide constant current at all bus voltages; this setup provides still about 50% of the short-circuit current at the bus "high" voltage as well as a cleaner pulse shape on the rising slope..|
At the DQ output node a series connection of a schottky rectifier and 5.1 volt zener diode limits the 1-wire bus "high" voltage to about 5.3 volts. The counter-connected 1N4148 diode limits noise and negative / undershoot voltages if coming from the external wiring. The other gates/inverters of the 74HC14 are used to detect bus signals, clip them to digital levels and provide them to the FTDI RS232 IC. The 47 Ohm/ 470 pF low pass filter reduces line noise at the RXD input and partially terminates the external wiring. The 22 ohms resistor is for line termination as well as limiting currents in case of overvoltage spikes.
The BS170 transistor is the "TXD transmit" pulldown stage sending data from the computer to the 1-wire-bus. The 33 ohm gate resisor reduces the danger of high frequency oscillations of the FET transistor.
Using this circuit with Linux, ubuntu 10.04, opensuse 11.3 or similar, it can rely on the kernel-built-in FTDI driver which simulates a standard RS232 interface. After installation of the most recent Linux digitemp software you need to set up the sensors and circuitry (.. -i.. ). The FTDI driver installs a new fake serial /dev/ttyUSB0 port (..-s..). Enter at the terminal command line for digitemp setup ...
user#: /usr/bin/digitemp_DS9097 -i -s/dev/ttyUSB0 -cdigitemp.conf
Provided this diplays the sensors and their identification, measurements (..-a..) are taken using
user#: /usr/bin/digitemp_DS9097 -a -s/dev/ttyUSB0 -cdigitemp.conf
More command line arguments can be found using /usr/bin/digitemp_DS9097 -h (help)
back to front page