# Wireless Music Veto Button for your Office

## Overview and Parts List

![](https://cdn-learn.adafruit.com/assets/assets/000/015/404/medium800/adafruit_products_title.jpg?1394939871)

How many times have you suffered at the hand of your co-worker that plays Spotify radio in the office? Wouldn't it be great if you could simply veto their song that's playing and go on to the next?   
  
This project creates a wireless veto button for music. The button is self-powered and can be recharged using a standard USB cable. Simply pair the Bluefruit EZ-Key to the computer playing the music, configure the software and you're all set to "cast your vote" and skip to the next song.  
  
This project is specific for the Mac (because of AppleScript's ability to control apps) but could be translated to work with Windows if your music app can listen to media-control keypresses (like 'fast forward')

![](https://cdn-learn.adafruit.com/assets/assets/000/015/372/medium800/adafruit_products_vetomusic-parts.jpg?1394926112)

## Parts List
For this project, you'll need  

- [Massive Arcade Button](https://www.adafruit.com/products/1185)
- [Adafruit Bluefruit EZ-Key](https://www.adafruit.com/products/1535)
- [Break-away right-angle male headers](http://www.adafruit.com/product/1540)
- [Jumper Wires](http://www.adafruit.com/product/825)
- [USB Lithium Ion charger](http://www.adafruit.com/product/259)
- [Lithium Ion Battery](http://www.adafruit.com/product/258)
- [Panel mount USB cable (B female to Mini-B male)](http://www.adafruit.com/product/936)  
- [USB cable (standard A-B)](http://www.adafruit.com/products/62)  
- Suitable box or case (I used a sturdy white cardboard box)
- Double sided foam tape  

If you want to skip the re-chargeable battery, you can simply use the [3xAAA battery case](http://www.adafruit.com/product/727) (omit the battery, charger and USB cables).  
# Wireless Music Veto Button for your Office

## Prepare the Box

## Cut the openings
You'll need to make a couple of openings in your box to accommodate the button and the USB charging port.  
  
The massive arcade button needs a 1" circular hole cut. Measure to find the center line of your box. Using a step drill bit, drill down until you reach 1".

![adafruit_products_vetomusic-measure_box.jpg](https://cdn-learn.adafruit.com/assets/assets/000/015/374/medium640/adafruit_products_vetomusic-measure_box.jpg?1394926500)

![adafruit_products_vetomusic-drillhole1.jpg](https://cdn-learn.adafruit.com/assets/assets/000/015/375/medium640/adafruit_products_vetomusic-drillhole1.jpg?1394927121)

![adafruit_products_vetomusic-drillhole2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/015/376/medium640/adafruit_products_vetomusic-drillhole2.jpg?1394927140)

Now drill the hole for the USB port, locating it on the back, lower right of the box using a 1/2" circular hole. Next, drill the two holes for the mounting ears that hold the USB port in place. The mounting ear holes are ~28.5mm apart.  
  
The easiest way is to place the port on the outside and plug in a USB cable from the inside to hold it in place. Use a pencil to mark the centers of the two screw holes. Drill both holes using a 1/8" drill bit.  
  
Attach the USB port to the box using the two screws.

![adafruit_products_vetomusic-drillusb1.jpg](https://cdn-learn.adafruit.com/assets/assets/000/015/378/medium640/adafruit_products_vetomusic-drillusb1.jpg?1394928437)

![adafruit_products_vetomusic-drillusb2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/015/379/medium640/adafruit_products_vetomusic-drillusb2.jpg?1394928452)

![adafruit_products_vetomusic-drillusb3.jpg](https://cdn-learn.adafruit.com/assets/assets/000/015/380/medium640/adafruit_products_vetomusic-drillusb3.jpg?1394928468)

![adafruit_products_vetomusic-drillusb5.jpg](https://cdn-learn.adafruit.com/assets/assets/000/015/382/medium640/adafruit_products_vetomusic-drillusb5.jpg?1394928501)

![adafruit_products_vetomusic-drillusb7.jpg](https://cdn-learn.adafruit.com/assets/assets/000/015/387/medium640/adafruit_products_vetomusic-drillusb7.jpg?1394931315)

Next, install the massive arcade button on the top of the box. Remove the white plastic locking nut on the bottom of the button. Place the button through the hole and tighten the locking nut from below.  
  
For now, leave the switch and LED assembly out to make it easier to work on.

![adafruit_products_vetomusic-installbutton1.jpg](https://cdn-learn.adafruit.com/assets/assets/000/015/384/medium640/adafruit_products_vetomusic-installbutton1.jpg?1394928742)

![adafruit_products_vetomusic-installbutton2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/015/385/medium640/adafruit_products_vetomusic-installbutton2.jpg?1394928979)

# Wireless Music Veto Button for your Office

## Wiring and Assembly

## EZ-Key Headers
Count two sets of 12 right angle headers and break them away. Insert the headers into the EZ-Key from the top as shown and secure them with a piece of masking tape. Secure the board into a holder and begin soldering all 24 connections.  
  
I prefer to add headers to the EZ-Key because it makes it very easy later to disassemble the unit should I want to make changes or use it in another project.![adafruit_products_vetomusic-solder_ezkey1.jpg](https://cdn-learn.adafruit.com/assets/assets/000/015/388/medium640/adafruit_products_vetomusic-solder_ezkey1.jpg?1394935422)

![adafruit_products_vetomusic-solder_ezkey2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/015/389/medium640/adafruit_products_vetomusic-solder_ezkey2.jpg?1394935442)

## Jumper Wires
Pull four jumpers away from the bunch. The colors don't matter as long as you make the right connections. Snip the male leads off of all four jumpers (we won't use them). Strip about 1/8" of insulation away from the cut end and twist the bare ends.  
  
Two leads will connect the EZ-Key to the charge controller and two will connect the button to the EZ-Key.  
![adafruit_products_vetomusic-jumper_wires.jpg](https://cdn-learn.adafruit.com/assets/assets/000/015/390/medium640/adafruit_products_vetomusic-jumper_wires.jpg?1394935484)

## Charge Controller Jumpers
The EZ-Key will be powered from the charge controller. Take two of the jumper wires and solder them to the two holes labeled "LOAD" as pictured.  
![adafruit_products_vetomusic-charge_control1.jpg](https://cdn-learn.adafruit.com/assets/assets/000/015/391/medium640/adafruit_products_vetomusic-charge_control1.jpg?1394935540)

![adafruit_products_vetomusic-charge_control2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/015/392/medium640/adafruit_products_vetomusic-charge_control2.jpg?1394935555)

## Arcade Microswitch Jumpers
The massive arcade button includes a standard microswitch. The switch type is a "NO" which means "normally open." Pushing the button will cause the two jumpers to become connected. This is what triggers the EZ-Key to send a key press.  
  
Take other two jumper wires and solder one to each of the terminals. It doesn't matter which one goes where.  
  
Snap the microswitch into the button assembly along with the included LED. We won't be connecting the LED in this project, but install it for safe keeping.  
  
Insert the button assembly into the massive red button from inside the box. Insert it and twist to lock. Once it's in, you should hear a distinctive click when you press on the red dome.  
![adafruit_products_vetomusic-switch1.jpg](https://cdn-learn.adafruit.com/assets/assets/000/015/393/medium640/adafruit_products_vetomusic-switch1.jpg?1394935584)

![adafruit_products_vetomusic-switch2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/015/394/medium640/adafruit_products_vetomusic-switch2.jpg?1394935600)

![adafruit_products_vetomusic-switch3.jpg](https://cdn-learn.adafruit.com/assets/assets/000/015/395/medium640/adafruit_products_vetomusic-switch3.jpg?1394935616)

## Dry Test
![](https://cdn-learn.adafruit.com/assets/assets/000/015/397/medium800/adafruit_products_vetomusic-test_connections.jpg?1394935710)

Let's test to make sure we're getting power from the battery through the charge controller to the EZ-Key.  
  
Connect the jumpers from the charge controller labeled "LOAD" to the EZ-Key. Connect plus (+) to "VIN" on the EZ-Key and the minus (-) to "G" on the EZ-Key.

Info: 

Plug in the JST connector from the battery to the charge controller labeled "BATT."  
  
The red light on the EZ-Key should now begin blinking. If so, congratulations! If it doesn't light, the battery may not have enough power. See the step below to charge the battery first before assembling.

## Assemble
Cut short pieces of double-sided foam tape and stick it to the back of the battery, charge controller and EZ-Key. Remove the backing and stick the three inside the box in close proximity. Connect the battery and EZ-Key to the charge controller as in the dry test above.  
  
Attach the button jumpers to the EZ-Key. One lead will go to pin 0 and the other will go to any of the leads marked "Grounds."![adafruit_products_vetomusic-foam_tape.jpg](https://cdn-learn.adafruit.com/assets/assets/000/015/400/medium640/adafruit_products_vetomusic-foam_tape.jpg?1394936079)

![adafruit_products_vetomusic-install2.jpg](https://cdn-learn.adafruit.com/assets/assets/000/015/401/medium640/adafruit_products_vetomusic-install2.jpg?1394936105)

![adafruit_products_vetomusic-install1.jpg](https://cdn-learn.adafruit.com/assets/assets/000/015/402/medium640/adafruit_products_vetomusic-install1.jpg?1394936119)

## Charge the Battery
Charge the battery by connecting it to USB via the port on the rear. The yellow "CHRG" LED will light up. When the charge is complete, the green "DONE" LED will light up. You can unplug the veto button and move it anywhere in your office (within it's range).  
# Wireless Music Veto Button for your Office

## Configure the EZ-Key

## Pairing EZ-Key
Before we can configure the Bluefruit EZ-Key, we must first pair it with your computer. Follow the [instructions for pairing in the Bluefruit EZ-Key guide](http://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetooth-hid-keyboard/pairing-to-bluefruit "Link: http://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetooth-hid-keyboard/pairing-to-bluefruit").  
  
[Bluefruit EZ-Key Paring Guide](http://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetooth-hid-keyboard/pairing-to-bluefruit)
## Output Key Remapping
The Bluefruit EZ-Key comes with 12 key presses pre-configured.  

- #0 - Up Arrow
- #1 - Down Arrow
- #2 - Left Arrow
- #3 - Right Arrow
- etc..

None of these will work for us since they're common keys that we can't assign to a global hot key. Therefore, we need to reconfigure the mapping. Follow the instructions for [changing the stored key presses in the EZ-Key in the Bluefruit EZ-Key Guide](http://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetooth-hid-keyboard/remapping-the-buttons-wireless). Reconfigure output #0 since that's what we've wired to the button. In my case, I chose F3 as my global hot key.  
[Bluefruit EZ-Key Wireless Key Remapping](http://learn.adafruit.com/introducing-bluefruit-ez-key-diy-bluetooth-hid-keyboard/remapping-the-buttons-wireless)
Remember the hot key you choose, you'll need it in the next step.

# Wireless Music Veto Button for your Office

## Configure the Hot Key

## AppleScript
Now we need to get the key press that will be coming from the Bluefruit EZ-Key over Bluetooth connected to an action on your computer. We'll do this through a combination of AppleScript and a program called QuickSilver to bind that script to a key press that works regardless of which program is in focus.  
  
Open AppleScript Editor and paste in the following line into a new document.  
```auto
tell application "Spotify" to next track
```

![](https://cdn-learn.adafruit.com/assets/assets/000/014/756/medium800/adafruit_products_vetomusic-applescript_next_track.png?1393970937)

You can test this script by clicking the "Play" icon at the top. If Spotify is already open and playing a song, it should skip to the next song. If it's open but not playing, it will begin playing the next track. If Spotify isn't open, it will open the application.  
  
Save this AppleScript to a location you can find again (your Documents folder is a good location). The file format should be "Script."

## Quicksilver
Next, we go to QuickSilver. It's main use is a hyper fast application launcher that puts Spotlight to shame. We'll be using it in this case for it's "Triggers" feature.  
  
[If you haven't already, install the latest QuickSilver](http://qsapp.com/ "Link: http://qsapp.com/") on your Mac. When ready, you should have a new menu bar item at the top near the right. Click it and choose "Triggers.."  
![](https://cdn-learn.adafruit.com/assets/assets/000/014/752/medium800/adafruit_products_vetomusic-quicksilver_menu.png?1393970518)

Click the "+" at the bottom of the window and choose "HotKey".

![](https://cdn-learn.adafruit.com/assets/assets/000/014/753/medium800/adafruit_products_vetomusic-quicksilver_triggers1.png?1393970755)

In the box under "Select an item," drag and drop the new AppleScript you wrote into the space. The action will change automatically to "Run an AppleScript." Click "Save."

![](https://cdn-learn.adafruit.com/assets/assets/000/014/754/medium800/adafruit_products_vetomusic-quicksilver_triggers3.png?1393970793)

Now to assign the hot key. Click "None" under Trigger to reveal the Settings pane. Click inside the box next to "Hot Key." The words "Set Keys" should now be pulsing. Select your keystroke you programmed into the EZ-Key. In my case, it was F3.

![](https://cdn-learn.adafruit.com/assets/assets/000/014/755/medium800/adafruit_products_vetomusic-quicksilver_triggers4.png?1393970832)

Close the triggers window. You should now be able to test the operation from your keyboard. Press your chosen hot key. If Spotify is already open and playing a song, it should skip to the next song. If it's open but not playing, it will begin playing the next track. If Spotify isn't open, it will open the application.  
  
If it doesn't work, first check the hot key settings inside QuickSilver's Triggers window.

Info: 

## What about Windows?
The project could be translated to Windows given the appropriate software to map a global hot key to an event.  
# Wireless Music Veto Button for your Office

## Use it!

![](https://cdn-learn.adafruit.com/assets/assets/000/015/386/medium800/adafruit_products_vetomusic-useit1.jpg?1394929083)

Get ready to cast your veto!  
  
If music is playing and you press the button, it should skip to the next track.  
  
If no music is playing and you press the button, it should begin playing.  
  
If Spotify isn't open and you press the button, it should launch the app. Press the button again and it will begin playing.  
  
Charge the battery every few days (it should last about 3 days on a full charge)

## Improvements and Enhancements
There are a couple of ways you can build on this project. Since there are 11 unused output pins on the EZ-Key you can add a few more smaller buttons that perform other tasks like volume, muting, pause, etc. You can also add LED charge indicator lights to the outside by connecting them to the charge controller "STAT" area.  
  
Want to control iTunes instead? It's as simple as changing your AppleScript as follows.  
  
```auto
tell application "iTunes" to next track
```

Program the AppleScript to perform any number of actions on your computer like opening a new web browser, turning the page of an e-book, or even shutdown your computer!


## Featured Products

### Massive Arcade Button with LED - 100mm Red

[Massive Arcade Button with LED - 100mm Red](https://www.adafruit.com/product/1185)
OMG WATCH OUT! This 100mm diameter arcade button with a **10mm deep plastic base** is so massive and inviting it may collapse upon itself and form a black hole from which not even light can escape! Until it does, however, it ready for all sorts of pressing and pushing. Science...

In Stock
[Buy Now](https://www.adafruit.com/product/1185)
[Related Guides to the Product](https://learn.adafruit.com/products/1185/guides)
### Bluefruit EZ-Key - 12 Input Bluetooth HID Keyboard Controller

[Bluefruit EZ-Key - 12 Input Bluetooth HID Keyboard Controller](https://www.adafruit.com/product/1535)
Create your own wireless Bluetooth keyboard controller in an hour with the Bluefruit EZ-Key: it's the fastest, easiest and bestest Bluetooth controller. We spent years learning how to develop our own custom Bluetooth firmware, and coupled with our own BT module hardware, we've created...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/1535)
[Related Guides to the Product](https://learn.adafruit.com/products/1535/guides)
### Break-away 0.1" 36-pin strip right-angle male header (10 pack)

[Break-away 0.1" 36-pin strip right-angle male header (10 pack)](https://www.adafruit.com/product/1540)
Breakaway header is like the duct tape of electronics. Its great for connecting things together, soldering to perf-boards, fits into any breadboard, etc. We go through these guys real fast, and thought that given how handy they are, we'd offer them in a pack of ten!  
  
Each pack...

In Stock
[Buy Now](https://www.adafruit.com/product/1540)
[Related Guides to the Product](https://learn.adafruit.com/products/1540/guides)
### Premium Female/Male 'Extension' Jumper Wires - 40 x 3" (75mm)

[Premium Female/Male 'Extension' Jumper Wires - 40 x 3" (75mm)](https://www.adafruit.com/product/825)
Handy for making wire harnesses or jumpering between headers on PCB's. These premium jumper wires are approximately 3" (75mm) long and come in a 'strip' of 40 (4 pieces of each of ten rainbow colors). They have 0.1" male header contacts on one end and 0.1" female...

In Stock
[Buy Now](https://www.adafruit.com/product/825)
[Related Guides to the Product](https://learn.adafruit.com/products/825/guides)
### USB LiIon/LiPoly charger

[USB LiIon/LiPoly charger](https://www.adafruit.com/product/259)
This is a Lithium Ion and Lithium Polymer battery charger based on the [MCP73833](http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en027785). It uses a USB mini-B for connection to any computer or 'USB wall adapter'. Charging is performed in three stages: first a...

Out of Stock
[Buy Now](https://www.adafruit.com/product/259)
[Related Guides to the Product](https://learn.adafruit.com/products/259/guides)
### Lithium Ion Polymer Battery - 3.7v 1200mAh

[Lithium Ion Polymer Battery - 3.7v 1200mAh](https://www.adafruit.com/product/258)
Lithium-ion polymer (also known as 'lipo' or 'lipoly') batteries are thin, light, and powerful. The output ranges from 4.2V when completely charged to 3.7V. This battery has a capacity of 1200mAh for a total of about 4.5 Wh. If you need a larger battery, <a...></a...>

Out of Stock
[Buy Now](https://www.adafruit.com/product/258)
[Related Guides to the Product](https://learn.adafruit.com/products/258/guides)
### Panel Mount USB Cable - B Female to Mini-B Male

[Panel Mount USB Cable - B Female to Mini-B Male](https://www.adafruit.com/product/936)
This handy USB extension cable will make it easy for you to enclose a device that has a mini-B USB type port. We think this would be most handy when putting a Teensy, FTDI friend, USB LiPo charger, USB Boarduino, etc into a box!  
  
The jack half has two mounting 'ears' with M3...

In Stock
[Buy Now](https://www.adafruit.com/product/936)
[Related Guides to the Product](https://learn.adafruit.com/products/936/guides)
### USB Cable - Standard A-B

[USB Cable - Standard A-B](https://www.adafruit.com/product/62)
This here is your standard A-B USB cable, for USB 1.1 or 2.0. Perfect for connecting a PC to your Arduino, USBtinyISP (among other things).  
  
3 feet / 1 meter long  
  
Color may vary!

In Stock
[Buy Now](https://www.adafruit.com/product/62)
[Related Guides to the Product](https://learn.adafruit.com/products/62/guides)

## Related Guides

- [Convert your Model M Keyboard to Bluetooth with Bluefruit EZ-Key HID](https://learn.adafruit.com/convert-your-model-m-keyboard-to-bluetooth-with-bluefruit-ez-key-hid.md)
- [Multi-Cell LiPo Charging](https://learn.adafruit.com/multi-cell-lipo-charging.md)
- [Li-Ion & LiPoly Batteries](https://learn.adafruit.com/li-ion-and-lipoly-batteries.md)
- [Color Remote with Circuit Playground Bluefruit](https://learn.adafruit.com/color-remote-with-circuit-playground-bluefruit.md)
- [LED Ampli-Tie](https://learn.adafruit.com/led-ampli-tie.md)
- [Flora-Powered TARDIS Costume (for Dogs!)](https://learn.adafruit.com/wearable-flora-powered-tardis-costume-dogs.md)
- [Trinket Bluetooth Alarm System](https://learn.adafruit.com/trinket-bluetooth-alarm-system.md)
- [3D Printed Camera LED Ring](https://learn.adafruit.com/3d-printed-camera-led-ring.md)
- [Color-sensor Driven NeoPixel Dress](https://learn.adafruit.com/color-sensor-driven-neopixel-dress.md)
- [SnapPiCam Raspberry Pi Camera](https://learn.adafruit.com/snappicam-raspberry-pi-camera.md)
- [8BitBox](https://learn.adafruit.com/8bitbox.md)
- [DIY Wireless DDR Dance Pad with Bluefruit EZ-Key](https://learn.adafruit.com/diy-wireless-ddr-dance-pad-bluefruit-ez-key.md)
- [Introducing Circuit Playground](https://learn.adafruit.com/introducing-circuit-playground.md)
- [Adafruit Feather 32u4 with LoRa Radio Module](https://learn.adafruit.com/adafruit-feather-32u4-radio-with-lora-radio-module.md)
- [Adafruit STEMMA Reflective Photo Interrupt Sensor](https://learn.adafruit.com/adafruit-stemma-reflective-photo-interrupt-sensor.md)
