Controlling 2 Switches with RS232

Discussion in 'The Projects Forum' started by nicmon, Apr 7, 2011.

  1. nicmon

    Thread Starter Member

    Mar 18, 2011
    30
    0
    I'm googling since 1 week and could not find an answer, so I ask it here.

    I want to control 2 switches via RS232, but just as a pulse. i.e. once a switch receives a command to be On, it changes its status to On and goes Off again after 1 second or so.

    I can of course control some items programatically, for example that only one of 2 switches receives a command or send On command, delay 1000ms and send Off command again to keep the schematic simple.
     
  2. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    You can use the DTR and RTS lines to do this. What is your programming (language) interface?
     
  3. nicmon

    Thread Starter Member

    Mar 18, 2011
    30
    0
    Do you mean that I need no MAX232 or a PIC for it?
    I have still no language interface as I'm still looking for a schema and solution and can program in many languages including C, C++, C#, Delphi, Java, VB and so on.
     
  4. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    Well you can do a lot more things if you use a uC (I prefer Picaxe) but for your requirements you won't need one or a MAX232. When you say "VB", are we talking VB6 or NET? Microsoft should never have named anything above VB6 VB, as it causes much confusion and have little in common.
     
  5. nicmon

    Thread Starter Member

    Mar 18, 2011
    30
    0
    I said VB to keep the list of my abilities shortly :D, it doesn't a matter to write a VB6, NET or GWBasic for me.
     
  6. mcgyvr

    AAC Fanatic!

    Oct 15, 2009
    4,770
    970
    There are tons of serial port relay kits out there.. You could do the timing with software instead of hardware and be done. Enable specific com port pin for 1 second or whatever
     
  7. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    Here's the basic idea. As mcgyvr said you can write delays and holds in code. In VB6 the Timer Control is ideal for this.
     
  8. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    Here's the VB code for my circuit. You will need 2 CommandButtons, 2 TimerControls and 1 MSCommControl.

    Note that I didn't use the default names for the controls except for the Form. That said, I used accepted naming conventions, so it should be easy to follow.

    Code ( (Unknown Language)):
    1.  
    2. ' Written by CDRIVE 07 April 2011
    3. ' CmdDTR will enable the DTR line. TmrDTR will disable the DTR line after 1 second.
    4. ' CmdRTS will enable the RTS line. TmrRTS will disable the RTS line after 1 second.
    5.  
    6. Option Explicit
    7.  
    8. Private Sub Form_Load()
    9.    Form1.Caption = "DTR - RTS Switcher"
    10.    TmrDTR.Enabled = False
    11.    TmrDTR.Interval = 1000
    12.    TmrRTS.Enabled = False
    13.    TmrRTS.Interval = 1000
    14.    CmdDTR.Caption = "Enable DTR"
    15.    CmdRTS.Caption = "Enable RTS"
    16.    COM.CommPort = 1               ' change to whatever port you use
    17.    COM.DTREnable = False
    18.    COM.RTSEnable = False
    19.    COM.PortOpen = True
    20. End Sub
    21.  
    22. Private Sub CmdDTR_Click()
    23.    COM.DTREnable = True
    24.    CmdDTR.Caption = "DTR Enabled"
    25.    TmrDTR.Enabled = True
    26. End Sub
    27.  
    28. Private Sub CmdRTS_Click()
    29.    COM.RTSEnable = True
    30.    CmdRTS.Caption = "RTS Enabled"
    31.    TmrRTS.Enabled = True
    32. End Sub
    33.  
    34. Private Sub TmrDTR_Timer()
    35.    COM.DTREnable = False
    36.    CmdDTR.Caption = "Enable DTR"
    37.    TmrDTR.Enabled = False
    38. End Sub
    39.  
    40. Private Sub TmrRTS_Timer()
    41.    COM.RTSEnable = False
    42.    CmdRTS.Caption = "Enable RTS"
    43.    TmrRTS.Enabled = False
    44. End Sub
    45.  
    46. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    47.    COM.PortOpen = False
    48. End Sub
    49.  
    50.  
     
    Last edited: Apr 7, 2011
  9. nicmon

    Thread Starter Member

    Mar 18, 2011
    30
    0
    thank you, really appreciate for this.

    I have 2 questions,
    - do I need exactly 12V or I can also use a 9V battery (or ideally the power from COM)
    - are K1 and K2 the 2 points that I want to be connected and disconnected each time that I send a command?
     
  10. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    I've redrawn the attached schematic to make the inputs and outputs clearer for you. I've also amended my code (see last post) to provide a visual display of the DTR and RTS status. You can change the captions to ON and OFF if you like.

    I don't recommend using your PC as a power supply. 12VDC wall warts are cheap and can be purchased anywhere, including Radio Shack. Radio Shack also has 12VDC/10Amp relays (Catalog #: 275-248) and 2N3904 transistors. Just about any small signal/switch (PNP) transistor can replace the 2N2904s.
     
  11. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    This post, including code and attached schematic was removed because I found myself posting information that violated tenants that I believe should be adhered to when dealing the serial port.
     
    Last edited: Apr 8, 2011
    nicmon likes this.
  12. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    I should have thought of this before but better late than never. If your switching an AC load, SSRs can be connected directly to the port with nothing more than a blocking diode (I don't know if they have internal reverse polarity protection) in series with the input.

    http://www.mpja.com/products.asp?dept=133
     
  13. nicmon

    Thread Starter Member

    Mar 18, 2011
    30
    0
    This was my initial Problem which triggered to ask this question. I have a AOYUE 968 Reflow Station which I want to use to lift up BGA Chips.
    Doing it, needs to keep a Profile from various Temperature and with an exact time length e.g.
    183 oC -> 2 min.
    231 oC -> 2 min.
    271 oC -> 10 sec.
    and so on.

    as you see on picture, there are 2 buttons for increasing or decreasing the temperature and 2 Displays, the above one shows the set temp and the below one shows the current temp.

    if I connect 2 points on PCB behind the display with a screwdriver, the temperature will be increased or decreased (depend on which button I connect)

    so my Idea was to build a very simple circuit with relays to control the pressing the buttons by a PC.

    do you think that it is possible to read the current temp. value from display wire as well?
     
  14. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    Chances are you don't need relays at all. Is one of the two points on the PCB ground or a supply rail?
    Just about anything is possible. Practical, feasable, cost effective... don't know yet. Do you have a schematic for this device?
     
  15. nicmon

    Thread Starter Member

    Mar 18, 2011
    30
    0
    high probably, yes.
     
  16. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    I don't think "probably" is going to cut it. Can you obtain a schematic?
     
  17. nicmon

    Thread Starter Member

    Mar 18, 2011
    30
    0
    unfortunately not, I wrote an email to aoyue, but they didn't answer. I will use a multimeter today and try to find it out.
     
  18. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    Must of us don't answer PMs or emails regarding help with topics. This is because doing so defeats the purpose of the forum.

    Edit: See post 20. I misunderstood.
     
    Last edited: Apr 13, 2011
  19. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    Please post the following information to determine if this is high side switching...

    (1) The voltage from circuit common to the most positive point of the two points that you're jumping.

    (2) The voltage from circuit common to the jumper when the jumper is in.

    (3) Use an ammeter as a jumper and measure the current when the two points are jumped. Use care when doing this! Anytime a VOM is in current mode you risk damage to the meter, device, or both by an inadvertent slip off a solder pad or by touching the wrong points.
     
  20. CDRIVE

    Senior Member

    Jul 1, 2008
    2,223
    99
    Woops, I thought that was a typo and you meant to say you.
     
Loading...