Communicate with keyboard (USB OTG) (read a mechanical gauge)

50 views
Skip to first unread message

Bastien D.

unread,
Apr 12, 2019, 5:03:01 AM4/12/19
to mitappinv...@googlegroups.com
Hello, 
I have a dial indicator (Mitutoyo 543-404B).
This indicator is connected to my tablet as a keyboard with a USB OTG.
When I press the button "data" on the indicator, it send the actual value.

What I want to do :
I don't want to press the button data. I want to press a button from my application MIT app inventor and receive the data.


How can I do that ?
How can I call my "keyboard" and ask him to send me values ?

Thank you !!!

Chris Ward

unread,
Apr 12, 2019, 7:47:48 AM4/12/19
to MIT App Inventor Forum
Hello Bastien

From the Mitutoyo 543-404B instructions PDF:

DataToExternalDevice.png


Bastien D.

unread,
Apr 12, 2019, 8:08:15 AM4/12/19
to MIT App Inventor Forum
Hello Chris and thank you for your answer !!

But I think that's not very clear for me :
How can I send an output request to the dial indicator ?


SteveJG

unread,
Apr 12, 2019, 8:30:49 AM4/12/19
to MIT App Inventor Forum
You cannot communicate with your OTG keyboard using native App Inventor 2 Blocks.   You might be able to use this extension https://github.com/S2I71/usb_otg_bridge_app_inventor  which is intended for use with an arduino connected by OTG.
.
You would have to find out what the escape sequence is for the DATA key and and send that.   (ANSI escape sequence is a sequence of ASCII characters, the first two of which are the ASCII "Escape" character 27 (1Bh) and the left-bracket character " [ " (5Bh). The character or characters following the escape and left-bracket characters specify an alphanumeric code that controls a keyboard or display function.)  I imagine that won't work but you could experiment.  Sorry, I have no idea as to what characters need to be 'sendt".

App Inventor 2 is not designed to work with OTG accessories .   Developers can read files from a flash drive using an OTG dongle connected to a flash drive using the File component...but that is not a keyboard.

Regards,
Steve

Bastien D.

unread,
Apr 12, 2019, 9:37:03 AM4/12/19
to MIT App Inventor Forum
Ok thank you, I'm so sad it was not very easy !!

My goal is to connect 3 dial indicators at MIT app inventor and collect data from the 3 dial indicators when I press a button.

How do you think I can proceed ?
Do you think the best way to do that is to take an Arduino ?

Regards,
Bastien.

SteveJG

unread,
Apr 12, 2019, 10:06:58 AM4/12/19
to MIT App Inventor Forum
I think what you want to do is impossible with App Inventor Bastien.   The only way to know for sure is to experiment if you have the necessary technical skills.  I provided  a link to an extension that uses OTG to link to an arduino. .  Will it work to allow you to query your keyboard to get information from "3 dial indicators"  ?   I have no idea. 

How to proceed?  I do not know. What you do depends on how where the 'dial indicator' information comes from .  Based on this 

gauge.PNG


I think this is probably impossible with App Inventor especially not knowing what protocol is used to send the data.    Does this gauge have a Bluetooth output?   App Inventor might communicate with it if output is Bluetooth compatible.

ABG

unread,
Apr 12, 2019, 4:43:37 PM4/12/19
to MIT App Inventor Forum

Bastien D.

unread,
Apr 14, 2019, 4:48:58 AM4/14/19
to MIT App Inventor Forum
Thank you everybody for your time spent for me !

I will maybe test a Bluetooth indicator because I don't want to have an Arduino or something like that !!

Have a nice day !!

Bastien.
Reply all
Reply to author
Forward
0 new messages