+ Reply to Thread
Results 1 to 8 of 8

Thread: RS232 / electronics newb

  1. #1
    netwrkgod Newbie
    Join Date
    Mar 2005
    Posts
    5

    Default RS232 / electronics newb

    Hello all,

    I'm making a kind of timing project to time dogs in a relay race. I've writen software in VB6 using the MSComm control to handle the splits and total times, etc. The start/finish line is a Retro Reflective photoelectric sensor.

    I have very, very, little experience with electronics :roll:

    All I need to do is to be able to detect when 5V DC is present on a pin at the RS232 connection on the computer. In other words, the computer is connected to my circuit through a COM port (RS232), and listens for a state change on one of the pins (I don't care which one I guess).

    So what I'm wondering is if I can do this. Can I just detect a voltage on a pin (rather than having to send data to it)?

    I'll attach the circuit and you can rip it appart.

    Thanks in advance for your help!!!
    Attached Images


  2. #2
    JimB Excellent JimB Excellent JimB Excellent JimB Excellent JimB Excellent JimB Excellent
    Join Date
    Sep 2004
    Location
    Peterhead, Scotland
    Posts
    1,944

    Default

    Hello netwrkgod,

    Yes your circuit is AWFULL!!!!

    In an RS232 port, if your software can read the state of some of the control signals which are inputs to the PC, such as CTS or DSR, then yes you could use the port to detect 0v or 5v, depending on the receiver IC in your PC. The true RS232 standard requires < -3v and > +3v, athough I cant remember an input which would not accept 0v as a valid state.

    I am not familiar with VB6, but using assembler I would read the appropriate bit(s) in one of the status registers for the UART.

    As for the serial port itself, the 0v side of you power supply should connect to pin 5 of the 9 pin D connector.
    For your inputs, you could use CTS - pin 8, DRS - pin 6, DCD - pin1, or RI - pin 9. Assuming they are all impemented in your serial port.

    I cant comment any further on your photoelectric sensor without seeing the data sheet for it.

    JimB

  3. #3
    netwrkgod Newbie
    Join Date
    Mar 2005
    Posts
    5

    Default

    JimB,

    Thanks for the reply!

    I switched the pins (5<->6) on the DB9 connector (woops).

    Other than that, can you point out what the rest of the AWFULL part of it is?

    Kinda weird...my dad's name is Jim B.

    Oh, BTW, here's a link to the spec sheet on the sensor its the SP18SP6L 10-30V one:

    http://www.buybanneronline.com/pdf/32893.pdf

    In the mean time, I'll check the circuit out to see how it works.

    Thanks again !!

    Here's an updated diagram. Apparently they sent me the PNP instead of the NPN so I had to rework my diagram...good thing because I had the wiring for the sensor wrong to begin with ops: :
    Attached Images

  4. #4
    JimB Excellent JimB Excellent JimB Excellent JimB Excellent JimB Excellent JimB Excellent
    Join Date
    Sep 2004
    Location
    Peterhead, Scotland
    Posts
    1,944

    Default

    OK,

    Assuming that the 12v PSU is a clean 12v and not raw rectified AC, and doesn't rise above 12v, the following circuit is a lot simpler.

    It will probably work without the 10k resistor, I just put that in to give a load to stop the line "floating" when the switch is turned off.

    JimB
    Attached Images

  5. #5
    netwrkgod Newbie
    Join Date
    Mar 2005
    Posts
    5

    Default

    So that would deliver 12V to the serial port right? And that's ok?

    Thanks again!

  6. #6
    evandude Good evandude Good evandude Good
    Join Date
    Oct 2003
    Location
    Maine, USA
    Posts
    1,395

    Default

    if you are worried about damaging the serial port you could also put another resistor in series with the signal pin, 10k would probably work there too.

  7. #7
    netwrkgod Newbie
    Join Date
    Mar 2005
    Posts
    5

    Default

    Ok, thanks!

    The current circuit works as expected....though I can't get the MSComm_Oncomm event to fire in VB....a problem for a different thread probably.

    Thanks for your help!

  8. #8
    netwrkgod Newbie
    Join Date
    Mar 2005
    Posts
    5

    Default

    I got home and tested everything on my W2K machine and it works like a charm...thanks for everyone's help!! I have to test it on XP at home and see what's up with that.

+ Reply to Thread

Tags for this Thread