I am planning to use this UART-to-RS485 module :- http://www.elecrow.com/uart-ttl-to-rs485-twoway-converter-p-1545.html. This module is bidirectional and uses a single pair of differential signal to transmit/receive data. My question is how is the chip deciding whether it has to transmit data from TXD to A+ B- or from A+ B- to RXD?. Shouldn't there be 2 pair of differential signals, one pair for TX and the other pair for RX? What is happening in this module??
-
6\$\begingroup\$ Have you looked at how rs485 works? Did you come across the term "half duplex" during your research? \$\endgroup\$– PlasmaHHJul 5, 2016 at 10:59
-
3\$\begingroup\$ @PlasmaHH - I think you may be missing the point i.e. how does the chip automatically change data direction. \$\endgroup\$– Andy akaJul 5, 2016 at 11:03
-
\$\begingroup\$ @dim: interesting, I only ever worked with three wire rs458 (D+, D-, GND) in a bus setup where you have to deal with access collisions anyways. \$\endgroup\$– PlasmaHHJul 5, 2016 at 11:23
-
1\$\begingroup\$ I think it would be helpful if you tell which RS485 transceiver that's mounted on the board. \$\endgroup\$– LundinJul 5, 2016 at 14:20
3 Answers
More than likely it switches into transmit mode when TXD becomes active and a diode and capacitor "latch" that first transmit edge and hold that voltage "active" for longer than at least one byte.
I see a little surface mount diode on the PCB (D1) and quite possibly this is what I'm referring to. I have seen this trick done before and the only disadvantage is that when the TX session ends there might be a few milliseconds to wait before the RX direction is restored (due to the capacitor discharging).
I found this on the web as a partial circuit: -
When receiving, TX0 is active high thus forcing a low on DE (as expected). When TX0 goes low it rapidly discharges C0 and sets up the direction port for transmitting. When transmitting and TX data changes state, C0 remains largely discharged although ultimately R3 will slowly (relatively speaking) re-charge it but not until some time after the last transmit byte has been sent. Values shown i.e. 22k and 1000pF are dependent on baud rate.
-
\$\begingroup\$ sir could you please draw the circuit \$\endgroup\$ Jul 5, 2016 at 11:21
-
6\$\begingroup\$ @RishiSharma -You have the module. Why don't you inspect the circuit, get data sheets for the parts and draw your own schematic. It is rather outlandish that you could even expect Andy to do it then even have the gall to ask in the first place. \$\endgroup\$ Jul 5, 2016 at 13:14
-
\$\begingroup\$ @MichaelKaras well I don't have the module actually........I was thinking of replicating it on a pcb I am designing.....I just couldn't figure out the working of this module. Plus there is no datasheet or anything that I could find on the website. \$\endgroup\$ Jul 5, 2016 at 14:25
-
3\$\begingroup\$ @RishiSharma - Well your question did say "I am using this RS485...". \$\endgroup\$ Jul 5, 2016 at 21:32
-
1\$\begingroup\$ It might be a hex inverter, a quad nand gate or a quad or gate. \$\endgroup\$– Andy akaJul 30, 2016 at 9:02
I reverse engineered the exact board pictured in the asker's post. The resistor and capacitor values are not what are there on the board - I selected them for my own circuit. However the schematics is almost accurate - "almost" because I have added a 120 ohms impedance matching resistor and capacitors on the A+, B- lines.
-
1\$\begingroup\$ Are you sure (in your schematic) that the "GND" net for the RS-485 side of the circuit is the same "GND" net for the digital side? I found no such connection within an identical module. Did you add it? \$\endgroup\$ Mar 5, 2020 at 20:03
-
\$\begingroup\$ @DineshT your solution not working in my case. I reverse engineering the blue board again. Here is my solution: USB/UART - RS-485 Converter \$\endgroup\$– GregoryJul 6, 2021 at 16:09
Working with DineshT's circuit as a starting point, I had an EE friend of mine work from that circuit as well as a sample of one of these boards. Our boards were purchased from Drok, who is a reseller on Amazon. The primary reason for reverse engineering the boards was to ensure they were RoHS compliant. If that is not important, the Drok boards work perfectly fine. The Drok boards had atypical spacing between the pins, which for compatibility, we kept. As noted elsewhere, ground on the right side is not connect to EARTH on the right side. There is an LDO voltage regulator that allows one of these to work with 5V and 3.3V Arduino and other boards. The RS-485 chip we used is nicely speced.