Have you dreamed of being a Jedi? Use the force to control a neoMatrix from Adafruit. In this example, we're going to build a 3d force field by using the RGB feature of the neoMatrix. Here are the gestures the 3d field will respond to.
- Wave your hand from left to right to see a wave trickle across the field.
- Draw a circle with your finger to see a number count the number of rotations.
- Poke your finger into the field and see a point follow your finger around. The colors change depending on your depth.
- Touch the pads, so see the pads on the neoMatrix light up
Show your friends your Jedi powers!
Step 1: Parts
What we need:
- Arduino - The most well-known dev board out there. Can be found at any electronics hobby store.
- Hover - It's a gesture sensor that lets you detect touch-less gestures. It detects multiple gestures such as swipes and circular motion. It can also pinpoint your hand position in 3D space. In addition, Hover can also be used as a touch sensor with 5 distinct touch points. Hover can be purchased here.
- Adafruit NeoMatrix 8x8 - Amazing light grid that has 64 Neopixels that are all RGB. It's awesome.
Step 2: Hookup Arduino to Hover and Neomatrix
On the backside of the Hover PCB, there is a female connector that can be used to connect to the your host microcontroller.
- HOST_V+: Connect to either 5V or 3.3V depending on your microcontroller. For example, if using the Arduino UNO, this pin should be tied to 5V since it is a 5V microcontroller. The Particle Photon is a 3.3V microcontroller, so this pin should be tied to 3.3V instead.
- 3.3V: Connect to the 3.3V pin on your host microcontroller
- GND: Connect to ground pin.
- TS: Connect to any Digital pin on your microcontroller.
- RESET: Connect to any Digital pin on your microcontroller.
- LED: Optional - can be used to connect to an LED + resistor to indicate a successful tap or gesture. Mainly used for debug purposes.
- SCL: Connect to SCL pin on your microcontroller
- SDA: Connect to SDA pin on your microcontroller.
For neoMatrix, there are only 3 pins.
- 5V: Connect to the 5V pin on your host microcontroller
- GND: Connect to ground pin.
- DIN: Connect to any Digital pin on your microcontroller.
Step 3: Download the Code From Github
If you haven't already, you'll need to download the Arduino IDE. After that, you need to download the Arduino library code into the your Documents/Arduino/libraries folder. So under your libraries folder, you should have the Hover folder which includes - examples, Hover.cpp, Hover.h and keywords.txt.
Go back to your Arduino folder, and download the example code here. Open up the Arduino IDE and load this code.
Step 4: Code Time
Not a big fan of coding? No worries, we'll walk through the parts you care about.
- Line 12 - check that you're using Pin 7 to hook up Arduino to your NeoMatrix DIN.
- Line 24/25 - check that you're using Pin 5,6 for hooking up Arduino to your Hover.
- If you can't use the suggested pins, just change these lines to what you need.
There are a few modes in this email - Touch, Gestures, Circle Counter, and 3d Position tracking. It's best to comment out sections and test out the features one by one. Sometimes when all are enabled, it's possible that one gesture can be interpreted as a swipe, and 3d position tracking. This may be look confusing on the NeoMatrix.
To comment out a section, just use /* to start a comment and */ to end.
Step 5: You're All Set
We've mounted our setup on a nice wooden board with the Arduino hidden neatly behind. There are two holes cut behind the Hover and Neogrid for the wires to thread through.
You're all set to feel the force. For best detection results, point your fingers down towards the board and flick your fingers. Have fun and may the force be with you.