Problem reading a HID keyboard device

Hi!

I'm currently working on a project with a digital micrometer Mitutoyo wich have a special port to send data with a button through a USB cable. Once connected to a computed it basically works like a Keyboard sending the measurement and Enter key together.

My project is basically read the micrometer measurement with an Arduino (Mega 2560) and making a comparision activate a relay module. First I tried using a USB-TTL converter (HW-474) but it didn't worked at all I guessed it was something related to RS-232 conversion. So investigating a little bit more I found out that I needed a USB host device to connect it to the Arduino, but in my country there's no USB host shield available so I kept researching till I found this tutorial where basically using a USB-PS/2 adapter and the PS2keyboard library that allows to connect and read a USB keyboard and print it in the serial monitor. Since the adapter is cheap I tried it and it worked with a regular keyboard but when I connected the micrometer it didn't showed me anything in the monitor. I connected both devices (regular keyboard and micrometer) to my computer and checked on the properties of both but I didn't find any relevant difference

So now I'm wondering 2 things:

First: The USP-PS/2 adapter solution doesn't work with the micrometer due the library? I mean usually when you press a key on the keyboard a "code" is sent and the library maps thar code with the symbols and the prints in the serial monitor corresponding data so since micrometer send for example as data "0.359 + Enter key" I guess the library isn't able to map that to something. In this case is possible to modify the library?

Second: I wanted to buy USB Host shield and wait till arrive my country but first I wanted to check if it was possible to read the micrometer (since it's gonna be a big money investment) with Arduino. So, there's a way to check if the USB host shield it's gonna be able to solve my problem? I think it's probably related to the way the micrometer sends data frame, but I want to be sure before buying it.

Any help it's welcome. To clarify I haven't written any code yet I just used the library examples to test it.

Thanks

if you want to stay on your MEGA and play with HID, I'd suggest you explore GitHub - NicoHood/HID: Bring enhanced HID functions to your Arduino!

No USB host shield necessary

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.