Maker Pro
Maker Pro

How to switch TX, RX,RTS & CTS from an RS232 port to a tranceiver?

D

David Requena

Hi All,

My current project involves adding bluetooth to a pda that lacks it.
For this I've settled in a BT module with uart interface that will be
connected throught a transceiver to the pda's current rs232 port.

Instead of anulating the rs232 external port I would like to add an
external switch that (probably by means of a relay) would switch TX,
RX,RTS & CTS lines from the port to the transceiver when and back.

Given that I'm not an expert, the voltages involved and switch current
bounce oddities, I'm not even sure this is a good idea or even
feasible..

Any pointers?

Thaks a lot,
David
 
P

Pooh Bear

David said:
Hi All,

My current project involves adding bluetooth to a pda that lacks it.
For this I've settled in a BT module with uart interface that will be
connected throught a transceiver to the pda's current rs232 port.

Instead of anulating the rs232 external port I would like to add an
external switch that (probably by means of a relay) would switch TX,
RX,RTS & CTS lines from the port to the transceiver when and back.

Given that I'm not an expert, the voltages involved and switch current
bounce oddities, I'm not even sure this is a good idea or even
feasible..

I don't quite understand where the switch comes into play.

As long as you're not interrupting data transmissions I can't see any problem.

Graham
 
C

Chris

David said:
Hi All,

My current project involves adding bluetooth to a pda that lacks it.
For this I've settled in a BT module with uart interface that will be
connected throught a transceiver to the pda's current rs232 port.

Instead of anulating the rs232 external port I would like to add an
external switch that (probably by means of a relay) would switch TX,
RX,RTS & CTS lines from the port to the transceiver when and back.

Given that I'm not an expert, the voltages involved and switch current
bounce oddities, I'm not even sure this is a good idea or even
feasible..

Any pointers?

Thaks a lot,
David

Hi, David. If you've only got two devices communicating, I'm not sure
why you'd need a switch at all.

Given that, physical switching of RS-232 signals isn't too difficult.
I have used 4PDT telephone service relays for this successfully. It's
better to use pullup/pulldown resistors to ensure the lines stay in a
known inactive logic state when the relay contacts open.
From a software standpont, you'll then just have to ensure no one's
talking or listening when you do the switch.

Good luck
Chris
 
D

David Requena

Pooh said:
I don't quite understand where the switch comes into play.

Ok, my fault, I'll try to explain better :)

Basically there'd be one rs232 port shared between two transceivers;
one being the machine's own one, the second being added by me. My idea
about the switch/relay was to be able to attach the port to one
transceiver or the other at any one time while maintaining the other
one isolated from the channel.

I'm concerned that when both transceivers are simultaneously connected
to the port one of them would be driving high the other one's output
lines (TX,RTS). Given rs232 voltage range maybe this could damage one
or both tranceivers..

Here comes the idea of switching these four lines (the others not being
used)
Alternatively I could perhaps insert some diodes to achieve the same
effect?
As long as you're not interrupting data transmissions I can't see any problem.

You seem to imply I could just fork the lines in a "Y" fashion and
everithing would be well as long as only one of the transceivers is
communication at any one time. Did I understand right?

Thanks again,
David
 
P

Pooh Bear

David said:
Ok, my fault, I'll try to explain better :)

Basically there'd be one rs232 port shared between two transceivers;
one being the machine's own one, the second being added by me. My idea
about the switch/relay was to be able to attach the port to one
transceiver or the other at any one time while maintaining the other
one isolated from the channel.

I'm concerned that when both transceivers are simultaneously connected
to the port one of them would be driving high the other one's output
lines (TX,RTS). Given rs232 voltage range maybe this could damage one
or both tranceivers..

They're supposed to be quite robust so probably not a problem.
Here comes the idea of switching these four lines (the others not being
used)
Alternatively I could perhaps insert some diodes to achieve the same
effect?

Diodes won't work.
You seem to imply I could just fork the lines in a "Y" fashion and
everithing would be well as long as only one of the transceivers is
communication at any one time. Did I understand right?

No. You can't have them both connected at the same time.

You ideally need what's called a 'break before make' changeover switch ( 4 pole ).

Graham
 
D

David Requena

Chris said:
Hi, David. If you've only got two devices communicating, I'm not sure
why you'd need a switch at all.

So there appears not to exist any electrical problem! Given that the
port has a cover, I can shutdown my transceiver when it opens. So there
could be only one communication at a any one time:

- original transceiver <--> added transceiver --> and then BT module
- original transceiver <--> device connected to port

In the second case a modem connected to the port would be feeding
potentially high voltages (-15 to +15 volt ??) to my shutdown
transceiver (MAX3218) if lines are not switched.

Thats no problem for me as long as nothin breaks :)
Given that, physical switching of RS-232 signals isn't too difficult.
I have used 4PDT telephone service relays for this successfully. It's
better to use pullup/pulldown resistors to ensure the lines stay in a
known inactive logic state when the relay contacts open.

I'll do some research on what a 4PDT telephone service relay is prior
to comment further on this..
talking or listening when you do the switch.

Of course you're right

Thanks for your reply,
David
 
D

David Requena

Now I'm getting confused

Pooh said:
They're supposed to be quite robust so probably not a problem.

hmm... so there is no need to electrically disconnect the transceivers?
Diodes won't work.

Ok, my homework to research why they wont. Main point of this project
is to learn :)
No. You can't have them both connected at the same time.

but here it seems one transceiver must be electrically disconnected
indeed..
do I miss something? if driving outputs high from the line instead of
from the transceiver is not a problem, then what?

Please, bear with me if I ask dumb questions. I know very little on
electronics. I've some knowledge on digital circuits but thats all.
You ideally need what's called a 'break before make' changeover switch ( 4 pole ).

aha, that's it! Original question was about what would I need for
performing the switch :)
Do this component exist in the form of an IC? Do exist in some form of
relay that could be activated by a line drived from a microswitch at
the port's cover lid?

Thanks for your patience,
David
 
C

Chris

David said:
So there appears not to exist any electrical problem! Given that the
port has a cover, I can shutdown my transceiver when it opens. So there
could be only one communication at a any one time:

- original transceiver <--> added transceiver --> and then BT module
- original transceiver <--> device connected to port

In the second case a modem connected to the port would be feeding
potentially high voltages (-15 to +15 volt ??) to my shutdown
transceiver (MAX3218) if lines are not switched.

Thats no problem for me as long as nothin breaks :)


I'll do some research on what a 4PDT telephone service relay is prior
to comment further on this..


Of course you're right

Thanks for your reply,
David

Hi, David. Manual relay switching of RS-232 lines (especially if
you're only going with TxD, RxD, RTS and CTS is relatively easy.

You need a small 4 pole relay which is capable of switching small
currents at lower voltages. Specifically, you need a relay contact
capable of "dry switching", which means a low voltage (yes, +/-12V is
low voltage for relays) at low current (<5mA) will still have a good,
low ohm contact.

You might want to look at the Omron G6A line, specifying 4PDT and
*non-latching* version. If you've got 5V to drive the coils, try
looking at the G6A-474P-ST20-US-DC5, which is available at Mouser for
$7.75 USD in single quantities.

http://www.mouser.com/

Check the website and take a look at the data sheet.

Again, remember that the receiving lines on each side need a resistor
pullup/pulldown to place the line in a known, inactive state while
switching is taking place. I used 2.2K resistors, which won't load the
line too heavily, but ensure a good RS-232 voltage when the relays are
open, and provide enough switching current. Otherwise, you'll end up
getting very familiar with clearing and resetting your UART registers.
Voice of experience. :-(

Good luck
Chris
 
D

David Requena

Just to clarify. I got really confused in my explanation..


The setup is that machine's original transceiver will remain allways
connected to the channel and the uart of the pda. Sometimes, it's going
to "talk" to the added transceiver wich in turn is connected to the BT
module.The rest of the time original transceiver should remain
connected to the existing rs232 port in order to communicate with a
modem or whatever device connected to the port.

The switching (if needed) would be driven from a switch installed at
the rs232 port's cover lid.

I'm sorry for any missunderstanding I may have caused,
David
 
D

David Requena

Chris, thanks for the very instructive post
Hi, David. Manual relay switching of RS-232 lines (especially if
you're only going with TxD, RxD, RTS and CTS is relatively easy.

So did I hope initially :)
You might want to look at the Omron G6A line, specifying 4PDT and
*non-latching* version. If you've got 5V to drive the coils, try
looking at the G6A-474P-ST20-US-DC5, which is available at Mouser for
$7.75 USD in single quantities.

Something like this is what I was thinking about initially.
I had a look at the datasheet. I've a 6V max 30mA line available for
driving the coil which matches exactly the datasheet. I'd rather to
have some margin...

The biggest problem is that I'll be trying to cram this thing inside a
pda!! I cannot imagine how this could be made to fit..
Well, now that I know the requierements I'll try to find a smaller
equivalent.

I'm a bit curious. At first you, and also Graham, seemed to neglect the
need for fisical switching of serial lines but now both of you agree on
this same need. I'm sure I'm missing something..
Again, remember that the receiving lines on each side need a resistor
pullup/pulldown to place the line in a known, inactive state while
switching is taking place. I used 2.2K resistors, which won't load the
line too heavily, but ensure a good RS-232 voltage when the relays are
open, and provide enough switching current. Otherwise, you'll end up
getting very familiar with clearing and resetting your UART registers.
Voice of experience. :-(

This very same piece of info I'll save to avoid repeating your bad
experience :)

Thanks a lot again
David
 
C

Chris

David said:
Chris, thanks for the very instructive post


So did I hope initially :)


Something like this is what I was thinking about initially.
I had a look at the datasheet. I've a 6V max 30mA line available for
driving the coil which matches exactly the datasheet. I'd rather to
have some margin...

The biggest problem is that I'll be trying to cram this thing inside a
pda!! I cannot imagine how this could be made to fit..
Well, now that I know the requierements I'll try to find a smaller
equivalent.

I'm a bit curious. At first you, and also Graham, seemed to neglect the
need for fisical switching of serial lines but now both of you agree on
this same need. I'm sure I'm missing something..


This very same piece of info I'll save to avoid repeating your bad
experience :)

Thanks a lot again
David

Hi, David. A couple of notes here:

If you don't have 150mW to spare, you're not going to be able to power
a relay coil, especially one with 4 poles. The Omron one specified has
pretty low current.

Whether you use a relay or a 4PDT rotary switch (e.g. E-Switch
Adjustable Stop Rotary Switch, 4P3T Solder Eyelet, Digi-Key P/N
EG1958-ND for $5.07 USD ), you're not going to fit this inside some
PDA. Depending on the power supplies you have available, your most
space-limited option would be to use two quad analog switch ICs that
can handle RS-232 voltage and use a micro pushbutton or switch to turn
them on/off. You'd have to actually take the time to describe what you
have and what you want in some detail for more advice here. I'd prefer
not to go through 20 questions before you've taken the time to describe
things.

No matter what, you can always go with the noble tradition of the
external blivet box.

If you'll reread your initial post, *you* suggested the mechanical
switch.

But whether you use relay, mechanical switch, quad analog switch ICs or
any combination thereof, don't forget the pullup/pulldowns!

By the way, what's "anulating" (first post)? Did you mean "emulating"?

Good luck
Chris
 
H

Holger Petersen

Diodes won't work.

Why not?

This comes from an ancient BYTE (or KILOBAUD :) where someone had one Ter-
minal in the living room and one other near the (South-West TC 68oo IIRC)
Computer:

one Output ------*
|
|
===
/ \
/ \
-----
|
-9 Volt |
or -/\/\/--*---------> one Input
Handshake- |
Line |
-----
\ /
\ /
===
|
|
another |
Output ----------*

The Resistor being about 5.6 to 10 KOhm.


just asking, Holger
 
D

David Requena

Chris said:
Hi, David. A couple of notes here:

If you don't have 150mW to spare, you're not going to be able to power
a relay coil, especially one with 4 poles. The Omron one specified has
pretty low current.

I don't think I've that much on this particular 6V line. I've 3V
(that's batery voltage) elsewhere but then I'll go 66 mA for the relay
coil. That's a bit much, I'd rather "anulate" the port (more on this
below)
them on/off. You'd have to actually take the time to describe what you
have and what you want in some detail for more advice here. I'd prefer
not to go through 20 questions before you've taken the time to describe
things.

Ok, I'll post a diagram with parts, explanations, etc. on some webspace
and come back with a link :)
No matter what, you can always go with the noble tradition of the
external blivet box.

I'd try some modification of the Free2move Bluetooth serial port plug
(F2M01) at http://www.free2move.se/prod_spp.shtml. Then I wouldn't mind
about serial lines switching at all, just plug it in or out :)
Maybe I'll be forced throught this way..
If you'll reread your initial post, *you* suggested the mechanical
switch.

Please, bear with my poor english (and electronics knowledge). My first
idea was a mechanical switch that would drive a relay's coil. Sorry for
the poor phrasing
But whether you use relay, mechanical switch, quad analog switch ICs or
any combination thereof, don't forget the pullup/pulldowns!

Sure, I'm really aware of the problem know. This will save my day as I
won't have any kind of low level access tho the UART from software
(reseting registers and the like). I'll only be able to send
commands/data on the serial channel. I'll explain every detail jointly
with the diagram.
By the way, what's "anulating" (first post)? Did you mean "emulating"?

Oh, bad english again.. babelfish comes up whith "annulling" for what I
meant.
As I see it, I could just reroute TX, RX,RTS & CTS to my tranceiver/BT
module conbination, thus leaving a dead (anulled) rs232 port; or I
could try to devise some kind of "switching" mean in order to be able
to select betwen rs232 cable or bluetoth SPP operation.

OK, no more questions for the moment; back to drawing :)

Regards,
David
 
D

David Requena

Holger said:
Why not?

This comes from an ancient BYTE (or KILOBAUD :) where someone had one Ter-
minal in the living room and one other near the (South-West TC 68oo IIRC)
Computer:

one Output ------*
|
|
===
/ \
/ \
-----
|
-9 Volt |
or -/\/\/--*---------> one Input
Handshake- |
Line |
-----
\ /
\ /
===
|
|
another |
Output ----------*

The Resistor being about 5.6 to 10 KOhm.

I fail to see how this circuit would work.

I quickly realized diodes where a dumb idea (rs232 signals singing from
-5, -15 to +5, +15 volts) but now I think I don't understand anything.

Would this rely on the nonstandard assumption of:

Mark(1) --> -5 ... -15 volt
Space(0) --> 0 volt

Instad of the standard:

Mark(1) --> -5 ... -15 volt
Space(0) --> -5 ... +15 volt

I'm aware most receivers will cope with this but.. Anyway, do I have a
clue?
 
R

Rich Grise

Ok, my fault, I'll try to explain better :)

Basically there'd be one rs232 port shared between two transceivers;
one being the machine's own one, the second being added by me. My idea
about the switch/relay was to be able to attach the port to one
transceiver or the other at any one time while maintaining the other
one isolated from the channel.

Does it have to be electrically controlled? You could use one of these:
http://cgi.ebay.com/DB9-Female-AB-2...ryZ39803QQssPageNameZWD1VQQrdZ1QQcmdZViewItem
You might have to unwrap the link.

But that's not the only one of these that you can get; your local
computer store probably has one. Otherwise, any 4PDT relay with "dry
switching", as someone mentioned - I think Chris.

Good Luck!
Rich
 
P

Pooh Bear

David said:
Now I'm getting confused



hmm... so there is no need to electrically disconnect the transceivers?

There's a need to 'switch them over' for functionality but a brief 'shorting out' of
one signal to another is unlikely to cause a catastrophe.

Ok, my homework to research why they wont. Main point of this project
is to learn :)


but here it seems one transceiver must be electrically disconnected
indeed..
Yes.

do I miss something? if driving outputs high from the line instead of
from the transceiver is not a problem, then what?

You differentiate betweem 'line' and transceiver ? I don't understand what you mean.
Please, bear with me if I ask dumb questions. I know very little on
electronics. I've some knowledge on digital circuits but thats all.


aha, that's it! Original question was about what would I need for
performing the switch :)
Yes.

Do this component exist in the form of an IC?

I meant a 'physical switch'. If you need this to be accomplished under program control
then use a similar style relay.
Do exist in some form of
relay that could be activated by a line drived from a microswitch at
the port's cover lid?

You could do that, yes.

Graham
 
P

Pooh Bear

David said:
Chris, thanks for the very instructive post


Something like this is what I was thinking about initially.
I had a look at the datasheet. I've a 6V max 30mA line available for
driving the coil which matches exactly the datasheet. I'd rather to
have some margin...

You won't find relays with much greater sensitivity than that.

Graham
 
P

Pooh Bear

Holger said:
Why not?

This comes from an ancient BYTE (or KILOBAUD :) where someone had one Ter-
minal in the living room and one other near the (South-West TC 68oo IIRC)
Computer:

one Output ------*
|
|
===
/ \
/ \
-----
|
-9 Volt |
or -/\/\/--*---------> one Input
Handshake- |
Line |
-----
\ /
\ /
===
|
|
another |
Output ----------*

The Resistor being about 5.6 to 10 KOhm.

Aren't the diodes the wrong way round ? That might indeed work but I'm not
familiar with the quiesecnt state of the RS232 lines so played safe. It would
suffer at high data rates though. That could be fixed by using some active
devices though.

Graham
 
P

Pooh Bear

David said:
I fail to see how this circuit would work.

I quickly realized diodes where a dumb idea (rs232 signals singing from
-5, -15 to +5, +15 volts) but now I think I don't understand anything.

Would this rely on the nonstandard assumption of:

Mark(1) --> -5 ... -15 volt
Space(0) --> 0 volt

Instad of the standard:

Mark(1) --> -5 ... -15 volt
Space(0) --> -5 ... +15 volt

I'm aware most receivers will cope with this but.. Anyway, do I have a
clue?

There is indeed an issue with the various 'flavours' of implementing RS232.
That's why physical disconnection is the best idea.

Graham
 
J

Jasen Betts

Ok, my fault, I'll try to explain better :)

Basically there'd be one rs232 port shared between two transceivers;
one being the machine's own one, the second being added by me. My idea
about the switch/relay was to be able to attach the port to one
transceiver or the other at any one time while maintaining the other
one isolated from the channel.

I'm concerned that when both transceivers are simultaneously connected
to the port one of them would be driving high the other one's output
lines (TX,RTS). Given rs232 voltage range maybe this could damage one
or both tranceivers..
Here comes the idea of switching these four lines (the others not being
used)
Alternatively I could perhaps insert some diodes to achieve the same
effect?

one high one low ould be like both driving a short circuit (if they are of
the same type) and they are rated to withstand that condition indefinately,

it'd probably be ok. but if you're worried put some sort of OR gate in there.

eg:

TX1 --+--->|---+
| |
+-[1.2K]-+
|
|
+-[1.2K]-+---- out
| |
TX2 --+--->|---+

that'd protect the outputs from each other, 1/4 watt resistors will be fine
the diodes can be 1N914 or 1N4148 etc.

if that doesn't work try 560 ohm resistors instead of 1.2K

for DTR and RTS you'll probably want the diodes the other way around.
You seem to imply I could just fork the lines in a "Y" fashion and
everithing would be well as long as only one of the transceivers is
communication at any one time. Did I understand right?

that's unlikly to work, typically you'll not be able to drive the TX line
positive with that setup, and so the receiver may not see any data..

Bye.
Jasen
 
Top