USB keyboard input in Teensy

Status
Not open for further replies.
You can with the Teensy 3.6 which has USB input support for some devices including many/most keyboards.

Look under examples for the library USBHost_t36 and look at the example: Mouse
Which includes drivers for several devices including keyboards
 
You can with the Teensy 3.6 which has USB input support for some devices including many/most keyboards.

Look under examples for the library USBHost_t36 and look at the example: Mouse
Which includes drivers for several devices including keyboards
So it's not possible with Teensy LC? I guess USB keyboards work differently than PS2 then, right? I thought maybe they used the same sort of interface, like a data and a clock line.
 
I'm using Teensy 3.6 with the Teensy Mouse example, but the power never is enabled to the USB port. What has to be done to enable it? I would have guess that the Example would have.
 
Hopefully someone else has more experience with some of this. I mainly have used the USB stuff to simply add the capabilities to the T3.6, but have not yet needed it for any real projects.

http://www.hobbytronics.co.uk/usb-host-mini is another; mentioning it as a cheaper, smaller, and more plug-and-play option than the above shield.
Looks like an interesting option for some...
I'm using Teensy 3.6 with the Teensy Mouse example, but the power never is enabled to the USB port. What has to be done to enable it? I would have guess that the Example would have.
Not sure what you are saying here? Are you saying you plugged something into the USB port and it did not receive power? If so how was the Teensy powered? USB? external power? ...

Would it be possible to use a USB to PS2 adapter and use the PS2 keyboard library with a Teensy LC?
No idea, You can always pick one up and see if it works...
 
There is a 2nd USB port on the Teensy 3.6 which is a 5-pin connector inside from pins 1-6 label 5V, DM, DP, GND, GND that is for connecting a USB device. It is called "USB Host Port". The Teensy 3.6 has an electronic switch to turn the 5V power to the connector, but I haven't found a sketch that will turn the power on and allow me to use it as a keyboard input to my sketch. I was told that the teensy 3.6 Mouse Example would, but so far I'm not having any luck with it because first, it doesn't turn on the 5Volts to the device. The port allows connection to the Teensy 3.6 without any additional hardware. Thanks for any help, Mike
 
With latest TD 1.42 installed I see :: ...\hardware\teensy\avr\libraries\USBHost_t36\examples\… >> sample sketches

Under :: File / Examples / USBHost_t36 :: there are a set of examples that should work that appear in the above folder
 
As @defragster mentioned, the host port, is not just something you turn the power on to make work. Instead, it requires code to enable the USB to work, including code that understands how the USB keyboard works..

Probably the best place to look is where he mentioned. Try looking at the mouse example. It actually has objects in for several different USB devices, like mice, keyboard, joystick...
 
Would it be possible to use a USB to PS2 adapter and use the PS2 keyboard library with a Teensy LC?

Those USB to PS/2 adaptors are just wires. No electronics inside. They only work if the USB keyboard detects it's really connected to a PS/2 port and communicates as a PS/2 keyboard. 10+ years ago, virtually all USB supported those adaptors. Many probably still do, but it's no longer the sure thing as it was.

So the first thing to do is check your keyboard. Find a PC with a PS/2 port and plug it in with the adaptor. If it actually works, then it'll very likely work with Teensy LC using the PS/2 keyboard lib. If it doesn't work on a PC's PS/2 port, then there's zero chance that keyboard would work on a Teensy using the PS/2 lib.

To actually use a USB keyboard as USB, the minimum Teensy is 3.6.

It's also possible to do this with a USB host shield. But those are very inefficient. By the time you pay for the extra hardware, you might as well just get a Teensy 3.6 where the USB host port has excellent performance.
 
There is a 2nd USB port on the Teensy 3.6 which is a 5-pin connector inside from pins 1-6 label 5V, DM, DP, GND, GND that is for connecting a USB device. It is called "USB Host Port". The Teensy 3.6 has an electronic switch to turn the 5V power to the connector, but I haven't found a sketch that will turn the power on and allow me to use it as a keyboard input to my sketch. I was told that the teensy 3.6 Mouse Example would, but so far I'm not having any luck with it because first, it doesn't turn on the 5Volts to the device. The port allows connection to the Teensy 3.6 without any additional hardware. Thanks for any help, Mike

The problem was 2 bad USB adapter cables where the shield had a high resistance! I works great not with a good adapter cable. Mike
 
Status
Not open for further replies.
Back
Top