GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||
GeezerVison is showing learn.sparkfun.com — SIK Keyboard Instrument - SparkFun Learn
≡ Pages
Contributors:
Share
Use this URL to share:
IntroductionThe SparkFun Inventor's Kit (SIK) is a great starting place for learning about electronics, programming, and physical computing. We can combine some of the concepts found in the SIK Guide to make our own projects. In this tutorial, we will make a keyboard using parts found in the SIK. We can use the Arduino to read the location of a touch on the soft potentiometer strip ("soft pot") and use that information to play a particular note from the buzzer. While it may be small, we can divide the soft pot into 8 segments. That's enough for a scale! In this case, we'll use the C major scale. Required MaterialsFrom the SIK, you will need: In addition, you will need a few tools:
Suggested ReadingBefore continuing with this project, we suggest you be familiar with a few concepts: Hardware HookupPrepare the BreadboardBefore connecting anything, we recommend separating the breadboard into its three parts. Use a pair of scissors to cut the adhesive backing. This part is optional, but it helps the breadboard fit into the project enclosure later. Connect the ComponentsOnce you are ready to connect the components, check out the Fritzing diagram below.
Having a hard time seeing the circuit? Click on the Fritzing diagram to see a bigger image.
Once you are done, the soft pot should be sticking straight up from the breadboard. Create the KeyboardThe "keyboard" is actually the soft potentiometer. We will divide up the soft pot into eight (8) segments, and the resistance we read with the Arduino from touching the soft pot will determine the key being pressed. To create something that looks like a keyboard, place a piece of masking tape over the soft pot so it covers the entire length with some overhand (we will use the overhang to attach the soft pot to the box). Place a ruler next to the touchable (silver) area on the soft pot. Starting from the breadboard end, mark every 6mm. Fill in or note that the first 6mm section is not to be used. Starting from the breadboard side, write the note of each key in between the marks. We'll use C, D, E, F, G, A, B, C. Make the Project BoxWhile we can play our keyboard on the breadboard, it might be more fun to have it in a project box to add a little stability. Peel the backing off the two pieces of the breadboard to which we attached components. Attach the large breadboard piece to the side of the cardboard box with the soft pot lying flat on the box's floor. Stick the smaller breadboard piece (the one with the buzzer) to the box's floor opposite the soft pot. Stick the overhang tape on the soft pot to the floor of the box. Fold a piece of tape over (into a loop), and stick it to the RedBoard. Place the RedBoard in between the soft pot and top breadboard piece. Use the scissors to remove the top of the box. Use the hobby knife to cut a hole in the side of the box so you can pass the USB cable through for power. Cut a large notch in the front of the box just above the keyboard. This allows for easier access to the keyboard. The CodeTo program the Arduino from your browser, select SparkFun RedBoard in the first drop-down menu in the window below, select the COM port associated with your RedBoard, and click Run on Arduino. Note: This example assumes you are using the latest version of the Arduino IDE on your desktop. If this is your first time using Arduino, please review our tutorial on installing the Arduino IDE. If you have not previously installed an Arduino library, please check out our installation guide.Copy the following code into the editor and click the Upload button.
Code to NoteWe combine the code from Part 10: Reading a Soft Potentiometer and Part 11: Using a Piezo Buzzer in the SIK Guide, and we recommend you read the "Code to Note" sections in each of those to understand how we are getting data from the soft pot as well as playing particular frequencies on the buzzer.
We pass the Since we divided up the soft pot's length into 6 mm segments, we also need to divide up the values we might receive from the soft pot. Let's say we touched the soft pot on the third segment (the one we labeled "E"), and the ADC value was 296 as a result. The first two What You Should SeeOnce you have uploaded the code to the RedBoard, try lightly pressing on the soft potentiometer. You should hear some musical notes from the speaker! Want to play a song? How about Twinkle, Twinkle, Little Star ('C' is the first 'C' on the left in this case): C, C, G, G, A, A, G (hold)
F, F, E, E, D, D, C (hold) What other songs can you play? Here are some ideas to get you started. TroubleshootingNo SoundGiven the size and shape of the piezo buzzer it is easy to miss the right holes on the breadboard. Try double checking its placement. Additionally, check the wiring for the soft pot. Can't Press More than One KeyThe soft potentiometer is incapable of detecting more than one press at a time. What happens if you try to press two keys at once? Resources and Going FurtherFor more information about the SIK Keyboard Instrument, check out the resources below: Taking the Next StepsNow that you've built your keyboard and had a chance to play a song, we can look at taking the project a bit further.
Other ProjectsNeed more inspiration for other Arduino-based projects? See these tutorials: Reaction Timer
Demonstrate mental chronometry with this simple reaction timer!
RedBoard Santa Trap
A fun holiday project to try for anyone looking to catch Santa on Christmas!
Alphanumeric GPS Wall Clock
This is a GPS controlled clock - a clock you truly never have to set! Using GPS and some formulas, we figure out what day of the week and if we are in or out of daylight savings time.
LED Cloud-Connected Cloud
Make an RGB colored cloud light! You can also control it from your phone, or hook up to the weather!
Share
Use this URL to share:
| ||
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |