Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsElectronicsBasicsRepairDesignCADComponentsEquipmentElectrical Engineering
ElectronicsKB.com
Contact UsLink To UsSearch & Site Map

Electronics Forum / Basics / May 2006



Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David Requena - 26 May 2006 09:51 GMT
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
Pooh Bear - 26 May 2006 10:17 GMT
> Hi All,
>
[quoted text clipped - 9 lines]
> 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
David Requena - 26 May 2006 12:38 GMT
> > 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.
>
> 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
Pooh Bear - 26 May 2006 12:45 GMT
> > > 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,
[quoted text clipped - 14 lines]
> 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.

> > 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?

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
David Requena - 26 May 2006 13:48 GMT
Now I'm getting confused

> > 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.

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

> > Alternatively I could perhaps insert some diodes to achieve the same
> > effect?
>
> Diodes won't work.

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

> > 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.

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
David Requena - 26 May 2006 14:02 GMT
Just to clarify. I got really confused in my explanation..

> > > 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.

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
Pooh Bear - 26 May 2006 19:49 GMT
> Now I'm getting confused
>
[quoted text clipped - 6 lines]
>
> 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.

> > > Alternatively I could perhaps insert some diodes to achieve the same
> > > effect?
[quoted text clipped - 12 lines]
> 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.
[quoted text clipped - 3 lines]
> 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
Holger Petersen - 26 May 2006 16:13 GMT
>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
David Requena - 26 May 2006 17:34 GMT
> >Diodes won't work.
>
[quoted text clipped - 26 lines]
>
> 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?
Pooh Bear - 26 May 2006 19:59 GMT
> > >Diodes won't work.
> >
[quoted text clipped - 44 lines]
> 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
Pooh Bear - 26 May 2006 19:56 GMT
> >Diodes won't work.
>
[quoted text clipped - 26 lines]
>
> 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
Holger Petersen - 29 May 2006 13:57 GMT
>> This comes from an ancient BYTE (or KILOBAUD :-) where someone had one Ter-

This "ancient" means 1978 to 1983...

>> minal in the living room and one other near the (South-West TC  68oo IIRC)
>> Computer:

>Aren't the diodes the wrong way round ?

Yess, indeed.

>   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.
          ^^^^^^^^^

Remember: ""Dumb video Terminal" about 1980 ==> ca. 9600 Baud...

>    That could be fixed by using some active
>devices though.

>Graham

Holger

PS: Sorry, I do not have that special issue in my collection. I firmly
   believe in one of the articles of Steve Ciarcia's "Circuit Cellar"
   from BYTE, but I cant't find it.
David Requena - 30 May 2006 10:56 GMT
> >Aren't the diodes the wrong way round ?
>
> Yess, indeed.

Sure?
In rs-232 the "mark" (the logical 1) is always a negative voltaje (
anywhere from +3 to +15 depending on where you lookup the info). The
"space" (logical 0) is a positive voltaje in the same range.

As it seems most rs232 equipment can cope with the space being
indicated by 0 volt. In that case I could understand how this circuit
works; with the diodes placed as drawn.

As far as I understand, seting the diodes the other way round wold
require mark being positive voltage and space 0 volt. That for sure
would not be rs232 signaling by any means.

Then... what do I know? I could be completely wrong. I expose my
reasoning only so any one can correct any missconception :-)

David
Holger Petersen - 30 May 2006 16:34 GMT
>> >Aren't the diodes the wrong way round ?
>>
>> Yess, indeed.

>Sure?

I have doubts as well...

The (intended) function of the circuit:

The _input_ of some RS-232 - Device is held to " minus XX" Volt by
means of a (suitable) resistor which is connected to some source
of "minus XX" Volt. Neglecting the input-current of the RS232-device.
One might use a Handshake-signal of the input-devce...

One or the other *sending* devices wil be able to pull the line
to "plus YY" Volt through the diode.

This works well IF the mentioned resistor is neither too low nor
too high. This of course depends a little on the input-current
of the receiver and the voltage.

The circuit comes from the ages of 1488/1499-Chips..!

And it works only for the 'normal' TX-Date Line, dosn't it?
Of course, funny things happen if both senders will send at
the same time :-)

>Then... what do I know? I could be completely wrong. I expose my
>reasoning only so any one can correct any missconception :-)

>David

Holger
Jasen Betts - 31 May 2006 09:28 GMT
>> >Aren't the diodes the wrong way round ?
>>
[quoted text clipped - 17 lines]
>
> David

AIUI most equipment can handle mark being 0v.

with the diodes as shown the voltage will neve get more positive than -9v

Signature

Bye.
  Jasen

Jasen Betts - 27 May 2006 02:51 GMT
>>Diodes won't work.
>
> Why not?

not by themselves...

> 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)
[quoted text clipped - 20 lines]
> another          |
> Output ----------*

that won't work. (you've got the diodes backwards)

> The Resistor being about 5.6 to 10 KOhm.

seems a little high.

Bye.
  Jasen
Pooh Bear - 27 May 2006 05:52 GMT
> >>Diodes won't work.
> >
[quoted text clipped - 32 lines]
>
> seems a little high.

I thought so too.

I also can see some potential issues with using this if the levels involved from
the various transmitters are different. Esp if one uses gnd for '0'.

Graham
Jasen Betts - 27 May 2006 11:30 GMT
>> >>Diodes won't work.
>> >
[quoted text clipped - 37 lines]
> I also can see some potential issues with using this if the levels involved from
> the various transmitters are different. Esp if one uses gnd for '0'.

0 is typically  +3-12v.  DYM gnd for 1 ?

Signature

Bye.
  Jasen

Rich Grise - 26 May 2006 17:55 GMT
>> > 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,
[quoted text clipped - 9 lines]
> 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-Way-Switch-Box_W0QQitemZ9709748517QQcategory
Z39803QQssPageNameZWD1VQQrdZ1QQcmdZViewItem

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
Jasen Betts - 27 May 2006 02:45 GMT
>> > 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,
[quoted text clipped - 18 lines]
> 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.

>> 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?

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
Chris - 26 May 2006 11:23 GMT
> Hi All,
>
[quoted text clipped - 14 lines]
> 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
David Requena - 26 May 2006 13:15 GMT
> > 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.
>
> 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..

> >From a software standpont, you'll then just have to ensure no one's
> talking or listening when you do the switch.

Of course you're right

Thanks for your reply,
David
Chris - 26 May 2006 13:55 GMT
> > > 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,
[quoted text clipped - 31 lines]
> 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
David Requena - 26 May 2006 15:13 GMT
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
[quoted text clipped - 3 lines]
> 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
Chris - 26 May 2006 15:42 GMT
> Chris, thanks for the very instructive post
>
[quoted text clipped - 35 lines]
> 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
David Requena - 26 May 2006 17:00 GMT
> 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
John O'Flaherty - 27 May 2006 20:01 GMT
> > 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.

You may want 'disabling'.
--
john
David Requena - 28 May 2006 20:22 GMT
John O'Flaherty ha escrito:
> > Oh, bad english again.. babelfish comes up whith "annulling" for what I
> > meant.
>
> You may want 'disabling'.

Yes, that's what I meant. Thanks :-)
Pooh Bear - 26 May 2006 19:52 GMT
> Chris, thanks for the very instructive post
>
[quoted text clipped - 7 lines]
> 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
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.