Reading LED status in to PC (RS232)

Thread Starter

Pierreke1010

Joined Mar 6, 2018
3
Hello Everyone,

For a project that I am currently working on I would like to read the status (high or low) of 2 LEDs in my PC (most likely via RS232).
Since I only have to be able to read the status of the LED and nothing else (for example I do not have to be able to send data) I would like to keep it as simple as possible.
I had thought of a MAX232 but then I also need a PIC, which is actually a bit overkill since it only involves reading the status of 2 LEDs.

For the software side I would have liked an application in Visual Studio that can read the status of my LED's.
Does anyone have experience with this? How do I best approach this along hardware and software?

Thanks in advance!
 

Thread Starter

Pierreke1010

Joined Mar 6, 2018
3
hi 1010,
Welcome to AAC.
In your PC's Visual Studio are you able to Read the State of the RS232 Control Lines.?
E
Hi ericgibbs,

The objective of the Visual Studio program that I'm going to create is to read the status out of the 2 LEDs. Depending if these are low or high my program will do a certain action.
But I first need to design a litte PCB on how I'm going to get the information of te LEDs into my PC.

Best regards,
 

djsfantasi

Joined Apr 11, 2010
9,237
Hi ericgibbs,

The objective of the Visual Studio program that I'm going to create is to read the status out of the 2 LEDs. Depending if these are low or high my program will do a certain action.
But I first need to design a litte PCB on how I'm going to get the information of te LEDs into my PC.

Best regards,
Ericgibbs understood your requirement and is asking you that question in order to give you a simple solution.

So can you read the state of the RS232 control lines?
 

ericgibbs

Joined Jan 29, 2010
21,439
hi.
OK,
These pins could be used to monitor if an LED is lit or not, by sampling the LED drive voltage etc.
PC RS232 Input Pins, DCD,RI,CTS,DSR

Give us more information regarding the LED's
How do you want to connect and read the LED state.

E
 

Thread Starter

Pierreke1010

Joined Mar 6, 2018
3
hi.
OK,
These pins could be used to monitor if an LED is lit or not, by sampling the LED drive voltage etc.
PC RS232 Input Pins, DCD,RI,CTS,DSR

Give us more information regarding the LED's
How do you want to connect and read the LED state.

E
Thank you for this quick response.
I will explain why I want to do this to make how this can be realised more clear.

So I have a PCB for testing a certain device, on this PCB there are 2 LEDs.
- Red LED for indicating that the test has failed.
- Green LED for indicating that the test has passed.
I would like to be able to read the status of both LEDs into a PC so I can automatically know if a test has failed or passed with a little visual studio program.

So I would like to solder some wires to the 2 LEDs and get this signals to a RS232 conector.
 

ericgibbs

Joined Jan 29, 2010
21,439
hi,
If you can pick up a voltage from the LED driver, say approx 5V thru 9V, when the LED is lit, you could connect that voltage to one of the PC RS232 Connector Control pins.

This is a clip from a Visual Basic program I use for RS232, it checks the state of the Control pins.
Using a Select Case statement
.....................
Case comEvCTS
ERMsg$ = "Change in CTS Detected"
Case comEvDSR
ERMsg$ = "Change in DSR Detected"
Case comEvCD
ERMsg$ = "Change in CD Detected"
Case comEvRing
ERMsg$ = "The Phone is Ringing"

Case Else
ERMsg$ = "Unknown error or event"
End Select
 

Reloadron

Joined Jan 15, 2015
7,887
Along the lines of what Eric has posted the following is a little program I wrote maybe 20 years ago in VB 6.0.
Comm 1.png

The program monitors the CTS, DSR and DCD inputs and also allows turning the DTR and RTS pins low or high. I would do as Eric suggested and try to get a digital input using the voltage from the LEDs as a first step. Here is a download link to the little program. If you want something to happen when one or the other LED does something then that would be written into your program. You could also log the data, really no limits. If you download my link just let the folder download, open the folder and click the .exe file to install it. It runs on any Windows system from Win 98 through Windows 10. Again, it was written in VB 6.0 so the source code is pretty old. It will give you an idea of what is going on with your RS232 serial port.

Ron
 

MrChips

Joined Oct 2, 2009
34,807
What PC do you have that still has an RS-232 port?
Most if not all PCs today no longer come with RS-232 ports?
 

Reloadron

Joined Jan 15, 2015
7,887
What PC do you have that still has an RS-232 port?
Most if not all PCs today no longer come with RS-232 ports?
I sort of also wondered about that also? I use a Keyspan and another USB to RS232 adapter which works well The Keyspan provides -% Volt to 5 Volt swings on the digital out lines and has no problem seeing 5 Volts on the digital in.

I still have and use several RS232 port hardware devices so for me the USB adapters are commonplace. :)

Ron
 
Top