7745 Breadboarding lab
Breadboarding lab: Controlling Physical Models using Breadboarded Sensors
Designed by Edgar Berdahl
For this lab you need your Satellite CCRMA kit, a laptop computer with Ethernet adaptor to program it, and some headphones with a mini 1/8" (2.54mm) stereo jack.
Note: In this lab, the images will show the Beagle Board xM instead of the Raspberry Pi, but actually all of the wiring is essentially the same.
- In order to run circuits on the breadboard, you need to get power to it. The Arduino gets 5V from the USB connection, so in this section you will make the 5V accessible to the breadboard.
- Make sure that your Arduino is mounted at the very end of the breadboard with the higher-numbered rows, as shown in the following picture. In that case, the GND and 5V pins will end up in the 19th row. (Otherwise if your Arduino isn't mounted this way, you simply won't be able to rely on the row numbers, but you can still figure out how to wire things up!)
- Recall first that that holes in the solderless bread board are wired together as shown:
- Using short jumpers, connect the GND row to the blue "GND" bus on the breadboard, and connect the 5V row to the red "power" bus on the breadboard.
- Connect the "GND" and "power" busses from both sides of the breadboard together as shown.
Viewed from further away, your breadboard should now look like the following:
First Circuit: Potentiometer
- Use the same procedure as before to power up Satellite CCRMA and login as the user ccrma with the password temppwd.
- Don't forget to stop the default patch from running by executing the command
- Start pd using the following command
- Open the pd patch
- Now you will build the following voltage divider circuit, to connect one potentiometer to analog input A0.
For some help on placing the wires, please see the following picture. In order to ensure the correct orientation, ensure that the text on the potentiometer is facing away from the Arduino (see also oblique picture in next section).
Add A Second Potentiometer
Now connect a second potentiometer to analog input A3 using the same voltage divider circuit.
Again, ensure that the text on the potentiometer is facing *away* from the Arduino (see the red boxes in the following figure):
Other Voltage Dividers
The circuit you just used for the potentiometer was a voltage divider circuit in which the potentiometer serves as two resistors. Other resistive sensors only have two wires, so to build a voltage divider with them, you need to combine them with a second, fixed resistor. Examples in your kit are the force sensitive resistor (FSR) and the bend or flex sensor. The idea is that you put two resistors in series between power and ground: one that changes resistance (your sensor), and one of a known, fixed resistance. At the point in between the two resistors, you can measure how much the voltage has dropped through the first resistor. This value changes as the ratio of resistances between variable and fixed resistors change. More formally:
- force-sensitive resistor (FSR):
Try both circuits. Test the resistance range of your sensor. If you want 2.5 volts to be the middle, make the comparison resistor (33k in the diagram) the "average" value of the FSR's resistance. Test this with a multimeter.
- Bend Sensor
Read more about other sensors in the lecture notes.
Optional: Build A New Effect
- Build a new effect whose parameters are adjustable by the potentiometers and button. We will ask for volunteers to demonstrate this the following morning in class. You can build on what you did in lab 1 if you like.
- Think about the result
- do the controls allow the entire space of parameters to be explored?
- is it easy to choose any desired set of parameters?
- does the effect sound good?
- does it have dynamics?
- would you want to use it live?
- If not, what is missing still?
More Reading About Arduino
- After you are logged in, see which devices are attached to Linux by running the command following command. They will appear the be files. Wow, there are so many!
- To list only the serial interface devices type
- Now use the retractable USB cable to plug the Arduino into one of the USB ports of the Raspberry Pi. As the Arduino powers up, you should see some lights come on.
- Now run
again, and you should now see the new device /dev/ttyUSB0 appear also, which represents the Arduino Nano.
Troubleshooting: If you do not see /dev/ttyUSB0, then try rebooting using sudo reboot to see if that fixes this problem. (If you reboot, this will take about 45 seconds, and you will have to login again using ssh. If that doesn't work, come talk to us. If you are a Linux pro, you can try to debug the problem yourself by typing dmesg and looking at the result.)
- The next step is to install some simple firmware onto the Arduino so that it knows what we want it to do. Start the Arduino software in the terminal by typing
- Open StandardFirmata from the Arduino software pull-down menus File|Examples|Firmata. Look at the program. This is what will control the Arduino.
- Select Arduino Nano w/ ATMega328 under Tools->Board and /dev/ttyUSB0 under Tools->Serial Port. Then hit the Play button to verify and compile the program.
- Upload the Firmata firmware to your Arduino Nano using upload button, the second square button from the left (the one with the sideways arrow).
- Close the Arduino program by closing all of the Arduino windows. (This is important because it frees up the USB serial port so that Pd can talk to the Arduino board later.)
Some small amount of the text and images here was taken from prior laboratory exercises for the course Music 250A. We regret that we do not know who contributed these elements, but these people are likely to include Wendy Ju, Bill Verplank, Michael Gurevich, and possibly more.