Author Options:

How to use a USB keyboard to simultaneously send a keystroke to 2 computers and flash a light w/o modifying computers? Answered

This project is going to be used in an experiment for time syncing video to computer captured physiological data (heart rate, respiration, and galvanic skin response).

Basically, I need to press a key on a keyboard which will start a video clip that participants will watch being displayed on one computer, simultaneously trigger a keystroke on the second computer to establish a timestamp for the physio acquisition, and flash a light on the video so that we can time sync participant behaviors to patterns we see in the physio data.

Preferably I would like to assign different keys to multiple different colored lights to allow us to signal all of the different events in the study (3 on/off events, so 6 keys/lights).

I should have USB keyboards at my disposal that I can hack, but I can't touch the actual hardware of the computers.  I've read the only instructables I could find having to do with something like this and those projects used the Caps, Num, and Scroll locks.  Although that solution would work for controlling the lights, I don't think I can easily assign those keys to the software programs we're using to control the needed functions on the computers.

If there is a commercial product that will do this and that is a reasonable price, I can probably buy it rather than try to build it, but it seemed like a fun project to try to tackle and I can't think of anything commercial that would fit the needs I have without being way overbuilt and expensive.

I can solder and have plenty of tools at my disposal.  I've worked with an arduino one other time on a project and got that working, but I'd be at a complete loss for programming the thing for a situation like this.  I'm guessing the solution is going to include one of those...

Looking for links, ideas, etc.  I may be in a little over my head, but you only learn by doing, so I appreciate the help!



Sorry I went MIA for a few days.

With the current system we have, using 1 computer is simply not possible because the physio acquisition setup is portable and needs to be regularly moved. There are also issues of redundancy and overloading a single computer since our display computer is also capturing video data. Lastly, the display computer already has multiple monitors (there is a separate control room) and I don't think we'd be able to add another without a new video card (which could be done, but the first reason makes this moot).

Just to be clear, the only thing I am trying to sync is the video capture to the start of the physio acquisition. The captured video includes a picture in picture of what is being displayed on the computer. So, as long as the light that flashes appears on the video, I'll know the relationship between the physio data, what the person is doing, and what the person is seeing. Since there are latencies (on the order of seconds) in how fast physiological responses occur that differ depending on the response and equipment used to measure it, and because the only reason for doing this is to code observable behaviors (which often have an extended time course), a few millisecond latencies aren't going to be a major problem (especially if they are predictable).

In fact, the current system we are using is for the person starting the physio acquisition to simply tap the top of the computer they are sitting at (which appears on the video). Someone else controls what is displayed to participants. Obviously this is not ideal* and I was just hoping to find a pretty cheap way to do a better job than what we are currently doing. The biggest problem we are having is not the time course/syncing, it is the person running the physio forgetting to mark the events in the video (since they are doing other things during the visit). The current system is just too jankity. It requires the attention of 2 people instead of 1, syncing becomes more difficulty if the physio person misses marks, and there is more slop than necessary.

Ideanator, your number 2 idea seems like a good one, but the problem is that the computer running the physio only has one ethernet port... a port that is used to communicate with the physio equipment.

It may just be that I can't accomplish what I want within the current set-up and restrictions. I was hoping I was just missing something really easy....

*These are the kinds of concessions that happen when the NIH cuts funded grants by 20% and refuses to pay for "general purpose" equipment like computers (because they can be used for other projects not related to the grant and for administrative purposes).[/rant]

  1. What is the data output of the (ethernet) sensor array? eg. is it proprietary? (could you perhaps use the ethernet arduino to capture/record the data and send it to the computer over usb for the capture computer to use?)
  2. Does the physio capture computer have some sort of "start capture" command thats run through the sensor/ethernet input? (that might allow you to stack 2 ethernet sheilds on the arduino and have that as a sort of pass-through for the physio and have the subject push a button which tells the arduino to blink the led, inject the capture command into the sensor stream, and act like a keyboard and send whatever key presses or sequences to where you want them.)

1) why not use one computer and conceivably two monitors (unless one of the computers is a dedicated medical monitor of some sort)
2) if you NEED two computers, both should be equipped with a networking capability in which case a PS2 keyboard wired up to an arduino with Ethernet shield. on both computers you have a script running waiting for the signal from the networked arduino to activate the video on one computer and start the recording on the other.

Yes, thirded, I can't SEE a reason to use two computers. Log everything on one, and you won't get synchronisation issues - the latencies in using two machines might ruin your data.



Use 1 computer with multiple monitor outputs, and run your program locally acquiring all data and displaying all videos on separate monitors. You can plug in multiple keyboards and they will both function. If you need buttons, I recommend using usb gamepads, since they're easy to solder to their motherboards.