Custom Audio Synthesizer
My name is David and I am a rising Junior at Trinity. At BlueStamp, I worked on an Audio Synthesizer based on this tutorial by fraganator, which is a device that can integrate with DJ software and control different functions. This project interested me because I enjoy listening to electronically-mixed music and also have a background in music from playing the piano and the cello. For the same reason, I chose the mini electric piano as my starter project. I wanted to learn how to design and create circuits, and I wanted to work with an Arduino for controlling my project.
Documentation:
Schematics:
–Top (For buttons and Potentiometers), Side(For USB Hole), Bottom(For Arduino Mount)
Code:
-My test code(Final Version, Test Version)
Software:
–Serial-Midi converter(plus setup instructions)
Final Project
My main project is now working! I have successfully connected my synthesizer to DJ software (Mixvibes Cross DJ) and mapped out commands to my controller so I can control the software. I used my sliders to control volume on individual decks, I used the knobs for controlling effects, and the buttons to activate cue points or locators.
This required me to set up some software on my computer for this to occur. First, I uploaded the code for the Arduino by fraganator. Then, I needed to create a virtual MIDI port on my computer. There was already an application called Audio MIDI Setup on my MacBook that I could use for this. In this application, I activated the IAC driver and created a custom MIDI port called MIDI INPUT. The other software I used was a Serial-MIDI converter, which converts the serial output from the Arduino to MIDI commands that can be read by Cross DJ. Initially, I downloaded a version of the software that was not compatible with the version of Java on my computer (vD), but a different version (vC) worked. In this converter, I selected the USB port connected to my arduino, the baud rate from my Arduino (115200bps), and selected my MIDI port “MIDI INPUT” as the input and output port. Once I did this, I knew it was working because the green lights in the bottom right corner of the program were flashing for each potentiometer and button, meaning that it was able to convert the serial signals to MIDI.
The final part of my project was to link my controller to commands in Cross DJ. In the program, I went to settings, MIDI, Selected my IAC Driver MIDI port, and created a new controller layout. This is what I ended up using for my demo.
—————————-
Slider 1: Volume A
Slider 2: Volume B
Knob 1: FX 1 Amount
Knob 2: FX 2 Amount
Knob 3: Volume C
Button 1: Cue A | Button 2: Cue B | Button 3: Cue C | Button 4: Cue All
Button 5: Locator 1A| Button 6: Locator 1B | Button 7: Locator 1C | Button 8: Play/Pause All
Button 9: Locator 2A| Button 10: Locator 3A| Button 11: Locator 2C | Button 12: Record
—————————-
I chose this setup mainly because of the sounds I was using. For example, I wanted more locators on Channel A.
Here are the sound effects I used:
Channel A: C_ArpLoop1 with FX 1: Echo
Channel B: DrumLoop4
Channel C: C_ArpSellection with FX 2: Low-Pass
Milestone 2
I have finished putting together the components of the synthesizer and I have successfully wired them to the Arduino. After steadily receiving my various components, I finally had the chance to put them together. I first needed to make holes in the lid of my plastic for the components to fit in and stick through the surface. Initially, I thought I would just have to drill holes in a plastic lid based on the schematics provided by fraganator on the website:Wiring Diagram Here. Note that I had to reverse the 5V and analogue wires on the sliders to get them to work. I was not able to order this enclosure and had to order a different one. This led to some modifications to the design: The new enclosure was larger, meaning that I had to scale up the original mechanical drawings (to about 150% the original), and the lid of the enclosure had to be laser cut since it was made of metal instead of plastic. To get the lid laser cut, I needed to draw up new mechanical drawings (using SketchUp Pro) so that someone could accurately cut the lid. Schematics here. Also, because I had a different enclosure, the suggested position of the Arduino (the mid-back of the enclosure) wouldn’t work because of a metal plate in the back. I needed to drill a hole for the USB port of the Arduino, but this would be difficult to do through metal. Instead, I located the Arduino in the back-right of the enclosure with the USB port facing left so I could drill the hole through plastic. I also needed to raise the Arduino 10 millimeters since I only had 10mm metal spacers (I initially wanted nylon spacers so I could cut them down to a shorter length). I first tried gluing the spacers to the enclosure with a glue gun and then screwing in the arduino from above, but the glue didn’t stick well. Instead, I drilled holes through the bottom of the enclosure so that I could insert my screws from under the enclosure, through the spacers, and then through the Arduino in order to keep it from sliding horizontally. I also created schematics for the holes I made with SketchUp Pro.
Holes for screws to keep Arduino in place
Once the enclosure was set, I needed to insert the components. The buttons were the easiest to deal with: They just snapped in. The rotary potentiometers have a hexagonal nut and washer around them, which I took off so I could insert the top of the potentiometer through the hole, with the small guide through the smaller hole to keep it in place, and then screw the washer and nut back on tight from the top. The sliding potentiometers needed to be connected to the enclosure using screws and spacers. Through the small holes next to the hole for the slide, I inserted two 10mm screws, screwed on 10mm spacers, and then screwed in each to the holes on top of the potentiometer. When I got my lid laser cut, I realized that these holes for the screws were a little too far apart, but I was still able to connect the screws at a slant.
Next, I had to wire the enclosure. To start, I combined multiple smaller sections of wire into large wires by twisting together the ends. This was important for creating one continuous wire that could connect to multiple components. I was able to do this for the grounding wire for the potentiometers, the grounding wire for the buttons, and the 5 Volt wire for the potentiometers and button 12. Because the wire I used was stiff, I made sure to connect the wires in the approximate shape of the circuit that I would need inside the box. This also meant making sure the twisted ends would face towards the components in the circuit. In addition, I needed to cut 18 additional wires for the digital and analogue pins. I made sure that the wire I was cutting was more than long enough to connect the components together or to the Arduino.
I finally had to solder the wire to the components. Once I put the wire in place, I started each end to the components. This was much more difficult than soldering I did in the past (to a PCB) because I was soldering thicker wire (multiple wires twisted together) and was soldering to smaller connections. I had to re-solder multiple connections that weren’t staying together. Once all the wires were soldered, I then connected the ends of the wires to the Arduino pins. I decided to connect the wire to the Arduino and then connect the Arduino to the enclosure.
Once everything was connected, I wrote some code to test that the components were connected. This is an expansion of the old code I used to initially test components. Download final test code hereI then uploaded this code to test it, but found that the sliding potentiometers. I tried re-soldering the wires, but this didn’t work. I then removed the potentiometers from the enclosure to test with a breadboard, and I found that the connections to the 5 Volt supply and the analogue pin were reversed. I then corrected the connections to both potentiometers, but I found that one of them was still not working. After checking the resistance through it with a multimeter, I found that the resistance was not changing when it was supposed to, meaning that the potentiometer was broken. Thus, I needed to order another one for the project.
From this part of my project, I learned about creating and soldering a circuit for a design. This involved soldering components directly, which was new for me. I also learned how to come up with alternative ways of doing things when I didn’t have the right components. This was especially true with my box, which led me to change multiple parts of the project including the schematics of the lid, the method for making holes in the lid, the placement of the Arduino, and the method for mounting the Arduino. I feel that from working on this part of the project, I now know how to solve problems more efficiently.
I am now ready to set up the software for my project so that I can use my synthesizer with music software.
Milestone 1
I have now been able to successfully test the Arduino and its software by writing code to have the Arduino read the voltage from potentiometers and detect if a button is pressed. The setup I have created to test this consists of the Arduino Uno I will use for my main project, a Breadboard to connect hookup wire, a button, and two potentiometers, including a rotary and sliding one. Both potentiometers act as resistors in a circuit made with the Arduino: The arduino supplies a voltage to the circuit, and the circuit is grounded after it goes through the potentiometer, which completes the circuit since the Arduino is connected to the ground. Within the potentiometers, the voltage is split before the resistor so that this voltage can be read by the arduino through the analogue pins. There is also a circuit connected to one of the digital pins, which reads when the circuit is completed when the button is pressed. Based on this reading, the AVR ATmega328 Microcontroller outputs the readings in the Serial Monitor of the Arduino software on my computer.
Part of my setup includes the potentiometers. These are resistors which can have different values of resistance depending on how much the knob or slider is changed. This is because a wiper, which is connected to the analogue input on the arduino and the resistor in the potentiometer, receives different amounts of voltage (from 0V to 5V maximum) depending on on the resistance between the Arduino and the potentiometer. Another key component of my setup is the breadboard. This is a board made of conductive material in which wires can be set so that I can connect the pins of the Arduino to multiple components in order to test a circuit. In this case, I needed to connect the 5V pin and the ground pin to both potentiometers so that a circuit goes through the potentiometers. The button in the circuit acts as a switch: When it is pressed, the two connections on the button are connected by a conductive material so a circuit can more through the button. The other key part of my circuit is the Arduino. This contains all the code in the AVR microcontroller that lets the Arduino send the reading from the analogue pins to the serial monitor on my screen. It also contains the pins, which can act as inputs or outputs in a circuit. As inputs, the pins read changes in the circuit depending on a change that occurs, usually by a component such as a potentiometer or button. As an output, these pins supply components in a circuit with current. There are also different types of pins: Analogue and Digital. The analogue pins can read voltage in the circuit, which is helpful in that changing resistance with a potentiometer proportionally changes the voltage in a circuit. The digital pins can either be read as inputs, in which the voltage going through them can be read as HIGH(+3V) or LOW(-2V), or they can act as outputs so that they can supply current to a component. Because these pins have built-in high resistance, they are able to read small amounts of current (current is inversely proportional to resistance), and thus don’t demand much current from a circuit. These pins also contain pull-up resistors which, when activated, keep the pins at a default HIGH state. This is so when a button/switch is pressed that is connected to this pin, it will read LOW, effectively distinguishing when the circuit is open or closed. This will be important for my design since the synthesizer has 12 buttons that will be connected to the digital inputs.
I also modified the design by using pin 13 as an input for the button rather than input 0. This is because pin 13 has an LED connected to it, and thus has a different pull-up resistance. In order to use the pin as an effective input, the circuitry must be configured differently than the other pins, which only require a connection to the ground to be activated with their pullup resistor. For pin 13 to work, I need to instead connect the 5 Volt pin to the button and then connect both pin 13 and a pull down resistor (4.7KOhm) to the other side of the button. Unlike the other pins, this puts the pin at a default LOW state rather than HIGH, reversing the states but keeping the same function.
Here is the code I used for testing the Arduino. I used analog inputs 4 and 5 for the potentiometers and pin 13 for the button. The analog input is connected to the center connection on the rotary potentiometer and the 2nd connection on the sliding potentiometer:
Test Code
Working on my project, I learned more about potentiometers and learned about the Arduino and how to program it. I had used a potentiometer in my starter project, but I knew little about it. Now I know more about how they function and how to set them up in a circuit. For the Arduino, I learned about the different components such as the microcontroller and the pins. Knowing about the pins is especially important in order to set up the circuit of my design correctly. I learned how to use these different pins, including the analogue and digital inputs, the grounding pin, and the 5 Volt pin. I also learned how to use Arduino code. This will be essential to be able to read, check, and edit the pre-existing code for my project.
I will now move on to putting together the components of the synthesizer and soldering the wires together.
Starter Project
My name is David B. My starter project for BSE NY 2014 is the Mini Gram Piano. The device plays notes through a PCB-mounted speaker depending on which of the 13 capacitive sensors are touched. The main components of the project are a PCB with built-in capacitive sensors, an ATMega328P AVR Microcontroller that contains the code for managing the circuit, and a speaker, which emits sound waves when current passes through it. When I touch the capacitive sensors, the electric field created by the capacitor changes, and the AVR microcontroller can measure this change. Depending on which sensor is touched, the microcontroller sends a corresponding current through the speaker. When there is more current going through the speaker, the cones inside will vibrate faster and thus produce a higher pitch.
Mounted on the PCB, there are a variety of other components in the circuit to allow the device the function. There are different resistors in the circuit (2Mohm, 10kohm, and 330 ohm) that reduce the current going through the circuit, making sure that the other components receive the correct amount of current. The capacitors in the circuit (.1µFarad) store energy that goes through them by using an electric field. There is also a rotary potentiometer (10kohm), which is a resistor that can be adjusted with a knob to have different amounts of resistance. In the design, this allows me to change the octave of the notes: Changing the resistance will change the current that goes through the speaker, which results in a higher or lower pitch. The LEDs (Light Emitting Diodes) light up when a current passes through them in one direction (one lights up when the power switch is closed and the other blinks when the AVR microcontroller is able to control the circuit after it is powered). Other components of the circuit are the batteries (two 1.5v) that supply the voltage to the circuit, and a button that, when pressed, sends a current through the microcontroller which sends the current to the speaker to play a set song when it receives this current.
While building my project, I encountered a problem while working on the circuit. As I was soldering the battery holders to the PCB, I damaged a connection in the circuit between the two batteries. The circuit was working before this, and I was just adjusting the battery holders so they touched the battery on both sides and completed the circuit, but once I did this, the keyboard wouldn’t work. After seeing the break in the PCB along one of the traces, I used a digital multimeter to confirm that the two battery holders weren’t connected in the circuit. To repair this, I found an alternative conductive wire (a piece of excess wire I clipped from a resistor) and soldered it to the holders, suspended above the PCB. After this, the keyboard worked as expected.
From this project, I learned about how the many components of a circuit work together and how to assemble a working circuit. This included learning about what each of the components looks like, what they do in the circuit, how they are measured, and how to determine their measurement value. For example, the small cylinder-shaped components with colored stripes are resistors: They control the current through the circuit, are measured in Ohms, and the stripes determine their value. The smaller, yellow, roundish components are capacitors, which store energy, are measured in Farads, and usually have their capacitance printed on them. In addition to these things, I learned how to use soldering to mount the components onto the PCB. I now know how to use a soldering iron, that good soldering looks like a silver, even mound, and that solder keeps the components connected to the circuit, conducting electricity so the circuit can be completed.
I am now ready to use these skills when I start building my main project, an Audio Synthesizer.