martybugs.net Electronics Info
 navigation
. MartyBugs home
. electronics home
. temperature sensors
 
 temp sensors
. overview
. serial hardware interface
. USB hardware interface
. linux software
. windows software
. graphing temps
. mutiple sensors
 
 site search
Custom Search
 
Serial Port Temperature Sensors - USB Hardware Interface

USB-serial adapter
USB-serial adapter
This page describes the electronic circuitry required to interface to the temperature sensors via a USB connection.


USB-Serial Adapters

As serial ports are becoming rare on newer PCs, servers and laptops, other interface options for temperature sensors are needed.

There are various types of cheap USB-to-serial adapters available - and some are known to have issues with newer operating systems, including Windows 8.


PL2303TA USB-to-Serial Adapters

I have been using USB-to-serial adapters that use the PL2303TA chipset, as they are apparently known to work fine in Windows XP/Vista/7/8, MacOS X and Linux (the PL2303HX chipset doesn't work under Windows 8, but the PL2303TA chipset does).

They emulate a the DS9097 1-wire adapter, and work well for interfacing to 1-wire devices (behaving exactly the same as the serial port interface circuit).

I bought mine on eBay for USD$14 (approx AUD$18) including shipping, but have since found the same adapter on eBay for as little as USD$2 including shipping (approx AUD$2.60).
Search for "PL2303TA" on eBay to these adapters.

The same adapter is also available from adafruit.com for USD$9.95 plus shipping (see here).

PL2303 USB-serial adapter
PL2303TA USB-serial adapter


Drivers

On Windows and MacOS X, apparently you'll need to install the approriate Prolific drivers (available from here, or use this one if having issues on Windows 7).

On a reasonably recent linux distribution, these adapters work without needing any drivers to be loaded. I tested a PL2303TA USB-serial adapter on Ubuntu 12.04 and Ubuntu 14.04.2, and it functioned without requiring any drivers.

After plugging the adapter into a USB port (with nothing connected to the trailing 4 wires of the adapter) of a PC running Ubuntu 14.04.2, syslog shows:

Jun 6 10:59:21 lappy kernel: [ 368.260077] usb 4-1: new full-speed USB device number 2 using uhci_hcd
Jun 6 10:59:21 lappy kernel: [ 368.425973] usb 4-1: New USB device found, idVendor=067b, idProduct=2303
Jun 6 10:59:21 lappy kernel: [ 368.425983] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Jun 6 10:59:21 lappy kernel: [ 368.425991] usb 4-1: Product: USB-Serial Controller
Jun 6 10:59:21 lappy kernel: [ 368.425998] usb 4-1: Manufacturer: Prolific Technology Inc.
Jun 6 10:59:21 lappy kernel: [ 368.705607] usbcore: registered new interface driver usbserial
Jun 6 10:59:21 lappy kernel: [ 368.705881] usbcore: registered new interface driver usbserial_generic
Jun 6 10:59:21 lappy kernel: [ 368.706167] usbserial: USB Serial support registered for generic
Jun 6 10:59:21 lappy kernel: [ 368.730260] usbcore: registered new interface driver pl2303
Jun 6 10:59:21 lappy kernel: [ 368.732310] usbserial: USB Serial support registered for pl2303
Jun 6 10:59:21 lappy kernel: [ 368.734135] pl2303 4-1:1.0: pl2303 converter detected
Jun 6 10:59:21 lappy kernel: [ 368.745951] usb 4-1: pl2303 converter now attached to ttyUSB0

Running lsusb shows the device as:

  Bus 004 Device 002: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port


Pinout

The pinout of the four wires on the PL2303TA USB-serial adapter are:
  • red: +5V
  • white: RXD (+3.3V)
  • black: ground
  • green: TXD (1-wire data)
business-end of the PL2303TA USB-serial adapter
business-end of the PL2303TA USB-serial adapter


Parasitic Mode Circuit

When operating in parasitic mode, power is not provided to the DS18S20 temperature sensors, but the sensors source required power from the data line. This does introduce some limitations, where the wiring between the interface circuit and the sensors is apparently limited to approx 100m, and the maximum temperature is reduced from 125 degrees to 70-75 degrees Celcius.

To use the PL2303TA USB-serial adapter with temperature sensors in parasitic mode, connect one or more DS18S20 temperature sensors as follows:
  • red: un-used
  • white: un-used
  • black: connect to GND and VDD pins of temperature sensor
  • green: connect to DQ pin of temperature sensor

connecting a DS18S20 temperature sensor to a PL2303TA USB-serial adapter in parasitic mode
connecting a DS18S20 temperature sensor to a PL2303TA USB-serial adapter in parasitic mode


two DS18S20 temperature sensors connected in parasitic mode on breadboard
two DS18S20 temperature sensors connected in parasitic mode on breadboard
(the red component in the breadboard between the headers and sensors is an insulated wire link)


Multiple temperature sensors can be connected in parallel to a PL2303TA USB-serial adapter, in the same way as with a serial port interface circuit.

multiple DS18S20 temperature sensors connected to a PL2303TA USB-serial adapter in parasitic mode
multiple DS18S20 temperature sensors connected to a PL2303TA USB-serial adapter in parasitic mode


Update - different PL2303TA adapters required different wiring configuration

While a couple of batches of PL2303TA USB-serial adapters worked fine using the above configuration, I have encountered several other batches that didn't work in that configuration - digitemp couldn't find any temperature sensors connected to the USB-serial adapters.

Instead, those PL2303TA USB-serial adapters only worked as follows:
  • red: un-used
  • white: connect to DQ pin of temperature sensor
  • black: connect to GND and VDD pins of temperature sensor
  • green: connect to DQ pin of temperature sensor
Interestingly, the original batches of PL2303TA USB-serial adapters do NOT work if the white wire is connected to the DQ pin, but only work with the white wire disconnected.

If using only the black and green wires doesn't work with your PL2303TA USB-serial adapters, try connecting the white wire to the DQ pin too, and see if that helps.

alternative wiring for DS18S20 temperature sensor to a PL2303TA USB-serial adapter in parasitic mode
alternative wiring for DS18S20 temperature sensor to a PL2303TA USB-serial adapter in parasitic mode


PL2303TA adapters and powered / non-parasitic mode

The PL2303TA USB-serial adapters that only worked with the white wire connected to the DQ pin also worked fine when connected to temperature sensors in powered mode - ie, the VDD pin connected to the red wire instead of the black wire.

The original batches of PL2303TA USB-serial adapters (that only worked with the white wire disconnected) did not work in powered mode - with or without the white wire connected.

DS18S20 temperature sensor connected to a PL2303TA USB-serial adapter in powered mode
DS18S20 temperature sensor connected to a PL2303TA USB-serial adapter in powered mode


Testing Parasitic Mode with Long Cable Lengths

I tested a PL2303TA USB-serial adapter with three DS18S20 temperature sensors connected in parallel in parasitic mode at the end of a 300 metre length of CAT5E cable, and found that it worked fine; digitemp was able to find all three temperature sensors, and was able to reliably query them without any issues.

temperature sensors at the end of 300m of CAT5 cable
three temperature sensors in parasitic mode connecting the USB-serial adapter to the CAT5 305 metres of CAT5E
three DS18S20 temperature sensors at the end of 300 metres of CAT5E cable
(the red component in the breadboard between the headers and sensors is an insulated wire link)

These test results make me question the need to connect temperature sensors in non-parasitic (powered) mode when using these PL2303TA USB-serial adapters, as this test indicates the PL2303TA works fine in parasitic mode, even over longer cable lengths.


Linux Software

Querying the temperature sensors connected via a PL2303TA USB-serial adapter on linux is virtually the same as described for those connected via a physical serial port interface. The only difference is the need to specify the USB port instead of the serial port when initialising digitemp:

  digitemp_DS9097 -i -s /dev/ttyUSB0 -c /etc/digitemp.conf

which should return details of every temperature sensor that digitemp finds on the 1-wire bus:

  DigiTemp v3.5.0 Copyright 1996-2007 by Brian C. Lane
  GNU Public License v2.0 - http://www.digitemp.com
  Turning off all DS2409 Couplers
  ..
  Searching the 1-Wire LAN
  10E8EF3E01080046 : DS1820/DS18S20/DS1920 Temperature Sensor
  1037113F0108002D : DS1820/DS18S20/DS1920 Temperature Sensor
  ROM #0 : 10E8EF3E01080046
  ROM #1 : 1037113F0108002D
  Wrote /etc/digitemp.conf

Once initialised, temperatures can be queried in the same way:

  digitemp_DS9097 -a -q -c /etc/digitemp.conf

which will return a reading from each temperature sensor that is connected:

  Jun 06 12:10:55 Sensor 0 C: 22.61 F: 72.70
  Jun 06 12:10:56 Sensor 1 C: 22.62 F: 72.72


Windows Software

The Win95 version of digitemp (download from here) works with the PL2303TA USB-serial adapters under Windows. Install Windows drivers from one of the following locations:
  • Prolific PL2303 drivers from prolific website
  • older Prolific PL2303 drivers v1.013 if you're having issues on Windows 7 from adafruit
Connect the PL2303TA USB-serial adapter to a USB port, and check what COM port is assigned to it (Control Panel -> System -> Device Manager -> Ports (COM & LPT) -> Prolific USB-to-Serial Comm Port -> Port Settings -> Advanced).

I found that the PL3203TA drivers mapped the USB-serial adapter to COM11, but digitemp can't handle high port numbers. Go to Control Panel -> System -> Device Manager -> Ports (COM & LPT) -> Prolific USB-to-Serial Comm Port -> Port Settings -> Advanced, and change the COM Port Number to the lowest-numbered un used port that you can (I used COM2).

Initialise digitemp:

  digitemp.exe -s2 -i

and you'll just get the digitemp copyright notice, with no additional output.

Query all temperatures with the read delay increased:

  digitemp.exe -s2 -r2000 -a

and it should return the temperature of each connected sensor:

  Sensor 106e2eee0008005b C: 20.00 F: 68.00
  Sensor 106e13ee00080033 C: 20.50 F: 68.90

You can read individual temperature sensors using the following syntax for the first sensor:

  digitemp.exe -s2 -r2000 -t0

and for the second sensor:

  digitemp.exe -s2 -r2000 -t1


next page: linux software


last updated 27 Feb 2020
 
.