Electronics > Beginners
One USB device on two PC's? - HELP NEEDED
<< < (4/5) > >>
rstofer:
It's dead simple to use something like RawHID in a Teensy to create a HID device.  I did that some years back when I wanted to add knobs and dials to Microsoft Flight Simulator.

https://www.pjrc.com/teensy/rawhid.html

So, easiest case, a couple of Teensy's should do the output side.

There is a USB Host Shield available for Arduino which will work with the Teensy so, maybe a third Teensy to work as the host and accept input from a keyboard and disperse it to the other Teensy's.

https://www.pjrc.com/teensy/td_libs_USBHostShield.html

I can't find the Host Shield mentioned in the above link but I can find others at Adafruit or Sparkfun.  That may require some changes in the library code but I have no idea how difficult that would be.  Probably not very...

Yes, this can definitely be done.  My solution, with 3 Teensy's and a USB Host Shield is obscene in BOM.  No doubt there is an easier way to do it but it's not really my project.


I am pretty convinced it can be done.
magic:
Try a PS/2 keyboard connected to two USB-PS/2 dongles.
It may have some chance of working, depending on how the dongles handle unexpected bytes produced by the other dongle when it initializes the keyboard.
Bicurico:
@magic: that was my thought, too.

Older wireless keyboards and mice had the problem that you could not operate several of them in viccinity.

Just get two sets of old wireless keyboards and plug the two dongles into your computers, using then only one keyboard. That should work...

Regards,
Vitor
soldar:
With the old AT PS2 keyboards this was very easy to do because besides the +Vcc and GND there were just two wires, data and clock.
Nominal Animal:
If the PC's run Linux, you only need two trivial daemons forwarding the keypresses from one to the other.
The basic code is trivial; it only becomes harder if you want to secure the connection (using OpenSSL or similar).
If you want, I can show you the basic daemon C code.  This easily scales to more than two machines, and more than two keyboards, as well.

If you want a hardware solution, use N+1 microcontrollers with a native USB interface, with N devices, and one host.
(You can do with N microcontrollers, if one of the ones with a native USB client interface also has an USB host interface.)

On N-1 USB connections to the PCs, use an USB isolator, to avoid ground loops.  The cheap eBay ones work well for max. 12Mbit/s USB, which is perfectly fine for keyboards and mice and many USB audio devices.  If this is used strictly with laptops on battery power, you can omit the isolators.

I would probably use N Pro Micros (same ATmega32u4 as in Leonardos, but much smaller board; the 5V/16MHz model, not 3.3V/8MHz), one USB host shield, and N ADuM4160/3160-based USB isolators, because I know these work well together (except I haven't used any of the USB host shields).  On fleabay, pro micros and the USB host shield cost about 4€ apiece, and the USB isolators about 8€ apiece.  For N=2, this comes to about 25€ or so.

If you can use a PS/2 keyboard, then you don't need to use the USB host shield. You can use the PS2Keyboard library with Pro Micros, because they use the same ATmega32u4 microcontroller as Teensy 2.0.

The idea is that the microcontrollers have a shared ground, and exchange key press information using UART, SPI, or I2C.  For a pair of microcontrollers, the UART makes the most sense.
Navigation
Message Index
Next page
Previous page
There was an error while thanking
Thanking...

Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod