How to Build

Introduction

Introduction

Hello, fellow electronics hobbyists! Even though my goal is to bring the Keyglove design into a consumer-ready retail product as well as a kit, I still want to keep detailed build instructions available for all of you who might want to give it a try completely from scratch. These instructions can help you get started before the Keyglove reaches kit or retail form.

The Keyglove is currently in a prototype stage. That means it’s not done, and in some ways, it’s not even working right. So, while you are free to follow these instructions, realize what you’re getting yourself into. This is only enough info to get you caught up to where I am, which once again is not finished.

Below the instruction slider here, you will find an explanation of different hardware choices and limitations, as well as a full list of hardware you will probably want to buy and where you can get it, and a consolidated list of software you’ll probably need. These resources are mentioned individually in each relevant step's detail section, but it can be helpful to have everything listed all in one place for reference.

These steps assume you are using a solderless breadboard, Teensy++ 2.0, 6DOF IMU from SparkFun, and USB connection for the very basic module. If you choose different hardware for your build, you will need to adjust some of the steps accordingly. Other features such as wireless support, non-Arduino LUFA-based code development, alternative hardware choices, and other features will be added as soon as possible.

Use the left and right arrow keys or click on the vertical "spines" to navigate between major steps, and use the up and down arrow icons visible when hovering over this area to move between detailed steps (these icons are only present if there is more than one detailed step, which is not the case for this introduction).

Any and all feedback is welcome. Have fun, and if you build something you're proud of, let me know and I'll post a link to it on this page!

— Jeff @ Keyglove

Arduino Development Environment
Teensyduino

Arduino Development Environment - Step 1: Arduino IDE

(Note: if you already have the latest version of Arduino installed, go to the next step.)

Download the Arduino IDE (currently at version 1.0) for best compatibility. Version 0023 will work for the time being as far as I know, but the code is being developed in v1.0, and I strongly recommend that you use it if possible. The main Keyglove sketch file uses the new .ino extension instead of the older .pde extension, so if you decide to use one of v0023 anyway, you'll need to rename the file for compatibility.

After downloading the appropriate version for your operating system, run the installer, and then move on to the next step when you have finished.

Teensyduino

Arduino Development Environment - Step 2: Teensyduino

(Note: if you already have Teensyduino, go to the next step.)

Download and install the latest version of Teensyduino from PJRC. This is a free add-on that allows the Arduino IDE to upload sketches to the Teensy++ board, which has its own unique bootloader and direct USB programming method. This process will also install the Teensy utility, which is a simple interface that lets you see what the current status of the Teensy++ board is during programming. The Teensy utility should automatically be launched the first time you upload the sketch to the board, so don't worry about running any special software when the installation process finishes.

Keyglove Codebase

Arduino Development Environment - Step 3: Keyglove Codebase

Download the latest snapshot of the Keyglove codebase from the Github repository. If you have a git client on your computer, you can use the command "git clone http://github.com/jrowberg/keyglove" to pull all of the code. There are many Windows and Mac git clients available if you need one, including SmartGit (my personal favorite). You can also simply download a ZIP archive of the entire repository if that would be easier, or if you don't care to use source control. It doesn't matter where you clone the repository or extract the archive, as long as you remember where you put it.

The repository includes many things that you may not need, depending on your desires, but the main Arduino sketch file and other required source files are all inside the /keyglove subfolder. You will find this folder in the root of the repository (or ZIP archive), along side other subfolders such as /kg_developer and /keyglove_lufa. You can for the moment freely ignore all of the other subfolders in the archive.

Arduino Sketch Test

Arduino Development Environment - Step 4: Arduino Sketch Test

Start the Arduino IDE if it isn't already running, then go to File -> Open... and browse to the location where the keyglove.ino file is from the cloned repository or ZIP archive. Open that file, and you should see something like the image above. My window background here is gray because I have enabled the "Use external editor" option from File -> Preferences, because I prefer the syntax highlighting that ConTEXT affords. This is entirely optional though, and the default behavior is to use the Arduino IDE itself as the editor, in which case the background will be white, not gray.

Make sure you go to the Tools -> Board menu entry and select "Teensy++ 2.0", and then go to the Tools -> CPU Speed and select "8MHz" before continuing. The Tools -> USB Type option should be set to "Serial Keyboard + Mouse + Joystick". The reason 8MHz is required is that the AT90USB1286 processor is not rated to run at the full 16MHz when supplied with 3.3V. It will run at this speed, but it's not recommended or necessarily stable. The Keyglove code has been written for reduced speed in light of this fact.

Go to the Sketch menu and select the "Verify / Compile" option to make sure everything compiles. The Teensy++ does not need to be plugged in for this to work. The compilation should succeed without any errors at this stage, and the Teensy utility may automatically start even if the board is not plugged in. Don't worry if this happens. If you don't get any errors, then congratulations! It worked. If you do, then...oops. Please let me know. If you have any questions or problems, please post them on the Keyglove Forums.

Teensy++ Prototype Construction
Teensy++ Board

Teensy++ Prototype Construction - Step 1: Teensy++ Board

Get a Teensy++ board and attach male header pins. This involves two 20-pin segments, one on each side, plus a 2x4-pin group (or two 1x4-pin rows) to access the extra I/O pins in the middle area of the board. Do not add any header pins for the three RST, GND, and 5V pins on the back edge of the board, as these are not necessary and will only make it difficult to get to the reset button. You can also get the Teensy++ with pins attached for $3 more, but you will still need to add the extra 2x4 internal headers.

3.3V Regulator

Teensy++ Prototype Construction - Step 2: 3.3V Regulator

Attach the 3.3V regulator and cut the existing 5V trace on the bottom of the board. Then connect the center and 3.3V pads on the solder jumper to finish the conversion to make the Teensy++ run at 3.3V. Although we'll come back to this later, remember that running an AT90USB1286 MCU at 3.3V requires you to set the clock speed to 8MHz or less in order to remain within specifications. You can run it at the full 16MHz usually without side effects, but it is not generally a good idea.

Teensy++ Mounted

Teensy++ Prototype Construction - Step 3: Mount Teensy++

Mount the 3.3V-converted Teensy++ one of these great solderless breadboards from SparkFun. Place the board so that the mini USB connector is right on the edge (I use the side closest to the "1" row). Whether you end up with two extra holes on the left and three on the right, or two on the right and three on the left, doesn't really matter.

6DOF Mounted

Teensy++ Prototype Construction - Step 4: Mount 6DOF Module

Mount the IMU Digital Combo Board from SparkFun right next to the Teensy board. It doesn't have to be in the same left/right position, but it looks nicer if it is.

Power Jumpers

Teensy++ Prototype Construction - Step 5: Upper Power Jumpers

Add small jumper wires to connect the Teensy's GND and 5V pins (on either side, closest to the USB connector) to the breadboard's power bus rows. As shown in this view, the 5V pin (now actually 3.3V) is on the right side, and the GND pin is on the left. I conventionally use red wires for VCC and green for GND--mostly because I don't have small black jumpers--but you can use whatever you want as long as you keep everything straight.

Second Power Jumpers

Teensy++ Prototype Construction - Step 6: Lower Power Jumpers

To make sure both sides of the board have both GND and VCC, add a couple more cross-board jumper wires to connect the left and right power bus sets together. Make sure you don't reverse the polarity here, or you might fry your USB port and/or the Teensy++ board.

6DOF Module Connections

Teensy++ Prototype Construction - Step 7: 6DOF Module Connections

Connect the VCC and GND pins of the 6DOF board to the power bus on the left. The first pin on the board is VCC (red), and the second is GND (green) as shown here. Connect the I2C clock and data lines (SCL and SDA pins) of the 6DOF board to the Teensy board's D0 and D1 pins, respectively. Note that SDA (the 3rd 6DOF pin) goes to D1, and SCL (the 4th 6DOF pin) goes to D0. I conventionally use blue for SDA and yellow for SCL for all of my I2C device connections, as shown here.

Connect the INT1 and INT0 6DOF interrupt pins to the tiny E4 and E5 internal holes on the Teensy++ board. For prototyping purposes, I have used a simple pressure fit to keep the wires in place on the Teensy side. The INT1 line goes from the 5th 6DOF pin (green wire) to E4, and the INT0 line goes from the 6th 6DOF pin (orange wire) to E5.

6DOF Connection Detail

Teensy++ Prototype Construction - Step 8: 6DOF Connection Detail

From this viewpoint, going from left to right, the connections on the 6DOF board are INT0, INT1, SCL, SDA, GND, and 3.3V. The other ends of each of these wires should be E5, E4, D0, D1, GND, and 3.3V respectively. The next step shows a close-up of the Teensy++ end of the interrupt connections.

6DOF Interrupt Connection Detail

Teensy++ Prototype Construction - Step 9: 6DOF Interrupt Wire Detail

Notice the pressure fit and location of the E4 and E5 internal pins on Teensy++ board. You may choose whatever method works best for you for these connections, as long as they are reliable enough for your needs. The two interrupt pins are necessary to ensure a constant 100Hz data rate for capturing motion from the 6DOF board.

Final Prototype Board

Teensy++ Prototype Construction - Step 10: Finished!

Congratulations! You just finished the very basic prototype board construction for the Keyglove. If you have any questions or problems, please post them on the Keyglove Forums.

Soon to come: glove construction, wireless modules, and development environment setup.

Wireless Support

Coming soon!

The guys at Digital Telepathy generously worked with me to provide the SlideDeck content slider which I’ve used to create the step-by-step instruction set above. I highly recommend both SlideDeck and the people behind it if you’re looking for this functionality.

Help Available on the Forums

If you need some help building your own from scratch, especially since there is no universal and fully documented start-to-finish process yet, post your questions on the Keyglove Forums for some input from me and others. I love to see people doing the same thing, and I’ll do whatever I can to help you get past any difficulties or answer your questions.

Different Hardware Options

Not every approach to building your own prototype Keyglove will yield the same feature set. There are a few considerations to make depending on your needs, and whether you’re willing to wait for the official hardware to be released (hopefully sooner rather than later, but I’m not sure).

To start, you can choose one of the following boards:

  • Arduino Mega 1280/2560
  • Teensy++ 2.0
  • Keyglove Controller not available yet

The most capable option is the official Keyglove board, but that is not yet available due to the rapid and significant revisions it’s currently undergoing. The best choice in the mean time is the Teensy++ 2.0, because of its small size and great USB functionality. Smaller Arduino boards such as the Uno limit the number of sensors you can have significantly unless you use I/O expanders, which is why the Mega is a better choice. All Arduino boards make USB very difficult (and not officially supported in the Keyglove code).

There are also two approaches for connecting the touch sensors to the MCU:

  • Direct digital I/O pin connection
  • I2C I/O expanders

The direct connection is simpler electrically, but may be limiting depending on your board choice. The complete sensor arrangement requires 37 I/O pins, though you can get by with fewer if you are creative with your touchset. Maintaining efficiency with less than 25 would be quite difficult. The Arduino Uno only has 14, which means you’d really want I/O expanders with that board. The Arduino Mega boards have 54 I/O pins, which is plenty including the use of the UART interface and some interrupts for motion sensors. The Teensy++ 2.0 has only 46, which is enough for the full array of sensors, I2C connections, one UART device, and the I2C version of the feedback module (which otherwise takes 5 I/O pins and cuts out some other important functionality. As before, until the Keyglove Controller is done, the Teensy++ is the best choice in light of its size and USB support.

Then, there is the choice of how you want to interface with the host device:

  • Serial only, which requires your own interpreter/driver on the host
  • PS/2, which was never fully developed (but partially so)
  • USB, which isn’t supported on the Arduino Mega boards
  • Logitech R400 protocol, which requires the guts of a Logitech R400
  • Bluetooth, which currently requires the Bluegiga WT12 module

Currently the best option is USB + Bluetooth, or Serial + Bluetooth, either of which is possible using the Teensy++ board. The Teensy++ supports simultaneous Serial+KB+Mouse+Joystick after a recent update to the Teensyduino add-on, so it is ideal for prototyping purposes. The Keyglove Controller will be able to do this as well, but as mentioned before, it’s not actually available yet.

Finally, there is an option for different types of motion sensors:

  • ADXL345 I2C accelerometer only
  • ITG-3200 I2C gyroscope only
  • ADXL345 + ITG-3200 I2C 6-DOF combination
  • ADXL345 + ITG-3200 + HMC5843/HMC5883L I2C 9-DOF combination
  • MPU-6050 I2 6-DOF integrated MEMS device from InvenSense
  • MPU-6050 + HMC5843/HMC5883L I2 9-DOF with MotionFusion
  • MPU-9150 I2 9-DOF with MotionFusion

The simplest option is currently the ADXL345/ITG-3200 6-DOF board from SparkFun. The 9-DOF board from SparkFun is another easy option, but it is larger and more expensive without much real benefit at this point. The MPU-6050 is a relatively new device (you can order it from Component Distributors or SparkFun), and the updated MPU-9150 is even newer (not available for purchase yet). There is currently no place to buy either of these modules on a breakout board yet. The benefit of the MPU-6050/9150 is that all of the 6-axis or 9-axis fusion calculation work is done on the MPU itself, rather than on the main processor. Ongoing efforts to reverse engineer the MPU-6050/9150 can be followed here (lots of source code and documentation included). It’s not finished yet, but raw readings are definitely possible, and the DMP is almost sort of working.

The other design choices, such as whether to include an RGB LED, piezo buzzer, or vibration motor, are more trivial and have very little impact on which hardware you should choose. The following instructions assume you will use the Teensy++ 2.0 board, direct I/O sensor connection, and the 6-DOF board from SparkFun for motion sensing. Just be aware of the other options.

Hardware List

Item Source Price Qty.
CORE HARDWARE
Cotton handbell glove MusicMart $3.25 1
Conductive fabric (MedTex180) SparkFun $19.95 1
Teensy++ 2.0 PJRC $24.00 1
Teensy 3.3v regulator PJRC $1.00 1
ITG3200/ADXL345 6-DOF breakout SparkFun $64.95 1
25′ hookup wire SparkFun $2.50 1
Mini USB cable PJRC $4.00 1
WIRELESS SUPPORT
Bluegiga WT12 UART breakout InMojo $40.00 1
900 mAh LiPo battery SparkFun $8.95 1
LiPo battery charger SparkFun $9.95 1
SPDT mini power switch SparkFun $1.95 1
SENSORY FEEDBACK
RGB status LED SparkFun $1.95 1
330 ohm resistor for RGB LED SparkFun $0.25 3
2kHz buzzer SparkFun $1.95 1
Vibration motor SparkFun $4.95 1
2N3906 vibration control PNP SparkFun $0.75 1
1N4733A Zener diode SparkFun $0.25 1
PROTOTYPE TOOLS
Solderless breadboard SparkFun $5.95 1
20×1 header pins PJRC $0.80 6+

A few notes about the hardware above: the only stuff you really need is the core hardware. You can build a functional USB-only Keyglove with no wireless support, no sensory feedback (light/sound/vibration), and no prototype tools. However, I’d recommend getting at least the breadboard (and pins if you buy the Teensy++ without them) unless you are very confident in your abilities or have a very specific reason for it. Additionally, the wireless support and sensory feedback greatly add to the usefulness of the Keyglove, so I’d recommend those parts as well. If you decide not to get all of it though, you can certainly add more functionality later.

Also, feel free to use any sources you have, including your own collection. You may have a spare breadboard handy, or a mini USB cable, or 330-ohm resistors. I tried to minimize the number of unique mail-order sources to reduce shipping costs, but you can order from anywhere. A full set of hardware as described above will run at exactly $201.17 plus shipping and handling.

Full disclosure about the WT12 breakout board from InMojo: it’s actually my design, and InMojo is a platform that allows you to buy them directly from me. It’s easier, smaller, and cheaper than the only other WT12 breakout board design I know of currently, so I don’t feel bad recommending it. If you find something else that you prefer, then by all means use it instead.

The MedTex180 comes from SparkFun in a 12″ x 13″ piece. This is at least ten times as much as you need, but I don’t know where to get smaller pieces. I personally ended up getting a 12″ x 60″ swath of it from LessEMF (Cat. #A321, $29.95/ft) while I was researching, which is a good deal if you happen to need a boatload of the stuff.

All in all, for a single-quantity order of everything you need including shipping, expect to spend about $250. I will try to buy in bulk and resell for considerably less than this once the prototype becomes more kit-ready.

Software List

Item Source
DEVELOPMENT
Arduino IDE Arduino.cc
Teensyduino add-on PJRC
Keyglove controller code GitHub
TESTING
Processing IDE Processing.org
Keyglove visualization code GitHub