1
\$\begingroup\$

I have a switch and a headless Debian computer. When the switch changes state, I want a script to run on the computer. The switch has outputs for both NO and NC. If possible I'd like to plan for a second switch, which also can be NO or NC.

The computer has:

  • Serial header (I have a PCI bracket but have yet to test it)
  • A plethora of USB ports
  • PS/2 ports

I've looked in to Arduino but it seems overkill for this.

\$\endgroup\$
2
  • \$\begingroup\$ I have used the serial port flow control pins in the past. The registers in the serial port hardware have to be accesed to work this.... no idea how it is done in linux, short of writing a program to do this. \$\endgroup\$
    – Spoon
    Jan 11, 2014 at 20:00
  • \$\begingroup\$ There are countless examples on ebay for USB FTDI breakout boards that have one or more UART ports and several GPIO pins. \$\endgroup\$
    – jippie
    Jan 12, 2014 at 10:43

2 Answers 2

2
\$\begingroup\$

AS Spoon suggest, given the available! options, your serial port handshaking lines sound best.

You can use DTR as the common on your switch, connect RTS to the other side.

DTR = Data terminal ready, should be active when the port is open. RTS = Request to Send and is an input you can drive active and detect from software.

WHen you get your DB9 cable hooked up use this diagram to find the signals. I dont know the code for monitoring but you will likely find this in open source. If you plan to use JAVA look at the TX RX lib.

more information about serial ports here...

enter image description here

\$\endgroup\$
1
\$\begingroup\$

If the serial port hack fails, you could consider the FTDI UMFT120 USB-parallel port bridge.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.