Speaker & L oad Cell
Speaker & L oad Cell
I am interested in learning how to wire a speaker and how to use it to play soundtracks I found online.
I designed a smart cup, which combines a speaker and a load cell. When the weight measured by the load cell exceeds a specific number, the speaker will play a chosen soundtrack.
Images of final creative/exploratory output
Final smart cup
Video demo
Process images from development towards creative/exploratory output
3D print base for load cell
[Process image or video. Your image caption goes here. Remember to add alt text if needed.]
Process and reflection:
[Your text goes here; at least 150 words. Address what your process was, e.g. what did you make/do first; how did it go; what did you make/do next; etc.
Include a reflection at a minimum addressing what you learned, any surprises along the way, and how you feel about where you ended up.]
Technical details
/*
60-223 Intro to Physical Computing, fall 2025
Domain-specific Skill Building exercise: [Insert name of your project here]
[Write a short description of what this sketch does. What hardware does
it connect to? What is its function? Imagine you're describing it to someone
over the telephone.]
Pin mapping:
Arduino pin | role | details
------------------------------
5 input momentary button
8 output external LED
Released to the public domain by the author, January 2024
Robert Zacharias, rzachari@andrew.cmu.edu
*/
const int BUTTON_PIN = 5;
const int LED_PIN = 8;
void setup() {
pinMode(BUTTON_PIN, INPUT);
pinMode(LED_PIN, OUTPUT);
Serial.begin(9600);
}
void loop() {
int buttonState = 0;
buttonState = digitalRead(BUTTON_PIN);
int ledBrightness = 0;
if (buttonState == HIGH) { // if the button was pressed
ledBrightness = 200; // bright
}
else if (buttonState == LOW) { // otherwise, if the button wasn't pressed
ledBrightness = 30; // dim
}
analogWrite(LED_PIN, ledBrightness);
Serial.print("buttonState = "); // just write that text to the screen
Serial.print(buttonState); // then send the value of the variable
Serial.print(", ledBrightness = "); // write that text to the screen
Serial.println(ledBrightness); // send the value of the variable
delay(10);
}