TheFutureCraft Logo|Lab

Touching Atmosphere

Arduino / C ++

A Sentimental Touch

Sometimes we imagine whether the collaboration of certain technologies can bring unexpected emotional experiences and add some sentimental qualities to the product.

In this project, we attempt to use touch as the "key." By varying the force of touch, we provide different feedback in terms of fog and lighting effects. This creates a richer, more ambiguous narrative between the simple actions of turning the product on and off.

Result

We successfully found a balance between concealing electronic components and ensuring light transmission in the choice of LED and materials, and effectively controlled the lighting using an Arduino program.

Project Challenges

In this project, we encountered two unexpected issues:

First, while force-sensitive resistors provide a good linear conversion between force and electrical signals, directly translating these signals into the intensity of fog and lighting feedback lacks the synchronized feeling between action and response. We later realized that human perception of external stimuli is nonlinear. Therefore, the feedback needed conditional judgment and computation on the original signals to offer a better experience.

Second, the atomizer, a high-frequency component, caused interference in the signals received by the force-sensitive resistors due to its frequent current oscillations. This interference affected the device's operation, especially in the more compact layout of the Arduino Nano. To address this, we wrapped some components in aluminum foil to reduce electromagnetic interference, ultimately ensuring the device operated smoothly.

Arduino Code (C++)

main.ino

#define PRS_PIN1 A0
#define PRS_PIN2 A1
#define LED_PIN 9
#define fiveV 6
#define fogC 2

void setup() {
    Serial.begin(9600);
    pinMode(PRS_PIN1,INPUT);
    pinMode(PRS_PIN2,INPUT);
    pinMode(LED_PIN,OUTPUT);
    pinMode(fiveV,OUTPUT);
    pinMode(fogC,OUTPUT);
}

float used_value = 0;
float used_value_keep = 0;
int i = 0;
int light=0;
int light0=255;
int fogV=0;
int adjust=100;

void loop() {
        digitalWrite(fiveV,HIGH);
        
        Serial.print(analogRead(PRS_PIN1));
        Serial.print("+");
        Serial.print(analogRead(PRS_PIN2));
        Serial.print("=");
        int p1 = analogRead(PRS_PIN1);
        int p2 = analogRead(PRS_PIN2);
        if(p1<700){
        p1=0;
        }
        if(p2<100){
        p2=0;
        }
        Serial.print(p1/10);
        Serial.print("+");
        Serial.print(p2/10);
        Serial.print("=");
        
        float PRS_value = p1/3+p2/3;
        if (PRS_value<adjust/3*2){
        PRS_value=0;
        }
        Serial.print("(");
        Serial.print(PRS_value);
        Serial.print(")");
        fogV=PRS_value;
        PRS_value = map(PRS_value,0,1023,0,10000);
        PRS_value = sqrt(PRS_value)*100;
        used_value = map(PRS_value,0,10000,0,255);
        //Serial.println(PRS_value);
        Serial.print(used_value);
        Serial.print("//");
        Serial.print(light0);
        Serial.print("//");
        Serial.println(light);
        delay(100);


        if(fogV>adjust){
        digitalWrite(fogC,HIGH);
        }
        else{
        digitalWrite(fogC,LOW);
        }
        
        if(used_value==0){
        light = used_value_keep;
        used_value_keep = used_value_keep - 10;
        if(used_value_keep<=0){
            used_value_keep = 0;
        }
        float scale = (light-used_value_keep)/15;
            for(i=0;i<15;i++){
            light0=light;
            analogWrite(LED_PIN,light);
            delay(1);
            light=light-scale;
            }
        }
        else{
        light = used_value_keep;
        float scale= (used_value-used_value_keep)/100;
        for(i=0;i<100;i=i+1){
            light0=light;
            analogWrite(LED_PIN,light);
            delay(10);
            light=light+scale;
        }
        }
    //pressure read


    //control
        if(used_value==0){
        used_value_keep = light;
        }
        else{
        used_value_keep = light;
        }
}