Hello. I created this DIY Launchapd for my university robotics class and through this instructable I will teach you how to make one just like it. The idea behind this project was to utilize serial communication and processing in order to play audio samples on button touch.
This tutorial will walk you through the construction, programming and operation of this DIY launchpad.
Step 1: Materials and Tools
Here is a list of the tools that I utilized to make this project happen. I will include links to some of the specific products that I used, but they are not necessary and can be interchanged with equivalent products.
- Soldering Iron
- Wire cutters
- Wire Strippers
- Arduino Uno (Genuino Uno)
- 1k potentiometer (2)
- PCB Board
- Male Headers
- Shift Register
- Tactile Push Buttons
- 10k ohm resistors
- Foam Core (Available at most craft stores)
- Leds (I used the ones from my Arduino Starter kit)
Step 2: Construction (1 of 6)
Tactile Button Utilization
The first step in constructing your launchpad is to ensure you understand the mechanics of the tactile push buttons. The way they work is that when the button is not pressed current flows between pins on a side, but not in between sides. After pressing the button current can freely travel between the two sides of the button. So the wire carrying current (Arduino Output) is soldered to a pin, the pin that is always connected to it is soldered to a 10k ohm pull down resistor. Then the pin that is only connected upon button press is soldered to a separate wire that will serve as the Arduino input.
Step 3: Construction (2 of 6)
Button Matrix Utilization
In order to maximize the number of buttons that can be supported by the limited number of pins on an Arduino Uno, I utilized a button Matrix. This works by powering all buttons in a specific column through a single pin (output), and reading all button values of a row to a single pin (Input). In my implementation this allowed the support of 12 buttons while only utilizing 7 pins (4 columns, 3 rows). This could be increased by increasing either the number of columns or rows, depending on the number of pins your specific Arduino supports.
The way this works is the first column is powered while the remaining columns are not. While the first column is powered each row is read for to determine whether any of the buttons in that specific column are pressed. After reading each row the first column is turned off and the second row is powered and so on. Above you can find an fritzig diagram representing the wiring required for the matrix (Found on https://paulbleisch.com/2015/01/19/custom-arduino-membrane-keypad/) as well as my implementation.
Step 4: Construction (3 of 6)
This was my first experience with soldering, so forgive the sloppiness of my soldering. The way in which I went about soldering these pieces together was as follows:
- Determine the preferred spacing between buttons, making special note of the orientation of the button so connected pins were in the correct position, then solder them to the pcb board.
- Solder a wire between the input pin of each button in a column, repeat for each column.
- Solder a 10k ohm resistor to the pin always connected to the power pin of each button.
- Solder wires connecting the resistors from each button to create a single ground line.
- Then solder a wire connecting a pin on the opposite side from the power and ground of each button in a specific row.
- Each row and column had a wire that extended off the board that was soldered to a male header, to allow connection to the arduino.
Step 5: Construction (4 of 6)
Potentiometers and Shift Register
Potentiometer: Continuing with our theme of maximizing the usage of pins we are wiring two potenitometers while only requiring the use of 4(3) pins. The potentiometers have 3 pins, one is for voltage, one is for ground, and one is for data. Refer to the spec sheet of the specific potentiometer that you use to determine which pin is which. In order to obtain readings from each of the potentiometers power is run from a single pin to both potentiometers, both ground pins are connected by a wire and then can be connected to a currently existing ground line either from the shift register or from the button matrix and finally a line from each data pin to an analog pin on the arduino.
Shift Register: I used the shift register to display the current settings of the potentiometers. In order to properly connect the shift register I followed the following tutorial https://www.arduino.cc/en/Tutorial/ShiftOut. I then utilized bitmasks to control which output pins on the shift register received power. Output pins of the shift register were soldered to an led's anodes and then the leds cathode was soldered to a 220 ohm resistor which was then connected to a ground line.
The use of a shift register could be altered to provide an led for each button by utilizing daisy chained shift registers to increase the number of outputs, without increasing the pin usage on the Arduino. I did not have a chance to complete this myself and plan to do so on a future iteration of this project.
Step 6: Construction (5 of 6)
After completing the soldering of each component the male headers are inserted into the Arduino. Placement of these headers into pins can be arbitrary as long as you alter the code to account for this. The only requirements being that the data pins from the potentiometers should be placed into one of the analog pins and the ground in the ground pins.
Step 7: Construction (6 of 6)
All that is left in the construction is building a case to hold the components. This step is based on preference... I will let you know how I made mine, but feel free to experiment.
1. Measure the size of your pcbs and Arduino, build a base that can accommodate them both. I used foam core, but you can use a similar material or a more permenant one.
2. Create walls that rise above the tactile buttons on one side and above the potentiometers on the other. Be sure to create holes for both potentiometers and the arduino usb port.
3. Place holes in the base in order to secure the pcbs and Arduino (I used toothpicks). Create a top level to cover both sides. Measure out the positions of the tactile buttons and cut holes in the top level.
4. Create small buttons to cover the holes you created in the previous layer.
5. Tape, glue whatever you have lying around and you're all finished.
Step 8: Code (Arduino and Processing)
In order to run the launchpad there are two programs.
- The Arduino sketch to be uploaded to the arduino.
- The processing sketch that will be run on a computer attached via usb to the Arduino.
Arduino Sketch (PresentationSketch.ino attached)
This is the code that is uploaded to the Arduino.
Processing Code (LaunchpadSketch.pde attached)
In order to facilitate our code we must utilize two different libraries.
Processing.serial: for more information about processing and how to facilitate communication between Arduino and Processing refer to https://learn.sparkfun.com/tutorials/connecting-ar...
Minim: This is the library that supports the audio player for more information about the supported features and how it works refer to http://code.compartmental.net/tools/minim/.
Here is a link from the processing wiki that walks through the installation of a library for processing. https://github.com/processing/processing/wiki/How-to-Install-a-Contributed-Library
Notes: After uploading the Arduino sketch be sure to close the Arduino IDE before starting the processing file. This is to ensure that the serial port is not utilized by the Arduino IDE.
Step 9: All Done
Here is a demonstration of the final product. I hope you enjoyed this tutorial.
As someone new to building things with Arduino/Soldering I would love any critiques, suggestions or questions about the final product.