×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Connecting a Footswitch to an RS-232 Serial Port

Connecting a Footswitch to an RS-232 Serial Port

Connecting a Footswitch to an RS-232 Serial Port

(OP)
I would like to connect a simple (make/break contact) footswitch to a serial port, which will enable hands-free operation of an application.  Before I begin development, has anyone done this?  I've outlined the abstract below, but I don't want to re-invent the wheel! Alternately, if I am to do this, then comment would be useful.  Oh, I forgot to mention, the platform is Windows/Intel.

Step 1: How to wire the connector.  I'm guessing that the footswitch should be wired between DTR (always high) and some other input signal, say CTS.  When the footswitch is depressed, then CTS goes high.

Step 2: Next we need an event-monitoring or interrupt-driven process that detects the CTS-high state.

Step 3: Last, we need a user-interface where we can easily configure what to do when the pedal is pressed.  Most useful would be an ability to send a keystoke sequence to the active program.  As a trivial example: if the pedal is pressed send F1 to the process, and the Help will appear.

Step 4: Allow for a second footswitch, wired, say, between DTR and DSR.  Monitor and control in the same way.

RE: Connecting a Footswitch to an RS-232 Serial Port

Add some intelligence to the switch!  A footswitch is usually large enough to enclose a very small circuit, so you could use a very inexpensive microcontroller to interface between the switch and the serial port.  I would suggest a PIC micro or perhaps an ATMEL micro.  Most small microcontrollers have a built-in serial interface.

You can even use the DTR and RTS outputs to supply power to the circuit (through diodes) to avoid the use of a battery.  Just remember that the output can vary from 4V to 15V, so use a voltage regulator.

The Microchip webpage (www.microchip.com) even has many samples of code and circuits for interfacing switches to their microcontrollers.

RE: Connecting a Footswitch to an RS-232 Serial Port

The serial port demands, by it's conception, some circuitery added to the footswitch like outlined by "tombihn" in the previous answer.  The circuit must be composed of a UART chip or at minimal a driver chip to support the + 0 - voltage scheme of the RS-232.

What I'd suggest is to use the parallel port instead since it's connector is built of 5v lines with a 0=low and 5=high. It is composed of in and out control lines and you could use just one of them and connect the footswitch to it.

The drawback is that the PC does not support Interrupt via the parallel port (although their is an IRQ assigned to it though). So if you decide to go parallel, your program would have to poll the port from it's main loop or from a parallel process your program would launch.

Good luck

Marcel


Ruinbab
jcema@rocketmail.com

RE: Connecting a Footswitch to an RS-232 Serial Port

(OP)
Thanks for all the useful advice.

I haven't quite got my head around a micro-processor equipped footswitch, so I'm using my original idea - a simple make/break switch wired between DTR and CTS.

I've had some success with the first part of the problem (detecting CTS high) using Microsoft WIN32 SDK.  In short:

1. Open the port using function: CreateFile
2. Set event mask using function: SetCommMask
   (trap only EV_CTS)
3. Wait for an event using function: WaitCommEvent
   (if this happens, someone pressed the footswitch)

When the code is reasonable stable and bug-free, I will post it for all.  It'll probably work fine as a piece of embedded code in an application, but...

...the second part of the problem - having a way of mapping the event to a keystroke sequence so that it can be used with any already compiled application - is more challenging because a fairly substantial driver must be written, which will allow both keystroke programming and subsequent operation.

In the meantime I have sourced a commercially available solution that will do exactly what I want -  the 'Savant 3-Action Programmable Footswitch'.  Check out:

http://www.kinesis-ergo.com

For this you pay $129.  So I am still interested in developing a less expensive (and probably less elegant) solution.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources