Introduction: 7-Key Slider/Wheel Tutorial With Synthesizer
This is a tutorial for using the 7-Key Slider/Wheel Breakout from Rachel's Electronics.
I'll show you how to solder up the header pins for maximum usability. Rachel's has the QT1106 datasheet on their site, and a great arduino library for this breakout.
The kit from Rachel's Electronics comes packed with cool stuff:
QT1106 breakout with header pins
Slider Module with header pins
Wheel Module with header pins
1 3-position 12" jumper cable
2 4-position 12" jumper cables
10" of pre-tinned conductive tape
Our project will build a 7 touch key synthesizer and the slider will select different musical keys to play in. Links to libraries are included, and working code examples for testing your work and the final synth player as well. Let's get started!
Step 1: Soldering the Top Header Pins
We will be soldering the header pins in two steps:
- First, the pins on the top side that connect to the jumper cables.
- Then the pins on the bottom side that go into your breadboard.
Cut the header pins into sections. I find that using a wire snip is the best method.
The two header rows that come in the kit have 9 pins. Break one into two sections: 2-pins and 7-pins. These will go on the left side of the board. Now break the other row into 3 sections one 5-pin, one 3-pin, and one lonely single pin.
Now we're ready to setup and solder the headers onto the breakout. We will do this in two stages, The first stage will flip the board upside down and solder the top pins in place. The 7-pin row goes into the holes labeled KEY1,KEY2, KEY3, KEY4, KEY5, KEY6, KEY7, and the 3-pin row into the holes labeled SNSA1,SNSA2,SNSA3.
The best way to solder in header pins is to put the pins into a breadboard first, then you can drop the board on and you'll know the parts are all lined up nicely. Check the pictures below to see how the pins get laid out for this first step. Then place the breakout upside-down onto the pins as shown.
- Make sure to examine the pictures closely so you get it right!
Remember that the breakout gets placed upside-down in this step. Warm up your iron and solder those headers! I have pics below of the finished solder points for you to follow.
Pull the breakout out of your breadboard very carefully. Rocking it back and forth slightly can help ease it off. Now take that length of insulation that you stripped off to make the GND pin and cut two tiny pieces that will serve to insulate either side of our GND pin.
Great! on to the next step.
Step 2: Soldering the Bottom Header Pins
Soldering the bottom pins next.
Again, it is easiest to place the header pins into your breadboard first. And because this is the last soldering step on the breakout, I'm putting the pins right where I want my breakout to be in the final circuit. Note in the pictures how I'm arranging my headers. I have two images that show the finished breakout from each side, so you can see how they are all arranged.
Maybe there is something cool that can be done with the lonely header pin that is left???
Step 3: Lashing the Breakout to the Arduino
These are the pin connections that we need to make for SPI:
- Pin Name Breakout Arduino
- SCLK 11 Digital 13
- SS 12 Digital 10
- MOSI 13 Digital 11
MISO 14 Digital 12
There are also two pins used for something called 'Handshaking' where each device confirms that they are ready to communicate. The pin connections are:
- Pin Name Breakout Arduino
- DRDY 10 Digital 9
- CHNG 2 Digital 8
When the QT1106 decides that a sense event has occurred (touch, release, or slider movement), it sets the CHNG pin HIGH. This signals the Arduino that it should ask for new key and slider data via the SPI interface. When the Arduino starts the SPI, it first has to wait for the DRDY pin to go HIGH, otherwise, the QT1106 will miss all or a part of the communication. ALL OF THIS IS TAKEN CARE OF IN THE LIBRARY! THE LIBRARY WORKS HARD... SO YOU DON'T HAVE TO!
The last thing that you need to do is drop a couple of caps across the rails. These are Power supply conditioning capacitors, and they should be placed right next to the breakout +V and GND pins. I'm using 1uF, but 2.2uF will work just as well. If you don't have these in place, your sensor will go a little crazy and spit out a lot of noise and spurious touch signals!
Step 4: Setting Up the Speaker
- Use stranded wire. Please. Nothing is as sad as a finished project that quits working because one wire broke. Electronics connections that are expected to move around are made with stranded wire because it has a much longer bend life that solid wire.
- Pre-tinning is simply the process of applying some solder to a part or lead or bit of wire prior to making a connection. Hold the tip of your iron on the stranded wire end, and as it comes to temperature, put some solder there. Not too much!
- Once you have the pads on your speaker connections and the ends of your stranded wire tinned, it's time to make the connection. Hold the wire up to the speaker connection and cut off any excess wire. You don't want to accidentally short your signal against the body of the speaker. If your cut removes your pre-tinning, you didn't tin enough. Do it again.
- Now you can hold the wire in one hand, and press the two pre-tinned parts together with your soldering iron. Once the parts melt together, remove the iron, and hold the wire still until everything solidifies.
Step 5: Lashing the Speaker to the Arduino
- It turns out that you can indeed output up to 3 separate tones on an Arduino with this library. However, the 3rd tone instance is driven by Timer0, a hardware timer, that is used by Arduino to make millis() happen. Timer0 also makes delay() possible, and so when you incorporate the 3rd tone, you get hung up when you try to delay(). I like to delay() and I know you do too. So, this synth will let you play 2 note chords, and still let you delay() Yipee!
The Tone library lets you out put audio frequency on any digital pin. I'm using digitalPin 2 and digitalPin 3 for my audio output. Many tutorials will tell you to put a resistor between the digitalPin and one wire of the speaker. This works well to control the volume level. I'm using 1K resistors here. If you use 100ohm resistors, it will be very loud indeed!
The other wire is often connected directly to GND. I don't want you to do that any more. I want you to put an electrolytic capacitor between the speaker and GND. The value of your capacitor should be 4.7uF or 10uF. Your choice. This is called an AC coupling capacitor. It will protect your speaker from DC current that could damage it, and allows the AC audio signal to get through. Trust me, it's better.
Step 6: Key Pad and Wheel Layout
OK, So I went and bought a small acrylic cube box at the container store. The first thing to do will be to arrange my parts to make sure they fit nicely in the box, and then drill some holes. I want a hole for the power switch on the battery case, a hole for the pins on the Wheel module, and a handful of holes for the speaker.
First, I'll arrange my Keys and Wheel module so that I know they will fit well on the lid, which will be my touch interface. Then, I'll make a hole in the lid of the box so that I can mount the Wheel module on the outside.(I could just as easily put it inside, and mount it with some tape or glue, but I like the look of having it on the outside). I want to make sure that the wheel will fit with my touch keys. I'm cutting some squares of the pre-tined copper tape that comes in the kit from Rachel's Electronics. Designing touch keys is very forgiving. The key can be as small as 1/4" square or round. And the spacing between keys can be very close. Keys can be ring shaped, with an LED in the middle for backlighting. Check out the datasheet for the QT1106, and also this handy application guide for more info. Copper tape is cheap, so it's easy to experiment if you have a specific design in mind!
- NOTE: you can use aluminum ducting tape that you find at the hardware store, but it is not solderable. If you use that, you will need to tape the wire ends to your electrodes. This works just fine too!
The breadboard and battery pack fit nicely at the bottom of the box, so I will drill a hole in the bottom that lines up with the switch on my battery pack. The battery pack will be taped or glued to the box, so make sure that you have enough room to open it to change the battery when it runs out!
I'm using a 3/8" drill bit that is designed to drill through plastic without cracking. (McMaster Carr part number 27465A94, and here's some good bla-de-bla on the subject of drill bits for plastic). Whenever I'm drilling a large hole (larger than 1/4" is large) I first drill a pilot hole. This will help me get everything lined up right, and also reduce chipping when I use the larger drill bit. Use a 1/4" or 3/16" bit as a pilot for this 3/8" hole. I drilled these holes with a cordless hand drill.
The Speaker will be glued to the inside of one of the sides. Make sure that it will fit there with the breadboard and the battery pack nicely. I'm using a 3/8" bit and making 7 holes.
Step 7: Soldering the Wheel
Solder the header pins to the Wheel as shown in the image below.
Step 8: Placing and Soldering the Key Pads
- The metal will deform when you bend it and keep its shape
- The paper backing will not keep its shape after you bend it
Stick your keypads down on the INSIDE of the box lid.
Preparing the Cables
Cut about 2" off of the jumper cables that came in your kit. [Link to key layout tutorial that doesn't involve cutting your jumpers coming here soon]. Snip the webbing between the individual wires on the ribbon cable, and peel them back so that they can reach the keys you want to connect to. Don't pull the wires out too far! If you do you will have lots of spaghetti wires in you box and get crazy signals! You may find that one or more of your wires ends up being long for the connection you want to make (see last picture below). It's best to trim it to the correct length, so that you don't get unwanted signals from the sensor.
Now heat up your soldering iron! Melt a small blob of solder to the middle of your copper tape key. Make sure to do this quickly and keep your iron cool, if you can control the temperature, so that you don't melt the plastic lid!
Then connect the wires to the keys. There are 7 keys, and I am using the RED wires from each jumper to keep my keys in order.
- Key 1 (RED)
- Key 2
- Key 3
- Key 4
- Key 5
- Key 6
- Key 7 (RED)
Step 9: Final Setup and Testing
Plug the 4-position cable that you didn't cut onto the header pins of the Wheel Module. Note that the Wheel only has 3 pins! Connect the header so that the RED wire is not being used. The other end of the cable should plug into pins 15,16,17,18 with the RED wire going to pin 18. (see picture below).
Cables from the Keys should connect so that the RED wire of the 3-position cable goes to pin 3 (Key 1) and the RED wire of the 4-position cable goes to pin 9 (Key 7).
Double check that you've got the speaker hooked up and the two power-line filter capacitors are installed next to the +V and GND pins of the breakout.
TESTING YOUR SETUP
Now it's time to connect the FTDI cable and upload the test code to make sure you have all of your connections right. If you are using the FTDI cable from adafruit mentioned in the beginning of this tutorial, and you're running Windows, you may need to make this adjustment (scroll down to the 'Arduino Compatibility section. Thanks LadyAda!) to ensure the Ardweeny gets reset automatically if you haven't already. If you are using the FTDI breakout that Soarbotics sells, you should check with their website if you have any uploading issues.
- Download the 7_Key_Slider library from Rachel's Electronics (7K zip)
- Unzip the file and save it to Documents/Arduino/Libraries/ folder (make the Libraries folder if you don't have one already)
- In the arduino IDE, go to Sketchbook/Libraries/QT1106/Default_Example and run the example code there with the Serial Monitor turned on and see that the keys and slider are all responsive.
Does it not work? Double check your connections on the breadboard, and make sure you're able to upload correctly by programming a simple blink code. If you are still having trouble getting key and wheel data out of the sensor, you can email support(at)rachelselectronics(dot)com for help.
Step 10: Music Wheel
The Music Wheel code for arduino is available here. Upload it and test to see if it works. You should be getting the same results as shown in the video here and on the first page of this instructable.
I attached the breadboard and battery pack to the bottom of the box with double-sided tape. The Speaker is attached with two tiny blobs of hot glue.
It's ok if your cables are bunched up abit inside the box. The Sensor is re-calibrated every time it get's turned on, and every time the Arduino re-starts. As long as the wires don't move around while it's on, it should remain very stable.
Have fun with your synthesizer!