RS232 / electronics newb

Status
Not open for further replies.

netwrkgod

New Member
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!!!
 

Attachments

  • circuit_179.gif
    7.9 KB · Views: 766
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
 
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:

**broken link removed**

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 :
 

Attachments

  • circuit_134.gif
    7.7 KB · Views: 730
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
 

Attachments

  • photo_thingy.gif
    3.4 KB · Views: 723
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.
 
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!
 
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.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…