Can the RX and the TX share a single wire

20 Sep 2011

Hi all,

I have an odd "problem". I am refitting a model that was wired up some 15 years ago, with all connections using a three wire system. Where one wire is the ground, one is a +12 volt line and the third was used to signal a relay (basically another 12volt line). The wires are well and truly built into inaccessible parts of the model so I can't replace them.

Naturally I have decided to replace the switch and relay with a couple of micro controllers, one on each end of this old signal line via the UARTs. My first idea was to simply use the existing wire as a simple one way serial connection, so the operation of the system would be much the same as before, except I will now be able to send codes, rather than a single signal, to the back of the model and control more stuff with the receiving micro controller. All well and good.

But then the bought occurred to me that If I schedule communication on this single wire, I should be able to allow the micro controller at the rear of the model to send information back to the front.

I have attached a diagram of my idea, with a lamp in place of the RX pin and switch in place of the TX pin... now as long as I ignore the echo of the transmitting device receiving it's own transmission... I think this should work...

/media/uploads/bloodline/untitled.jpg

20 Sep 2011

I would think that you'd have to convert the TX pin to an Open Collector output before tying it to the RX pin. This can be done with a simple transistor or any simple logic chip that has open collector outputs.

20 Sep 2011

If you want some digital I/O or possible ADC, DAC then Dallas 1 Wire devices aremazing, not just temperature sensors.

Ceri

21 Sep 2011

Michael Hagberg wrote:

I would think that you'd have to convert the TX pin to an Open Collector output before tying it to the RX pin. This can be done with a simple transistor or any simple logic chip that has open collector outputs.

Looking through the Handbook shows me that there is already and API for dealing with this kind of transmission line, the rather obviously named serialHalfDuplex, that will teach me for not RTFM ;)

I don't see any notes about the TX needing to be and open collector, so thanks for the heads up! It's easy enough to do :)

-Edit- According to the Serial section in the handbook, you can just tie the lines together (as the slave microcontroller will be the trusty ATMega328) and everything will be TTL... It should be fine... I just need to write some halfduplex serial functions for the ATMega... If only there were a £5 mbed ;)