Machine down time prj - vb6 & mscomm

Thread Starter


Joined Mar 4, 2008
I am working on a project for work to record the amount of time some of our machines are not running.
These machines already have a light that comes on when they are running and we found the relay for that light has a couple extra ports on it.

My plan was to simply run some wires from the relay on the machine to the serial port in the back of the PC. (each machine has its own pc) Then make a program to monitor the serial port and write a time stamp record to a database.

Soon enough I had everything working on my test bed. I would connect pins 1 & 4 (sending comm event 5) if the machine was down and 7 & 8 (sending comm event 3) when the machine is running.

Initial testing on the machine showed it was working well too, but it was all short lived.
The next machine we installed everything on would write several records in a second for a few seconds every time the machine started or stopped.
The status would alternate as well meaning that the pc was receiving a comm event 3 & 5 repeatedly.

The first machine is still running fine, but we have had more & more machines pop up with this same issue.

I am more of a programming guy, and this is my first time getting into 'hardware', although I would like to do it more.

I am really running out of ideas on why this is happening. My last guess is the fact that the wire going from the pc to the relay is running next to very high voltage lines for the machine (480v). Could this be causing signals to run through the wire. (I am using unshielded cat5 cable)

Go easy on me I am no electronics guru.

Thanks for any help.
Last edited:


Joined Sep 9, 2010
Is there such a thing as unshielded CAT5?

Anyway, you're probably suffering relay chatter, where the connection is temporarily not solid, one way or the other. If this is indeed the problem, you just need a way to filter out any signal less than a second or two. That's known as switch debouncing, or signal integration, and there are a number strategies. I'm no expert on PC serial communications, so can't comment on which method to pursue.

Thread Starter


Joined Mar 4, 2008
Thanks a ton!
That idea crossed my mind, but I quickly dismissed it.
I will modify my code to account for such behavior.

Thanks again!


Joined Jul 17, 2007
Cat5 cable consists of 8 wires that are twisted together in pairs. If you use one of the pairs of wires, any noise induced will be cancelled out. If you don't use a matched pair, you can get noise.


Joined Nov 30, 2010
I suspect that a serial port uses DC. If that is true, a simple resistor and capacitor filter can do wonders in debouncing the signal. This seems simpler to me that trying to talk a computer out of noticing the bounces, but that's whay I'm not a programmer.


Joined Jul 1, 2008
Besides your debouncing issue CAT5 is not suitable for interface to RS232 because CAT5(UTP) is a balanced transmission line, while RS232 is not. There are methods of converting a balanced line to unbalanced though. Because of the massive cost difference between good unbalanced coax cable and CAT5, it's usually worth the extra effort.