250a Homemade Digital Musical Instrument

From CCRMA Wiki

Revision as of 18:12, 16 April 2010 by Eberdahl (Talk | contribs)
Jump to: navigation, search

Homemade Digital Musical Instrument
Demo at the 159th Meeting of the Acoustical Society of America For the Session Homemade Musical Instruments for Teaching Acoustics


Contents

Mount your Arduino Nano on your breadboard

We will be powering the Nano and the breadboard with current from the USB port, which is good for up to 500mA of 5 V±5%-- probably enough for most input circuits, although not enough if you plan to run a lot of LEDs or motors.

  • The Nano should sit at the bottom of the breadboard, so that the pins lie in rows 49-64 on either side.
  • Using jumper wires, connect the row 52 pin (GND) on the left side of the Nano to the blue ground (GND) rail.
  • Connect the row 52 pin (+5V) on the right side of the Nano to the red Power rail.
  • Use jumper wires to connect the power and GND rails on the left side of the breadboard to the right.

Image:Lab2-2.jpg

Install Firmata onto your Arduino Nano

  • Install the Arduino software
    • Unarchive the file, and move it to your applications folder.
    • Install the FTDI driver that comes with the Arduino software so that your computer will recognize the Arduino when it is plugged into the USB port.
  • Open the Arduino software.
  • Download the newest version of Pduino, unarchive it, and use the Arduino software program to open StandardFirmata.pde, which lies inside the folder Firmata-2.1:Firmata:examples:StandardFirmata.
  • Connect your Arduino Nano to your computer using a USB cable.
  • Use Tools->Board and Tools->Serial Port to select the Arduino Nano (Atmega 328) and USBserial tty port, then hit the Play button to verify and compile the program.
  • Upload the Firmata firmware to your Arduino Nano using upload button, the fourth square button from the left (the one with the sideways arrow).
  • Close the Arduino program. (This is important because it frees up the USB serial port so that Max/MSP or PD can talk to the Arduino board next.)

Install Pure Data Onto Your Computer

Install Pure Data Extended onto your computer.

  • Do NOT install the vanilla version of Pd!
  • In order to use the bowed string instrument synthesizer called Bowed~, you will need to install Stk2pd, which ports the Synthesis Toolkit to Pd.


Sensing buttons in software

We've used code to trigger output - what about the other direction, sensing physical input in code? Just as easy. Here is a simple switch circuit:

Image: switch.png Image: Lab2-6.jpg

When the switch is open, the Arduino pin (set to input mode) is pulled to 5V - in software, we'll read Arduino.HIGH. When the switch is closed, the voltage at the Arduino pin falls to 0V - in software, we'll read Arduino.LOW. The pull-up resistor is used to limit the current going through the circuit. In software, we can check the value of the pin and switch between graphics accordingly.

  • In the ArduinoLab patch, press the "sensing buttons in software" button to preset the outputs properly. The patch expects you to connect the switch to digital pin 4 (D4).


250a 2010
Personal tools