13 August, 2010

How to convert an USB to RS232 adapter into an USB to 1-wire adapter

What hardware do you need:
  1. USB to RS232 cable with a case that can be opened (for example the USB-SERIAL-4 from ST-LAB)
  2. UART to 1-wire converter DS2480B from Maxim (samples are available)
  3. some wires, soldering station, external connector, ...
  4. some 1-wire or iButton slaves
The USB to RS232 cable is usually composed of a USB to UART chip and an 5V to RS232 level converter. With the cable I used the UART was PL2303 or the newer PL-2303HX (datasheet), depending on the cable version. The RS232 chip was SP213EH or ZT213AE, depending on the cable version, but the chips have compatible pinouts, probably also compatible with MAX232 chips.

I was able to get the cable schematic on a Chinese forum or cellphoneconnector.com, other cables are probably similar.



The next steps have to be performed to properly connect DS2480B to the UART chip:
  1. if you prefer not to remove the RS232 level converter, at least its outputs have to be disables, this can be done by lifting EN (pin 24) on the SP213 chip an connect it to GND instead of VDD
  2. glue DS2480B somewhere on the board
  3. connect GND, VDD (pins 1, 4) to power supply (I used the unmounted EEPROM pads)
  4. connect 1-W (pin 2) 1-wire signal and power to the external connector
  5. connect POL (pin 6) polarity signal and VPP (pin 5) programming voltage to VDD
  6. connect the UART TXD output (pin 1 on PL2303) to DS2480B TXD input (pin 7)
  7. connect the UART RXD input (pin 5 on PL2303) to DS2480B RXD input (pin 8)
Optionally you can also connect I2C SCL and SDA (accessible on pads reserved for the EEPROM) to the external connector. I did not test I2C, but there are some online instructions on how to use it.

Regarding the software, I used OWFS. I had to compile it since there are no Ubuntu/Debian packages available. I might add some details in a later post.