Jump to content
Keyglove Forums
Fradow

Trying to build one: questions

Recommended Posts

Hello,

 

I got into electronics (background as a software dev) recently, and I decided to try to build a KeyGlove. I'm quite new to Arduino, so bear with me please :)

 

Here are the few questions I can't find answer on the website and repo's docs:

 

- I tried following instructions, the code compiles fine (after a modification to MPU6050 lib), but Teensy doesn't automatically reboot. So I did it, and then .... nothing happens. I tried USB Type Keyboard + Mouse + Joystick at 8Mhz, and then connect B6 to F6 (DY motion, for key A, if I read the docs correctly), but nothing happens : no A letter on my opened app, and nothing on Arduino's serial monitor, even after putting some Serial.print in application.cpp. Is there something wrong or did I miss something? More generally, how do you debug? I may lack a bit too much in Arduino knowledge, will try to learn too.

 

- what's the reason for 3.3V instead of 5V? I didn't modify my Teensy yet, because I would really like to understand why it's needed first

 

- even after looking at the docs, I have little clue about how each port of the Teensy is configured: which one is an Input, which one is an Output? How does the KeyGlove recognize which 2 pins are connected? I guess there is a link as to why the 3 Pins on the thumb are PWM pins

 

Thanks a lot, keep up ;)

Share this post


Link to post
Share on other sites

Hello,

 

Welcome to the field! Mixing code and hardware is tons of fun. (Also, sometimes complicated and difficult.)

 

The "no activity" problem you're running into may be a blocking I2C call. Do you actually have an MPU-6050 connected, or are you running with just the Teensy right now? The code tries to do some initialization steps during the boot process, and the Arduino "Wire" library used for I2C communication has some blocking function calls in it such that it can totally freeze if the expected signals aren't seen on the wire. There is no timeout. If you don't have a motion sensor, make sure you go into the "config.h" source file and change the motion configuration so that it doesn't try to use it.

 

You'll know that the boot process succeeded if you see the Teensy's orange LED flash briefly every couple of seconds. If there's no blinking LED, then it didn't finish the boot process.

 

As for debugging, if you have KB+Mouse+Joystick USB selected, then Serial.print() calls won't go anywhere. You need a USB configuration with Serial in it in order for that to work. Serial is also used for the KGAPI host communication protocol, so if you have serial enabled, you should see data come from that port from time to time, e.g. touch events. It's binary data, not human-readable ASCII, to use a terminal application that can display hex (like Realterm). Or, you can use the Python stub console script. That's primarily what I use for rapid testing, since it speaks KGAPI easily without manually assembling or parsing binary packets.

 

For 3.3V vs. 5V, I did that because all of the sensors and the Bluetooth module that I chose use 3.3V natively, so that avoids the need for additional regulators. It also makes it easier to reliably power the device with a standard single-cell LiPo battery.

 

Concerning Teensy configuration, there is a comment block in the "support_board_teensypp2_t19.cpp" file that shows the function of all pins. The sensors are all inputs most of the time; touches are detected by very briefly setting one pin to output mode and then reading the input logic state of all other pins to which it might be connected. This is typical of a scanning keyboard matrix, though the implementation is a little more straightforward and relies less on reusing multiple pins for more than one key. See this Keyglove blog post for some further discussion.

Share this post


Link to post
Share on other sites

Hello,

 

Thanks a lot for the answer :)

 

Indeed, I don't have MPU-6050, or the Bluetooth module either. Disabling them in config.h, as well as feedback, causes a lot of errors, mainly because the includes are conditionned to having the modules, but the code that uses said includes is not always conditionned, thus compile errors because of symbols not found. I get around this by removing the conditions for includes (apart from Feedback, there must be one I can't track), but the boot doesn't seem to succeed: after uploading or manually resetting the Teensy, I see a single blink about 2 seconds after upload/reset.

 

Any idea about what else could cause this? I currently have:

#define KG_HOSTIF           (AUTO_KG_HOSTIF_USB_SERIAL | AUTO_KG_HOSTIF_USB_RAWHID | AUTO_KG_HOSTIF_USB_HID)    // <-- no Bluetooth

#define KG_MOTION           KG_MOTION_NONE

#define KG_FEEDBACK         (KG_FEEDBACK_BLINK | KG_FEEDBACK_PIEZO | KG_FEEDBACK_VIBRATE | KG_FEEDBACK_RGB)

 

I didn't get around compiling with the last one disabled.

 

Once I get it working, I'll try to send a pull request to make code work with Bluetooth, Motion and Feedback disabled.

 

Thanks a lot for the explanation on debugging, 3.3V and how the pins work. The blog post was very informative.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×