keskiviikko 4. tammikuuta 2012

USB datacable as a temperature sensor (DS18B20)

As many other amateur hobbyists, I also wanted to keep eye on room temperatures using Dallas DS18B20 1-wire temperature sensors. I am using Linux, and digitemp software handles the software side. On the hardware side, the "standard" solution has been to run 1-wire sensors in parasitic mode, 

as described in
However, as today's desktop computers rarely have a serial port anymore, the above approach is no longer self-evident. Leon Kos has written clear instructions on how to connect DS18B20 to "3.3 V serial port" of Linksys WRT routers:

http://www.lecad.fs.uni-lj.si/~leon/other/wlan/wrt54ow/

As many USB datacables for mobile phones actually include such a serial port AND a 5V output (of USB port), we can easily adapt the above work. I managed to get cheaply a third-party datacable designed for Ericsson T39,T65, T68(i), ... , which includes Prolific PL2303 serial port converter chip (see dmesg output in Linux), but any other similar cable should do the trick. Below is the schematics I used, which is essentially 1-to-1 with the latter design of Leon Kos.

The end result is illustrated below.

Based on a quick web search, it seems that at least the following mobile phones use 3.3V serial communication, and thus their data cables might work out (I only have experience with the Ericsson cable shown above):
  • Ericsson/Sony Ericsson: T39, T65, T68(i), T230, T3xx, T6xx, ...
  • Motorola V80, V300, V303, V400, V500, V501, V525, V600, ...
  • Siemens S/C25, S/C/M35 and S/SL/ME/M45
  • Nokia CA-42 and DKU-5 cables and their clones (see gnokii website)
Note also that you need +5V (or +3.3V) for the circuit.