Solved

Trapping input from COM2

Posted on 2002-04-18
19
538 Views
Last Modified: 2010-04-26
I'm trying to make a motion detector that plugs into COM2.
What I'm planining to do is to make a bulb/laser shine onto an LDR. When someone breaks the line, this would break the circuit.
How could I trap the response from the COM port, and which pins wouldI need to use?
0
Comment
Question by:sierrahalflife
  • 5
  • 5
  • 5
  • +3
19 Comments
 
LVL 2

Expert Comment

by:highstar1
ID: 6950872
Pins 2, 3 and a ground.
The com ports are digital communication devices.
It would seem to me to do this correctly you would need a
ADC in between the motion detector and the com port.

To read info from the port you can use redirection or a terminal program to just get a reaction. To get a meaning full response I think you would have to write a program that reads the port and does some interpretations.

I wouldn't reccommend just hooking your device directly to the com port. You have certain voltage and other power requirements to concider.
0
 
LVL 2

Expert Comment

by:highstar1
ID: 6950877
I would also design some Optical Isolation into your circuit. You want to protect your com port from damage.
0
 
LVL 63

Expert Comment

by:SysExpert
ID: 6951863
Actually, I only partially agree with highstar1 .
Pins 2,3 are transmit and receive. I would NOT use these, since you are not sending over serail data. All you want is a single make/break/detect.
For this I would use the handshake lines on the serial port.

CTS, RTS lines are te best.
see :
http://www.comminfo.com/pages/ctsfaq01.htm

I hope this helps !
0
 
LVL 63

Expert Comment

by:SysExpert
ID: 6951874
For More info see :
http://www.lvr.com/serport.htm
0
 
LVL 2

Expert Comment

by:highstar1
ID: 6951912
There are quite a few pin combinations you can use.
2 and 3 will work with redirection CTS/RTS needs to be read differently. Your selections grow if you are using a 25 pin serial port opposed to a nine pin. There is alot of unused functionality in the serial ports. However it is all digital with specific voltage levels (0,1).
RS232 ports have their limit. If I'm remembering correctly
the ??RS452?? ports are designed for sensors and digital analog device control.
0
 
LVL 13

Expert Comment

by:magarity
ID: 6951965
"When someone breaks the line, this would break the circuit."

If you use a strong enough laser, you don't need to worry about triggering an alarm via com port.
0
 
LVL 2

Expert Comment

by:highstar1
ID: 6952000
There are quite a few pin combinations you can use.
2 and 3 will work with redirection CTS/RTS needs to be read differently. Your selections grow if you are using a 25 pin serial port opposed to a nine pin. There is alot of unused functionality in the serial ports. However it is all digital with specific voltage levels (0,1).
RS232 ports have their limit. If I'm remembering correctly
the ??RS452?? ports are designed for sensors and digital analog device control.
0
 
LVL 2

Expert Comment

by:highstar1
ID: 6952006
Magarity: LOL :)

Cut them down to size. :)
0
 
LVL 1

Expert Comment

by:NickLo
ID: 6955904
The pin connections for an AT style 9 pin serial port are:

1  Data Carrier Detect (DCD)
2  Receive Data (Rxd or Rx)
3  Transmit Data (Txd or Tx)
4  Data Terminal Ready (DTR)
5  Signal Ground (Grd)
6  Data Set Ready (DSR)
7  Request To Send (RTS)
8  Clear To Send (CTS)
9  Ring Indicator

You only need two lines one of which is the signal ground and the other you can select one of the handshake lines. It will be necessary to use an operational amplifier to act as a buffer or step down the voltage or change the polarity of the voltage.

The addresses for the serial ports are:

COM1  03F8 - 03FF  which is usually used for the mouse.
COM2  02F8 - 02FF  Usually used for the modem
COM3  03E8 - 03EF
COM4  02E8 - 02EF

Suppose you have selected to use com2 and the INS 8250 UART is used in your computer.

To turn any of the lines ON or OFF it will be best to create a .com or a .exe file using DEBUG (DOS File) or an assembler program such as MASM.

To activate the say DTR line you must set bit number 0 of the address 02FC to logic 1

eg.  mov  dx,02FC
     mov  al,01
     out  dx,al

to turn it off bit 0 at the address 02FC must be set to 0
such as mov al,00.  
Similarly the following handshake lines are in the address 02FE
CTS is data bit No. 4   -  10 in hex
DSR is bit No. 5        -  20
RI  is bit 6            -  40
DCD is data bit no.7    -  80

It may be necessary to take the output of your device back to the computer via a buffer to pin2 (Rxd) to monitor it.

Good Luck  
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

by:sierrahalflife
ID: 6959562
Thanks for all your suggestions... To clarify from my end, I was thinking about having the LDR on the serial line, but powering the laser from a different source.
I only want to know when someone breaks it and set off an alarm... If I cut them in half, they'll never leave!

--SHL
0
 
LVL 1

Expert Comment

by:NickLo
ID: 6961081
Am I right to asume that you are a College student and you need help for your project?
The Light Dependent Resistor(LDR)will have to be used in a comparator circuit.  You supply the comparator from a +V to the Ground. You connect one end of the LDR to Grd and the other end (say point A) in series with a fixed value resistor and a preset resistor (for fine adjustment)to the +V.  Connect point A through say a 10 kohm resistor to the inverting input of the comparator.  Connect 2 10kohm resistors in series across the +V and Gnd to form a Wheatstone bridge.  Connect the point between these two equal value resistors (say point B) through a 10 kohm resistor to the non-inverting input of the comparator. Point B should be at half the supply voltage.  If the voltage at A is less than the voltage at point B, the output of the comparator is at the Gnd potential.  This occurs when the light shines onto the LDR and its resistance is low.  If the light beam is broken the voltage at point A should be slightly higher than the voltage at B so that the output of the comparator switches to the +V. The output can be connected in series with a resistor to the base of a transistor biased to operate as a switch which in turn switches on a bell or a sirene.  (Speakers require an oscillator to operate).  If you want the bell to continue ringing well after the beam of light is restored you will need to use a thyristor as a switch instead of a transistor.  You may also have to incorporate a timer in the circuit in order to switch off the alarm after 15 minutes I believe, otherwise you will be breaking the Law.  To switch it off you will need to connect a switching device (transistor or relay etc) in series with the anode or cathode of the thyristor.  The voltage for the input of the comparator can be switched on by a transistor preferably a mosfet switched on by the serial port of your computer. Unfortunately I cannot draw the circuit diagram here for you.
0
 

Author Comment

by:sierrahalflife
ID: 6962258
I am a college student, but this is for an own-gratification project, not a college one.
I was thinking of routing it through through the PC so I can easily implement a timer into it, or a password-override to get it to shut up
0
 

Author Comment

by:sierrahalflife
ID: 6962545
And, I can be mailed at:
20001243@southdowns.ac.uk or bombsoft@hotmail.com if needed
0
 
LVL 1

Accepted Solution

by:
NickLo earned 200 total points
ID: 6967136
I cannot really sent you a diagram because I usually draw my circuit diagrams on a mac using Claris Works and unfortunately the modem on that computer needs replacing,  You should be able to draw the diagram from the above discription.  You can use the CA3140 op.Amp as a comparator which has the same pin configuration as the 741 op. amp.  The CA3140 type is based on JFET type transistors which are voltage operated while the 741 is a current operated based on bi-polar technology.  You can also use an LM311 as a comparator.  The pin configuration of the CA3140 op. amplifier are:-
Pin 1 zero offset  - Not connected if used as a comparator.
Pin 2 Inverting Input
Pin 3 Non-inverting Input
Pin 4 -V  -  This pin is connected directly to the ground or the zero volt line.
Pin 5 Zero offset - not required for this application.
Pin 6 is the output. - Connect through a resistor to the  base or gate of a transistor depending on the type of transistor used, or to the gate of the thyristor if you decide to use a thyristor to switch on the alarm.
Pin 7 is connected to a +12 volt supply.
Pin 8 is not used.  
Component suppliers such as MAPLINS, Radio Spares, and Farnell, often provide data and circuit diagrams including RS232c circuits.

0
 

Author Comment

by:sierrahalflife
ID: 6967996
Thanks. I'll look into getting the components. Will all I need be an RS232 connector, the opamp, an ldr, a laser-pen and wiring?
0
 
LVL 1

Expert Comment

by:NickLo
ID: 6968265
One more thing.  If you use an LDR and a light source, the LDR must be enclosed in a tube to prevent it operating from other light sources, and also the light source must produce a beam directed straight to the LDR.  The light beam will be clearly vissible and it will be no good for use as an intruder alarm.  It can be used for checking the height or counting components on a convayor for example. You could use an infra red detector and an infra red transmitter instead.

Good luck
0
 

Author Comment

by:sierrahalflife
ID: 6968914
With a laser pen, you only see the beam if it's dusty/smoky
0
 
LVL 1

Expert Comment

by:NickLo
ID: 6969185
Well done.  If you are happy with the answer to your question, then you must accept an answer.

Goodbye from me
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 7016820
ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101, Netminder or Mindphaser will return to finalize these if they are still open in 7 days.  Experts, please post closing recommendations before that time.

Below are your open questions as of today.  Questions which have been inactive for 21 days or longer are considered to be abandoned and for those, your options are:
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you, but may help others. You must tell the participants why you wish to do this, and allow for Expert response.  This choice will include a refund to you, and will move this question to our PAQ (Previously Asked Question) database.  If you found information outside this question thread, please add it.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question (if it has no potential value for others).
   --> Post comments for expert of your intention to delete and why
   --> YOU CANNOT DELETE A QUESTION with comments; special handling by a Moderator is required.

For special handling needs, please post a zero point question in the link below and include the URL (question QID/link) that it regards with details.
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click this link for Help Desk, Guidelines/Member Agreement and the Question/Answer process.  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Click you Member Profile to view your question history and please keep them updated. If you are a KnowledgePro user, use the Power Search option to find them.  

Questions which are LOCKED with a Proposed Answer but do not help you, should be rejected with comments added.  When you grade the question less than an A, please comment as to why.  This helps all involved, as well as others who may access this item in the future.  PLEASE DO NOT AWARD POINTS TO ME.

To view your open questions, please click the following link(s) and keep them all current with updates.
http://www.experts-exchange.com/questions/Q.20243489.html
http://www.experts-exchange.com/questions/Q.20244272.html
http://www.experts-exchange.com/questions/Q.20256390.html
http://www.experts-exchange.com/questions/Q.20262360.html
http://www.experts-exchange.com/questions/Q.20290868.html
http://www.experts-exchange.com/questions/Q.20299960.html



*****  E X P E R T S    P L E A S E  ******  Leave your closing recommendations.
If you are interested in the cleanup effort, please click this link
http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643
POINTS FOR EXPERTS awaiting comments are listed in the link below
http://www.experts-exchange.com/commspt/Q.20277028.html
 
Moderators will finalize this question if in @7 days Asker has not responded.  This will be moved to the PAQ (Previously Asked Questions) at zero points, deleted or awarded.
 
Thanks everyone.
Moondancer
Moderator @ Experts Exchange
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

The Rasberry PI is a low cost piece of hardware that you can have a lot of fun with through experimenting and building/working on projects like media players, running a low cost computer, build data loggers etc. - see: https://www.raspberrypi.org
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now