"Vida"
"Vida"
by: David MartinezCruz, Valery Magne Merida. Section 2, Viola.
To create a more realistic appearance of a beating heart, I decided it would be beneficial to use a bouncy material as the base. This choice provided us with both sturdiness and flexibility. Next, we painted five sheets of fabric in different shades of red to add dimension to the heart.
Understanding that the heart needed to "beat," we tied a series of strings to the center of the heart, which looped through the back and were then pulled by a servo, creating the illusion of a heartbeat. To be honest, there wasn't much in the way of testing or trials; we essentially created everything in one go and hoped for the best. We didn't explore whether other materials might work better or consider if the metal fabric was too heavy for the strings to pull. Instead, we made adjustments as needed—such as using thicker, stronger string or mixing in darker colors for the fabric.
"Vida" is the Spanish word for "life," and throughout our project, we aimed to convey this essence. Working on this artistic endeavor stemmed from my previous research group's lack of artistic choices; it felt overly simplistic and easier to execute.
While I can’t provide a direct link, my inspiration for the heart design came from a GIF shown during class, where a former student created a flower that blossomed and dulled, accompanied by light changes. Drawing from that project, I initially planned for the heart to "beat" while playing a heartbeat sound. However, we encountered challenges with the audio, so we decided to focus on three bright lights that would dim in and out to represent the heart's "beating."
he longest and most crucial aspect of our project was the wiring and coding, which I handled on my own. I also gathered the metal fabric for our installation. Getting the servo to function "normally" proved to be quite challenging. We needed to introduce a delay for the lights to dim in and out, but this delay affected the entire code with the sensor. Additionally, the delay made the servo noisy, so I attempted to add a smoothing filter. However, this only caused the servo to tug on the string very slowly, leading to a lot of trial and error.
During user testing, we managed to get the heart and its "beating" to work, but we were still deciding how to make the lights function effectively. Much of the feedback we received suggested incorporating lights and making the heart appear more realistic, as it initially seemed a bit too plain. In response, we proceeded to add blue and red blood vessels for added realism.
// if (currentServoPosition < targetServoPosition) {
currentServoPosition += 2;
This code in particular was very useful in our process for smoothing, it took a bit of adjustments but ultimately ended up working out.
Conclusions!
The primary motivation behind this project was to convey the heart’s desire for interaction. By incorporating an ultrasonic sensor to activate the motion of the beats and lights, we aimed to enhance the concept of interaction that we wanted to demonstrate. In hindsight, rather than relying on hand gestures to trigger the sensor, I believe it would have been more engaging to require a physical touch to the heart. My classmates, already familiar with ultrasonic sensors, likely understood how to activate the mechanism; however, in a different context, many people might not intuitively grasp how to engage with this technology.
If I had more time, I would have made the heart less transparent to obscure the visibility of the LED lights. Additionally, I would have liked to achieve a more realistic appearance for the heart itself. This project taught me a great deal, particularly regarding the coding aspect. I came to realize how critical and intentional coding and wiring are in bringing a project to life, and I am eager to learn more about how I could improve my work in future lessons.
Ultimately, this experience instilled in me a deeper understanding of patience and the importance of iterative processes—embracing the idea of restarting when necessary and striving for continuous improvement.
code!!!!
# include <Servo.h>
Servo myServo1; // Create a servo object
int triggerPin = 3;
int echoPin = 2;
long distance;
int led = 10; // The PWM pin the LED is attached to
int led11 = 11; // New LED on pin 11
int led12 = 6; // New LED on pin 12
int led13 = 5; // New LED on pin 13
int brightness = 0; // How bright the LED is
int fadeAmount = 6; // Slightly faster fading
int currentServoPosition = 0; // Track the current servo position
int targetServoPosition = 0; // Track the target servo position
void setup() {
Serial.begin(9600);
pinMode(triggerPin, OUTPUT);
pinMode(echoPin, INPUT);
myServo1.attach(9); // Connect the servo motor to pin 9
pinMode(led, OUTPUT);
pinMode(led11, OUTPUT); // Set pin 11 as output
pinMode(led12, OUTPUT); // Set pin 12 as output
pinMode(led13, OUTPUT); // Set pin 13 as output
}
void loop() {
// Send a pulse to trigger
digitalWrite(triggerPin, LOW);
delayMicroseconds(2);
digitalWrite(triggerPin, HIGH);
delayMicroseconds(10);
digitalWrite(triggerPin, LOW);
// Wait for echo response
long duration = pulseIn(echoPin, HIGH, 17400);
distance = duration / 29 / 2;
Serial.print("Distance: ");
Serial.println(distance);
// Determine the target servo position based on distance
if (distance <= 10) {
targetServoPosition = 180; // Target position if distance is 10 cm or less
} else {
targetServoPosition = 0; // Target position if distance is greater than 10 cm
}
// Small smoothing filter for the servo movement
if (currentServoPosition < targetServoPosition) {
currentServoPosition += 2; // Adjust increment for smoothing
if (currentServoPosition > targetServoPosition) {
currentServoPosition = targetServoPosition; // Clamp to target
}
} else if (currentServoPosition > targetServoPosition) {
currentServoPosition -= 2; // Adjust decrement for smoothing
if (currentServoPosition < targetServoPosition) {
currentServoPosition = targetServoPosition; // Clamp to target
}
}
myServo1.write(currentServoPosition);
// Fade the LEDs
brightness += fadeAmount;
// Reverse the fade direction at the limits
if (brightness <= 0 || brightness >= 255) {
fadeAmount = -fadeAmount;
}
// Write brightness to all LEDs
analogWrite(led, brightness);
analogWrite(led11, brightness);
analogWrite(led12, brightness);
analogWrite(led13, brightness);
delay(20); // Shortened delay for faster updates
}