Reading Voltage from a Serial Port

hibbo3

New member
Joined
Mar 27, 2008
Messages
2
Programming Experience
Beginner
Hello,

I have a magnetic contact switch linked to a serial port connection. At the point in the circuit where the serial connection is the voltage is approximately 1volt and when the contact is broken there is 0volts going to the serial port.
Does anybody know of a way in VB.NET to first of all read the serial port (COM4) and then determine what the voltage is?

Any help would be greatly appreciated


PS Im using Visual Studio 2005
 
As far as I know, the serial port only understands digital (1's and 0's). For a 1, the voltage needs to be >~3.3v, and for a 0, the voltage needs to be <~1.4v. Anything between those voltages is considered a 'high-z' state that could be interpretted as either a 1 or 0.

What I'm getting at is that you'll need some kind of hardware to either convert A-D or boost the voltage to higher than 3.3v. Considering you're just using it for a switch, the second option would probably be best. The following image should give you an idea of what I'm talking about :
tranload.gif

http://www.kpsec.freeuk.com/trancirc.htm
 
Thanks delstar, thats a big help. I have 3.3v going into the circuit but the serial port connection is after a resistor which is pulling the voltage down to about 1.2v.

Thanks Again
 
Back
Top