![]() |
CCRMA Stanford UniversityMusic 250 - Physical Interaction Design for MusicLab 3: Circuits, Sensors, OSC
|
| home lectures schedule homework project labs resources |
If you need more time to finish this lab
you can come use the CCRMA facilities any time. 1. Load meter.c onto the AVRmini. a. Create a lab3 folder in your 250a folder. Copy avrlib-demos/meter there.
b. Load the "meter" onto the AVR. ~/250a/lab3> cd
meter This will turn your AVRmini into a rudimentary multimeter with two inputs. Use a jumper from the point at which you want to measure the voltage to A0 or A1 on the AVRmini. The voltages will be shown on the LCD. Note that the signals are numbered starting at zero (A0 - A7)
while
the pins on the header that carry those signals are numbered starting
at one (1 - 8). The 8-bit analog to digital conversion gives 0..255. Here is the pin-out for PORTA, PORTB, PORTC, PORTD (only 1.2
and 9.10 are labelled on the board): 1 3 5 7 9 The same pin configuration is shown bellow with the signal names. A1 A3 A5 A7 5VA0 A2 A4 A6 GND 2. Build sensor circuits. Build the circuit that is detailed in the folowing figures.
Use components and jumpers to construct your circuits on the
solderless bread-board. Here's how to wire a simple 2-resistor circuit on the
solderless
bread-board (for example R1 = 10K, R2 = 10K): What will A0 read? a. Build the button and LED circuit.
b. Hook-up sensors to A0 or A1 and watch the voltage change.
c. The musical AVRmini
3. Read sensor values to PD. Using osctest.c (in the avrlib-demos):
~>
cd ~/250a/lab3 and osctest.pd: ~/250a/lab3/osctest> pd osctest.pd & send data from your protoboard circuits (analog input on A0 and A1), and to PD. Note: we use the Pd [serialIO] object to read OSC data from the serial port. When you open a patch containing a [serialIO] object, you must send it a [start] message in order to begin polling the USB port. If you want to reprogram your AVR, you should send [serialIO] a [close] message to release the port for the AVR downloader to use, then you can do a make load. When you want to resume using [serialIO], you should send it a message [open /dev/ttyUSB0] to reopen the port, followed by [start] to resume polling. Let A0 "float" while A1 is tied to a potentiometer by removing the wire from its socket. What happens to A0's value when A1 is changed? Try the same experiment with the PORTB[4-7] buttons. Why does this happen? How can we prevent it? 4. Putting it all together.Create a Pd patch to make sounds based on button and sensor values from the AVR. You can try to adapt your patch from Lab 1, or come up with a new patch. You can also use as a starting point the patch osctestsoundout.pd, located in the same folder. Try to make a simple musical interaction. Think about music - - does it have dynamics? - can you turn the sound off? - can it be expressive? You may need to make a copy of osctest and modify it to send the appropriate control signals. |