Transistor to switch signal lines TX and RX

Hi,

I like to make a switch between the uart signal lines. The switch should be operated with an output pin of an Arduino.

In this way I want to block or open the serial connection to the Arduino.

Could i use a NPN or PNP transistor and make this into a switch? I wonder if this will work because a the uart signal is only a very small amount of current and most of the time NPN and PNP transistors are used to switch larger loads.

Thanks

Edit: Ok so i think my below schematic should do what i want. For resistor 2 i would pick a 330ohms? 0.16mah at 5v?

What would i make R1 and anyone any objections?

For as i gather it, if i make the Arduino pin high, it can source current for the circuit and af the TX is high it will make RX high as well.

PB110980.png|294x261

92c8ee18e9f66ae8db783cfb2e990a67ba31b20a.png

Why would you revert to RTL when logic gates - CMOS - were invented over 30 years ago?

Please enlighten me.

1 have 1 serial connection and i need to control 2 Arduino pro's. So i need to cut of the serial connection between 1 of them.

1 of the Arduino's is sending DMX signals over the same UART, the other is maintaining a serial connection. In this state i need to break the connection between Arduino 1 and 2. So dmx is not interfering with the serial.

In case i want to upload a new sketch to the Arduino 2 (dmx) i send a command to Arduino 1 and it will tell arduino 2 to stop and wait for a new sketch. In this case i need to reconnect the Serial connection.

So basically i need a relay, but I do not like the idea of bounce when it connects.

Im googleing RTL en CMOS at the moment ;)

As I said, RTL - like your circuit - is what you do not want to use!

You need to decide which is the desired "idle" state of your serial link. Usually it is HIGH, so you want an OR gate which will be held high when either input is high, so you could use a 74HC4072 (quad OR gate).

They are however, not as common as a 74HC00 quad NAND gate in which you can use two of the gates - you feed your serial line into both inputs of the first gate tied together, its output to one input of the second gate; then when the second input of that gate is HIGH the output follows the input, when it is LOW, the output is held HIGH.

The only resistor you might need is a pull-down on that second gate input (47k) so that it is held off when the Arduino is in reset.

(Could not for the life of me find a diagram of this on Google!)

Quad OR gate, 74HC32, no problem getting one, thruhole or SMD http://www.digikey.com/product-search/en?keywords=74hc32

74hc4072 not available anymore, obsolete.

But, if you want to control it from the Arduino itself, why not simply call Serial.end()? This disables the serial on the pins just making them harmless inputs.

And by the way, if you add 2 diodes to the Arduino's TX lines and a pull up at the RX it's just fine to connect multiple Serial devices :) You only have to decide whether or not to do something with the serial data and time when it's save to sent data to the PC/host. Because only one Arduino can transmit at the same time...

Thanks for the feedback.

I control from within the Arduino's who listens to whatever is said on the Serial. using Serial.end and Serial.peek

The issue is that Arduino 2 is sending DMX, this is interfering with the Serial. So I want to be able to close off(hardware way) the serial connection between the 2.

I understand my proposal does not work as it will hold the line LOW.

I'm placing a small mechanical relay at the moment.

You need to look at multiplexers / demultiplexers to switch the serial data stream to where ever you want. Look at the 74LS153 and the 74LS155.

because a the uart signal is only a very small amount of current and most of the time NPN and PNP transistors are used to switch larger loads.

Simply nonsense.

74HC125, disable whatever output you want. Can use it in both directions too.

Serial_Muxing.jpg|960x720

The issue is that Arduino 2 is sending DMX, this is interfering with the Serial. So I want to be able to close off(hardware way) the serial connection between the 2.

You might explain what that is about. You probably could use 74HC4051 multiplex chip to act as a line switch.

Arduino 2 is sending DMX but why is it connected to the serial of Arduino 1 and the PC?