Week 13

Phoebe Yin
5 min readApr 14, 2024

--

This week, I mainly worked on testing out the FSR (force-sensitive resistor) with Arduino and the switching mechanics with the step-on interaction in MAX/MSP.

Connecting the FSR to Arduino & Programming

I made this simple circuit that has a resistor and the sensor

I was stuck on this initial step for a very long time. It was not difficult building the circuit, but after programming the sensor I saw nothing in the serial monitor in Arduino IDE — this might indicate that the sensor was not even detected. I was very sure that there was nothing wrong with my circuit and my code, so I started suspecting that one or multiple jumper wires might be broken. I switched all the wires still with no luck. I suspected that my Arduino Nano or my breadboard was broken, so I borrowed kits from the design lab. I managed to succeed with the Arduino Uno, but I preferred the Nano because it’s more compact and easier to hide. In the end, I randomly asked a person who was at the design lab because he was familiar with Arduino, and he told me that connecting power to 5V on the Nano is sometimes unstable. I changed my power wire to the 3.3V pin and it solved all the issues.

This is the first version of the code used to test out the FSR and its values:



#define FORCE_SENSOR_PIN A1 // the FSR and 10K pulldown are connected to A1

void setup() {
Serial.begin(9600);
}

void loop() {
int analogReading = analogRead(FORCE_SENSOR_PIN);

Serial.print("Force sensor reading = ");
Serial.print(analogReading); // print the raw analog reading

if (analogReading < 10) // from 0 to 9
Serial.println(" -> no pressure");
else if (analogReading < 200) // from 10 to 199
Serial.println(" -> light touch");
else if (analogReading < 500) // from 200 to 499
Serial.println(" -> light squeeze");
else if (analogReading < 800) // from 500 to 799
Serial.println(" -> medium squeeze");
else // from 800 to 1023
Serial.println(" -> big squeeze");

delay(1000);
}

I now have to revise the code based on my logic:

  • the code needs to print 1 or 0 in the serial monitor. 1 signifying pressure sensed, 0 meaning no pressure sensed
  • I have to change the threshold to a certain value. After testing, I realized that the sensor is extremely sensitive, with a max range of 1023. Any light touch by foot would exceed 900. Therefore, I set the threshold to 800.
  • The code has to stop printing any inputs after the first time pressure is detected. This is because the animation for the stellar flare lasts around 1–2 minutes. I don’t want repeated triggering of the sensor while the animation plays. Therefore, I set a timer of 30 seconds (for testing purposes). During that 30 seconds after the initial trigger, the serial monitor does not print 1 or 0 values. When 30 seconds is up, the timer resets.
#define FORCE_SENSOR_PIN A1 // the FSR and 10K pulldown are connected to A1

unsigned long printStartTime = 0;

void setup() {
Serial.begin(9600);
}

void loop() {
int analogReading = analogRead(FORCE_SENSOR_PIN);

if (analogReading > 800) {
if (millis() - printStartTime >= 30000 || printStartTime == 0) { // 30 seconds or first time
Serial.println("1");
printStartTime = millis();
}
} else if (millis() - printStartTime >= 30000) { // if 30 seconds have passed since printStartTime
Serial.println("0"); // print 0 after 30 seconds
printStartTime = 0; // reset printStartTime
}

delay(1000);
}

Receiving data from Arduino in MAX

On the other end, I need to receive, analyze, and program in MAX based on the information given by Arduino. MAX will control the entire sequence of the projection animation and sound, in an ideal state, I won’t have to do anything after the setup.

Although I ran into multiple issues, I managed to make this work after debugging for a long time

When MAX receives a signal of either 1 or 0 from the Arduino, it branches into one of two pathways. Upon receiving a 0, MAX initiates the day-to-night cycle on Aetheria, while a signal of 1 prompts it to execute the stellar flare animation. To ensure a smooth transition between the conclusion of the stellar flare and the resumption of the normal scene, I’ve incorporated a gradual transition. To enhance the continuity, I’ve put in a transition effect that gradually increases/decreases the audio and visuals on both sides.

Problems & Next Step

The biggest problem I faced was connecting the FSR to the breadboard. Although I could directly plug the pins into the breadboard, I needed to extend it, possibly a big amount, so that participants would not accidentally step on the important parts.

I tried using crocodile clips to extend the FSR.

The crocodile clips were very unstable and stopped working after trying a few times. I think this might be due to the poor contact. On adafruit’s website, it states that they highly don’t recommend soldering as the pins are too close to the sensitive semiconductive material. The heat from soldering could easily destroy the sensor.

I’m thinking about changing to this Velostat material. It’s a special material sheet that works the same as the FSR — resistance lowers when pressure is applied.

It’s pressure-sensitive: squeezing it will reduce the resistance, so it’s handy for making flexible sensors. And it’s a lot less expensive than off-the-shelf pressure or bend sensors too!

I won’t have to change the circuit too much if I change to this material.

Thesis Paper Progress

Although I conducted research in the related field last semester, I still think my research section is weak because my old research can only partially fit with the theme of my thesis. I’ve spent more time trying to make the research section more relevant and effective.

My research is sectioned like this:

--

--