Geeks usually have, in their DIY bags, many usb-to-serial converters such as Arduino’s or Openpicus’. These converters, for the people not accustomed to microcontrollers’ world, are circuits normally used for uploading compiled code from the PC. Additionally, they are used to serially communicate with the PC. They take usb signal and convert it to serial TTL.
Even though serial TTL is very important when communicating with microcontrollers, many home and industrial devices exchange data using RS485 protocol. The main benefits of using RS485 are basically efficiency, economy, the long distances allowed between devices (up to 1200 meters) in electrically noisy environments.
The converters presented above are not compatible with the RS485 protocol and communication can not be performed. Because of that, the output signal of the converter needs to be further modified to comply with the 485 standard. This is usually done by using for instance the Maxim’s MAX485 chip (or eventually the cheaper one like for instance 75176). Indeed, since the RS485 is a half-duplex protocol, it does not allow sending and receiving data at the same time. This is normally accomplished by using MAX485’s TX and RX enable pins (specifically the RE* and DE pins on the chip).
In this post we want to present a simple hacking procedure in order to use an existing usb-to-serial converter to communicate with a device over RS485. The only three ingredients needed are the following:
- a beginner soldering experience,
- a max485, or equivalent chip,
- a usb-to-serial converter (for our experiments, we used the OpenPicus’ usb serial converter)
The key point here is to use the CBUS2 pin of the FT232RL chip that is normally shipped within the usb-to-serial converter but it is not usually connected to the main board. Because of that, it is necessary to solder the pin (located to the bottom left of the chip, pin #13) to a wire. Essentially, this pin goes to 5v as soon as the chip receives data to send and goes back to 0v when sending buffer is empty. The wire connected to CBUS2 pin will be used basically to enable the MAX485’s TX pin. Even though in the FT232R datasheet, there exist an alternative solution that use both CBUS2 and CBUS3 pins to obtain an usb-to-rs485 converter, with MAX485 only one pin is necessary. The wire will be connected both to MAX485’s RE* and DE pins (see figure below) such that when FT232R is processing TX data, the RX channel will be automatically disabled.
The procedure explained in this post gives a general idea of how simply and cheaply expands a conventional usb-to-serial converter in order to communicate over RS485. Although RS485 is well known mainly in industrial context, it represents a very interesting and cost-effective opportunity in other contexts such as in home automation.