# PianoGlove

## What you'll need

http://youtu.be/awZ2ElCgnAo

The PianoGlove uses a TCS34725 to sense colors, a NeoPixel LED to 'play' those colors back visually, a VS1053 Codec board to play them back aurally, and a Flora wearable microcontroller to handle all the conversion & communication between them.

Prerequisite guides:

- [Getting Started with FLORA](http://learn.adafruit.com/getting-started-with-flora)
- [Flora NeoPixels](http://learn.adafruit.com/flora-rgb-smart-pixels)
- [Adafruit Color Sensors](http://learn.adafruit.com/adafruit-color-sensors)
- [VS1053 Codec Breakout Tutorial (MIDI Section)](http://learn.adafruit.com/adafruit-vs1053-mp3-aac-ogg-midi-wav-play-and-record-codec-tutorial/overview "Link: http://learn.adafruit.com/adafruit-vs1053-mp3-aac-ogg-midi-wav-play-and-record-codec-tutorial/overview")  

To build your own PianoGlove, you'll need the following items:

- [Flora](http://www.adafruit.com/products/659)
- [VS1053 Codec Breakout](http://www.adafruit.com/products/1381 "Link: http://www.adafruit.com/products/1381") (includes 3.5mm jack)
- [Lithium Ion Polymer Battery](http://www.adafruit.com/products/1317 "Link: http://www.adafruit.com/products/1317")  
- [Flora Color Sensor](http://www.adafruit.com/products/1356)
- [Flora RGB Smart Neo Pixel](http://www.adafruit.com/products/1260)  
- [Perma-Proto Half-sized Breadboard PCB](http://www.adafruit.com/products/571 "Link: http://www.adafruit.com/products/571")  
- Fabric glove
- Wire
- Needle & thread
- [Soldering iron](http://www.adafruit.com/products/180) & [solder](http://www.adafruit.com/products/145)
- [Wire cutters](http://www.adafruit.com/products/152)
- Computer & [USB cable](http://www.adafruit.com/products/260) to program Flora

In this tutorial, we'll be using an inexpensive black glove from a costume shop, but do feel free to experiment & improvise with any other types of gloves, wearables, or whatever inspires you.

Once you've gathered all your gear, we can move on to building the electronics …

# PianoGlove

## Solder it

# Prepare to be wired
  
First we'll prep the wires which run from the Flora to the Color Sensor, NeoPixel, and Codec Board.  
  
  
Ribbon cable can be handy for keeping wires grouped, but any common type of hookup wire will work just fine.  
  
  
Cut 7 pieces of wire a bit longer than the distance between your pointer fingertip and wrist.  
  
  
Cut an additional 4 pieces of wire to about 4.5" lengths.  
  
  
Strip the end of each wire and tin it with a bit of solder.  
![flora_DSC_2404.jpg](https://cdn-learn.adafruit.com/assets/assets/000/010/065/medium640/flora_DSC_2404.jpg?1396901584)

![flora_DSC_2405.jpg](https://cdn-learn.adafruit.com/assets/assets/000/010/067/medium640/flora_DSC_2405.jpg?1396901601)

![flora_DSC_2414.jpg](https://cdn-learn.adafruit.com/assets/assets/000/010/071/medium640/flora_DSC_2414.jpg?1396901666)

![flora_DSC_2413.jpg](https://cdn-learn.adafruit.com/assets/assets/000/010/072/medium640/flora_DSC_2413.jpg?1396901625)

## Wire Flora to Color Sensor & NeoPixel
Using the [wiring diagram](http://learn.adafruit.com/assets/10075) to the left (click to enlarge), solder the connections between the Flora and Color Sensor.   
  
Then do the same for connections to the NeoPixel.   
  
Be sure to connect Flora D6 to NeoPixel's input pad which is labelled with an arrow pointing toward the NeoPixel LED.  
![flora_PianoGlove-wiring-finger.png](https://cdn-learn.adafruit.com/assets/assets/000/010/075/medium640/flora_PianoGlove-wiring-finger.png?1396901779)

![flora_DSC_2424.jpg](https://cdn-learn.adafruit.com/assets/assets/000/010/076/medium640/flora_DSC_2424.jpg?1396901805)

![flora_DSC_2429.jpg](https://cdn-learn.adafruit.com/assets/assets/000/010/077/medium640/flora_DSC_2429.jpg?1396901825)

![flora_DSC_2434.jpg](https://cdn-learn.adafruit.com/assets/assets/000/010/078/medium640/flora_DSC_2434.jpg?1396901852)

## Create the Codec-Perma-Proto
The Perma-Proto board is designed to mirror the connections of a [half-size breadboard](http://www.adafruit.com/products/64). This means you can easily test your Codec board wiring temporarily on a breadboard before committing to a soldered Perma-Proto.  
  
The Codec board comes with two strips of male header pins. Trim each of them to a length of 16 pins and place them in the Perma-Proto board as seen to the left.  
  
Mount the Codec board on the header pins and solder them all in place. Then go ahead and solder the pins to the bottom side of the Perma-Proto.  
  
Clip the excess pin lengths off the bottom side in order to avoid significant wrist discomfort later on!  
![flora_DSC_2438-redux.jpg](https://cdn-learn.adafruit.com/assets/assets/000/010/079/medium640/flora_DSC_2438-redux.jpg?1396901868)

![flora_DSC_2444.jpg](https://cdn-learn.adafruit.com/assets/assets/000/010/080/medium640/flora_DSC_2444.jpg?1396901895)

![flora_IMG_2810.jpg](https://cdn-learn.adafruit.com/assets/assets/000/010/081/medium640/flora_IMG_2810.jpg?1396901913)

## Wire Codec board to Flora and audio jack

Solder the Codec board's included 3.5mm audio jack to the Perma-Proto in the remaining unused area.  
  
While following along with the [wiring diagram](http://learn.adafruit.com/assets/10083), use small pieces of solid core wire or breadboard jumpers to make on-board connections between the Codec board to the audio jack.

If you have a V2 version of the VS1053 breakout, connect the middle headphone jack pin to **AGND** instead of **GBUF** (all else is the same)  
  
Solder connections between the Flora and Codec board using the shorter set of 4 wires you cut and tinned earlier.

![flora_PianoGlove-wiring-audio.png](https://cdn-learn.adafruit.com/assets/assets/000/010/083/medium640/flora_PianoGlove-wiring-audio.png?1396901978)

![flora_IMG_2814.jpg](https://cdn-learn.adafruit.com/assets/assets/000/010/084/medium640/flora_IMG_2814.jpg?1396902000)

![flora_IMG_2818.jpg](https://cdn-learn.adafruit.com/assets/assets/000/010/085/medium640/flora_IMG_2818.jpg?1396902020)

# PianoGlove

## Sew it

It's not necessary to wear the glove while the electronics are sewn in place, but doing so can help ensure a comfortable fit. Keep in mind, you'll need a friend with basic sewing skills and a steady hand to help out if choose to go this route.

## Attach Flora
Place the Flora on the back of the glove just past the knuckle-line. Sew it in place using the unused solder pads as anchor points.  
![flora_IMG_2833.jpg](https://cdn-learn.adafruit.com/assets/assets/000/010/091/medium640/flora_IMG_2833.jpg?1396902150)

![flora_IMG_2835.jpg](https://cdn-learn.adafruit.com/assets/assets/000/010/092/medium640/flora_IMG_2835.jpg?1396902169)

## Stitch finger wiring
  
Wrap the NeoPixel wiring around the glove index finger so that the NeoPixel can be attached on top of the fingernail area. Secure the wires to the glove using a whip-stitch running their entire length.  
  
Sew the NeoPixel to the back of the fingertip/fingernail area.  
  
Wrap the Color Sensor wiring around the index finger, ensuring the sensor rests below the the face of the fingertip. Stitch the length of the wiring to the glove and sew the sensor in place.![flora_IMG_2848.jpg](https://cdn-learn.adafruit.com/assets/assets/000/010/093/medium640/flora_IMG_2848.jpg?1396902187)

![flora_IMG_2850.jpg](https://cdn-learn.adafruit.com/assets/assets/000/010/094/medium640/flora_IMG_2850.jpg?1396902208)

![flora_IMG_2856.jpg](https://cdn-learn.adafruit.com/assets/assets/000/010/095/medium640/flora_IMG_2856.jpg?1396902228)

![flora_IMG_2857.jpg](https://cdn-learn.adafruit.com/assets/assets/000/010/096/medium640/flora_IMG_2857.jpg?1396902254)

## Sew the Codec Proto
  
Place the Proto board at the glove's wrist area just behind the joint so that your hand can move freely. Sew it place using the any of holes on either side of the board.![flora_IMG_2840.jpg](https://cdn-learn.adafruit.com/assets/assets/000/010/090/medium640/flora_IMG_2840.jpg?1396902128)

## Connect the battery
Turn the Flora's power switch to the off position and plug the battery into the connector opposite the USB port.   
  
To secure the battery in place during use, it can be tucked between the Flora and glove.   
  
Optionally, you can further secure the battery by sewing its wiring to back of the glove.![flora_IMG_2864.jpg](https://cdn-learn.adafruit.com/assets/assets/000/010/087/medium640/flora_IMG_2864.jpg?1396902050)

![flora_IMG_2866.jpg](https://cdn-learn.adafruit.com/assets/assets/000/010/088/medium640/flora_IMG_2866.jpg?1396902078)

![flora_IMG_2868.jpg](https://cdn-learn.adafruit.com/assets/assets/000/010/089/medium640/flora_IMG_2868.jpg?1396902106)

# PianoGlove

## Program & Play

## Download the code

There are three code libraries which you'll need for this project. For modern Arduinos, please use the Manage Libraries feature to select the following libraries. For more on working with Arduino libraries, [see this guide](https://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use).

- [NeoPixel Library](https://github.com/adafruit/Adafruit_NeoPixel)
- [TCS34725 RGB Color Sensor Library](https://github.com/adafruit/Adafruit_TCS34725)

Once you have those two libraries loaded, you can download the code. From the program listing below, select **Download File** &nbsp;to get at the files. This will save a Zip file of the files to your computer. Remember the location you saved them to. After the download, open the Zip file and get the following files&nbsp; **Flora\_Pianoglove.h** and **Flora\_Pianoglove.ino**. You can move the&nbsp; **Flora\_Pianoglove** directory to your Arduino Sketch directory and be ready to go. Just be sure both the **ino** and **h** files are in the same directory.

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/Flora/Flora_Piano_Glove/Flora_Pianoglove/Flora_Pianoglove.ino

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/Flora/Flora_Piano_Glove/Flora_Pianoglove/Flora_Pianoglove.h

## Upload the sketch

For more information on programming your Flora board including the software you need to do so, head over to the [Getting Started with Flora](http://learn.adafruit.com/getting-started-with-flora "Link: http://learn.adafruit.com/getting-started-with-flora") guide.  
  
Download & open the [PianoGlove MIDI](https://github.com/adafruit/Adafruit_Learning_System_Guides/tree/master/Flora_Piano_Glove) sketch in the [Adafruit-Arduino IDE](http://learn.adafruit.com/getting-started-with-flora/download-software)  
  
Connect Flora via USB to your computer  
  
Set Adafruit-Arduino IDE's board setting to "Flora" & upload the sketch.

# Play some colors!
![](https://cdn-learn.adafruit.com/assets/assets/000/010/099/medium800/flora_IMG_2874.jpg?1396902320)

## Once the sketch has been uploaded to the Flora, wait for the onboard red LED to stop flashing, then disconnect the USB cable.
  
Use Flora's power switch to turn on battery power. After a short load time, the Flora's red LED should go dark and Color Sensor's white LED should now be on.  
  
Connect a powered speaker or headphones to the 3.5mm audio jack and move your new color-sensing index finger close to something colorful to play a musical note through the audio jack.  
  
Try moving the sensor quickly between different bright/dark colors, or 'gate' a note by quickly pulling the sensor away from an object. Experiment with … well, anything that has color! 
## Related Guides

- [Sewable NeoPixels](https://learn.adafruit.com/flora-rgb-smart-pixels.md)
- [Magic Storybook with ChatGPT](https://learn.adafruit.com/magic-storybook-with-chatgpt.md)
- [Pathfinder Robot Companion](https://learn.adafruit.com/pathfinder.md)
- [Cyber Cat MIDI Keyboard](https://learn.adafruit.com/midi-cyber-cat-keyboard.md)
- [Magic Light Bag of Holding](https://learn.adafruit.com/magic-light-bag-of-holding.md)
- [Adafruit Circuit Playground Express](https://learn.adafruit.com/adafruit-circuit-playground-express.md)
- [Blahaj Alarm and Lamp](https://learn.adafruit.com/blahaj-alarm.md)
- [Unicorn Hat with Moving Ears](https://learn.adafruit.com/unicorn-hat-with-moving-ears.md)
- [Mini Smart Home with Huzzah, HASSio and Crickit](https://learn.adafruit.com/mini-smart-home-with-esp8266-huzzah-feather-raspberry-pi-hassio-crickit.md)
- [Twinkly Earwarmer Headband](https://learn.adafruit.com/twinkly-ear-warmer.md)
- [Paper-Craft Crystal Gem Lantern](https://learn.adafruit.com/paper-craft-crystal-gem-lantern.md)
- [Color-sensor Driven NeoPixel Dress](https://learn.adafruit.com/color-sensor-driven-neopixel-dress.md)
- [LED Harness Bra](https://learn.adafruit.com/neopixel-led-harness-bra.md)
- [Adafruit AS7331 UV / UVA / UVB / UVC Sensor](https://learn.adafruit.com/adafruit-as7331-uv-uva-uvb-uvc-sensor.md)
- [Simple and Beautiful NeoPixel Holiday Lights](https://learn.adafruit.com/simple-beautiful-color-changing-light-strand.md)
