Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!


Forgot your password?

Submission + - How can I capture a switch event on a USB port? 4

wilderbeest writes: My 90-year old neighbour is very much into clocks, and maintains our local church clock here in North Woochester, UK. As it's quite a way up the spire and he isn't getting any younger, he would like to monitor the accuracy of the clockwork using his computer from home.

I've come up with the following solution: An Alix 2d3 with a Huawei E220 3G modem attached to it, and Zeroshell installed on the Alix. That all works well, Zeroshell connects to my VPN and I can place the thing in the church spire as they have electricity up there. We also installed a micro switch on a part of the clock that rotates once every 5 minutes, and we get a switch on / off from that micro switch.

Now comes the hard part: I need some sort of component that I can plug into the USB port of my Alix 2d3 and connect it to the micro switch so can capture the event, timestamp it and write it to a remote database.

Any ideas? Can I use something like a USB mouse and mod it?
This discussion was created for logged-in users only, but now has been archived. No new comments can be posted.

How can I capture a switch event on a USB port?

Comments Filter:
  • I would go with a mouse modification as your cheapest option (I'm guessing this is pro bono and you're not being reimbursed). Just put a "spoke" in the clock face, so to speak, and calibrate it such that when one of the hands hits said spoke upon striking a certain time, it has enough pressure to click the mouse button - or you could disassemble the mouse and somehow attach the scroll wheel assembly, which would be pretty cool, and incremental.
  • I've answered the question already myself. Yes, I can capture mouse events by monitoring /udev/input/mouse0. Easy perl script doing that, and posting via wget to a web server. Done and dusted! Yes, this is pro bono and I have an old mouse. Thanks jr0dy
  • If you're going with USB, I'd be inclined to use a USB keyboard or numeric keypad. There's dozens of switches already built in.

    Modern membrane keyboards are cheap and easy to come by, but it can be tricky to solder leads to them. Older clacky keyboards (or anything with mechanical keyswitches) are much "roomier" and at most need an AT-to-PS2 and a PS2-to-USB adaptor.

    As yet another alternative, parallel (printer) ports are very flexible in legacy mode. You can easily rewire the status lines to physical switc

IN MY OPINION anyone interested in improving himself should not rule out becoming pure energy. -- Jack Handley, The New Mexican, 1988.