Lab Activity 1 - Tone OutputThis week we learned about pulsewidth modulations (PWM), first by exploring more possibilities with tone output through a speaker. The exercise in the lab walked us through how to map the played frequency to the analog sensor's readings. I was particularly interested in the other components of the code, especially the delay. The audio clip on the left features a 50 millisecond delay, while on the right features a 20 millisecond delay. This distortion reminds me of image blurring or pixilation and I imagine using this feature as a form of interaction where the output quality relies on proximity. For example, to properly hear an audio file, the user must use their hand to follow an invisible path (maybe with a phototransistor or distance ranger), and more consistent the user follows the path, the clearer (less delay) the audio file plays.
Lab Activity 2 - Servo Motor ControlThis might have been my favorite part of this week's labs! Something about a moving object is just so exciting! I wasn't able to get a wide enough range with the phototransistor and I did not love the interaction from the potentiometer, so I opted to use the FSR with the servo motor. Once I had a decent understanding of the servo motor code, I wanted to build a switch interaction where one FSR turns the motor clockwise and the other turns the motor counter clockwise. To add a layer of complexity, I'd like the motor speed to correlate with the pressure applied on the FSR, (ie, the harder the user presses, the faster the motor turns). first I started by building code that could control the motor with two different FSRs. One ("rightSensor" on A0) to increment the servoAngle by 1, the other ("leftSensor" on A1) to decrement the servoAngle by 1. Below is the code I used achieve this.
proThe next step was to change the speed of the motor in relation to the pressure applied to the FSR. I did this by creating a custom variable for the speed, so I could map the incrementing value of the rotating "speed" to the sensor readings, which is approximately between 0 - 950. Since the servoAngle does not change unless the FSR reading exceeds 50, I mapped the range between 51 - 950. And then finally, I added a delay of 50 milliseconds so that the movements could be more observable in realtime. I found that any delay value more than 100 looked almost "glitchy". See below the video for the final code. If I have more time to develop this project, I would like to explore the different things I could attach to the motor. Perhaps some sort of moving puzzle that requires intricate touch to solve. Or even the complete opposite where the user may have a ridiculously large interactive interface or object to control the tiny motor movements. Comments are closed.
|
Blog posts and other documentation from NYU ITP classes
Categories
All
|