This week we worked on developing code that would allow us to control the intensity of an LED's brightness based on the amount of force applied to a sensor. By "squeezing" a round force sensitive recover (FSR) a human input was able to be computed from a force to an integer "read" and understood by the Arduino as wired on our breadboard. This code is shared below:
//int fsrAnalogPin = 0;
const int FSR = A0;
int LEDpin = 11;
int fsrReading;
int LEDbrightness;
int mapfsrReading ;
void setup(void) {
int fsrAnalogPin = 0;
pinMode(fsrAnalogPin, INPUT);
Serial.begin(9600);
pinMode(LEDpin, OUTPUT);
}
void loop(void) {
fsrReading = analogRead(FSR);
//Serial.print("Analog reading = ");
//Serial.println(fsrReading);
LEDbrightness = map(fsrReading, 0, 1023, 0, 255);
analogWrite(LEDpin, LEDbrightness);
Serial.println(LEDbrightness);
delay(100);
}
An additional component of our weekly assignment was to brainstorm some concepts and research of sensors/actuators that we would like to complete as a midterm project. This is known as "stupid pet trick" because the design is about the relationship between user experience and our ability to creatively code an interaction with our tools of code, Arduino, and external components.
Idea 1 – A game that responds to "breath" to levitate a ping pong ball. The position of the ball signals a buzzer to emit a particular sound and the height of the ball is based on the force of a fan which is controlled by the power of the user's breath. Sensors and components involved include a motor/fan, airflow sensor, and buzzers.
Idea 2 – An interactive display and art experience using ferrofluid. Magnets on the underside of a tank or basin would move in response to a button or joystick moving by user interaction. These magnets would then interact and "move" and activate ferrofluid that makes for a particular type of physical graphic interface. Sensors and components needed would be servos and/or button(s).
Idea 3 – Daylight detection device that uses either servos and magnets or an electromagnet to create a visual composition in the presence or a defined value or "light" based on "outside conditions." I am going to try this as my "Stupid Pet Trick" because I see a lot of interesting prototypes occurring for the overall experience and form matched to code. A light sensor and servos and/or electromagnet(s) is required for this project to unfold. I imagine laser cutting parts too and working in the shop. The idea is to have iron filings arrange themselves into a particular "iconography" or pattern that a user can use to recognize a clear message – (ie.) "Light (sunnny)" or "Dark (cloudy)" – based on the "evaluated thresholds" of weather conditions and lighting environments.