Connect with us

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

Discussion in 'Electronic Basics' started by David Requena, May 26, 2006.

Scroll to continue with content
  1. 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
     
  2. Pooh Bear

    Pooh Bear Guest

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

    Chris Guest

    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.
    talking or listening when you do the switch.

    Good luck
    Chris
     
  4. 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?
    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
     
  5. Pooh Bear

    Pooh Bear Guest

    They're supposed to be quite robust so probably not a problem.
    Diodes won't work.
    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
     
  6. 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
     
  7. Now I'm getting confused

    hmm... so there is no need to electrically disconnect the transceivers?
    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..
    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.
    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
     
  8. Chris

    Chris Guest

    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
     
  9. 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
     
  10. 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
     
  11. Chris

    Chris Guest

    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
     
  12. 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
     
  13. 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)
    Ok, I'll post a diagram with parts, explanations, etc. on some webspace
    and come back with a link :)
    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..
    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
    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.
    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
     
  14. 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?
     
  15. Rich Grise

    Rich Grise Guest

    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
     
  16. Pooh Bear

    Pooh Bear Guest

    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.

    You differentiate betweem 'line' and transceiver ? I don't understand what you mean.
    I meant a 'physical switch'. If you need this to be accomplished under program control
    then use a similar style relay.
    You could do that, yes.

    Graham
     
  17. Pooh Bear

    Pooh Bear Guest

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

    Graham
     
  18. Pooh Bear

    Pooh Bear Guest

    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
     
  19. Pooh Bear

    Pooh Bear Guest

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

    Graham
     
  20. Jasen Betts

    Jasen Betts Guest

    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.
    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
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-