Lab 5 — Piezo Buzzer

Description

This week’s lab takes what we’ve been learning about pulse width modulation (PWM) from the beginning of the semester, building circuits with Arduino and different I/O to make some more noisy design artifacts. We used the piezo buzzer and tone() function to incorporate sound to create a theremin, played with Professor Howell’s sketch for playing sounds from the serial port, and had to use an input/output transductor to design an artifact where both input and output occur at the same place. We have to manipulate the frequency of the duty cycle, and Professor Ryokai reminded us that to calculate period, we need to solve for frequency (hz) = 1/ period (sec).

Components used

  • arduino
  • breadboard
  • jumper cables
  • 10k resistor, 200 ohm resistor
  • piezo buzzer
  • potentiometer

Part 1 — The Piezo Buzzer

I followed the Arduino tutorial for toneMelody to make the piezo buzzer play a melody. While the piezo wires were thin, this was the first time that I constructed the circuit without issues. It was very satisfying to hear the little melody play, which got me excited for the other parts of the lab.

Part 2 — Make a Theremin

I was a bit intimidated by this section because of all of the issues I encountered when using the photocell in the previous lab. Luckily, Zeke was there to catch my errors in constructing the circuit, where I accidentally swapped where A0 and GND should be connected to the breadboard. It was super satisfying to see the photocell working! I played around with the source code and changed the duration of the notes to see what would change. Honestly, I could barely detect a difference between the notes duration, but I attribute that to my lack of musical training to know what to pay attention to.

Sound serial (noura howell)

I was so excited to see an I School alum’s work that I admire so much being incorporated into our class! I was super confused as to how to get the sound serial code working, and then realized that I just needed to create a separate sketch. If I had more time, I would have liked to play around with the code to see if I could incorporate sharp and flat notes to play different songs (albeit all at the same tempo).

Homework — Input-output coincidence exercise

I initially planned to use a potentiometer to lower the volume of the piezo buzzer since I was so irritated with how harsh the piezo buzzer sounded. However, I wanted to work on a more hackery project and explore more of the invention lab, so I decided to do my input-ouput coincidence exercise using a 3.5mm cable.

  • arduino
  • breadboard
  • jumper cables
  • wire stripper
  • soldering iron
  • lead-free solder
  • shrink wrap
  • heat gun
  • 3.5mm jack and cable
  • electrical tape
  • a video of your favorite edm song, and your favorite acoustic song
soldered wires, with yellow shrink wrap already on to protect the of the 3.5mm cable extended with jumper wires from fraying more
big shrink wrap for all of the 3.5mm cable!
An absolute banger.
Circuit schematic and graphical representations of the sound waves (I realized I should have used more contrasting colors for the first graph)
Crunchy audio represented by a graph.
//double lastMillis = 0;
double loops = 0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
int ground = analogRead(A0);
// Serial.println(ground); // computer's ground, which can be different from the arduino's ground
Serial.println(loops / (millis() / 1000.0)); //count how many times looping, and then divide it by
loops++;
int in = analogRead(A1);
int out = 1023 - (in-ground);
analogWrite (9, out);
long current = millis();
loops++;
// here, we were trying out example code from arduino to see how many times we loop over a period
// if (current - lastMillis > 1000) {
// Serial.println(loops);
//
// lastMillis = current;
// loops = 0;
// }
}

Further extensions and related work

I had a lot of fun learning about how people talk about music this week as a byproduct of this lab — shout out to Annais for teaching me about acoustic waves. If I had more time, I would try to understand in more technical depth what “sounds” and “genres” makes different waves. Since the Castaways cover was by Martina DeSilva, a frequent collaborator with Adam Neely, I figured I would listen to videos in the background as I was writing this Medium post to keep me away. As someone super new to thinking about music in both a technically applied, signals processing way and a more historical/cultural way, I never realized how much the language used to describe music in American contexts is so grounded 18th century European music and music theory from that perspective. Since the song Castaways draws from the musical patterns of Bossa Nova, I also really enjoyed Neely’s video on Girl from Ipanea, which elegantly weaves together the importance of citation practices (and showed the impact careless citations resulting in cultural context/loss/white-washing of bossa nova), cultural influences in musical taste, the context in which music is created, all these super HCI/STS questions weaved into the medium of music. Neely’s Youtube videos seem to be super carefully researched and well done, so I’m excited to continue deepening my appreciation for music through his videos and finding ways to apply this knowledge in future labs.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
J M

J M

Grad student @ UC Berkeley’s School of Information. Interests include social computing, usable security, Being Online™️ and reflective tech.