GMU:Speculative Atmospheres II/Nicolas Krewer

From Medien Wiki
< GMU:Speculative Atmospheres II
Revision as of 11:16, 14 December 2021 by Krewern (talk | contribs) (Created page with "==Concept sketch== Inspired by the yearly happening Sisyphean task of sweeping leaves and get them blown away again by the wind. In this installation wind is captured outdoor...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Concept sketch

Inspired by the yearly happening Sisyphean task of sweeping leaves and get them blown away again by the wind. In this installation wind is captured outdoors and will be transmitted and reproduced in a round room. Multiple fans are blowing receipts through a room in the direction and the speed from the wind outside. The fans are aligned in a circle, which reflects the pattern in which the wind is captured. The receipts are printed with nonsense information, which on one hand represent the leaves, but also address the issue of a senseless environmental pollution.

‘’Technical’’ To capture the wind speed and and the direction, a DIY anemometer is built. For both, photo interrupters are used. To measure the wind speed, a slotted disk is used to measure the amount of steps (on/off) in a certain time and then calculated to rpm, which will be send to control the speed of the fans. For capturing the direction, a rotary encoder is built with two photo interrupters and also a disk, that has eight steps (for eight wind directions).


In the final result, the use of an Arduino Mega is necessary to provide enough digital inputs that support interrupts, but also enough outputs for the fans. For the fans, brushless motors are used, that are also very common in drones, e-bikes, etc. They are controlled with motor drivers and powered by a power supply unit.

In this class only a small scale prototype is built, with computer fans.

File:rotary1.JPG


Experiments

Accelerometer Experiments

In my first experiment, I used an accelerometer to measure a specific angle on the X, Y and Z axes. I thought that it could be useful to capture the wind direction, but seemed a bit boring then.

#include <Wire.h>
#include <LiquidCrystal.h>

LiquidCrystal lcd(12, 11, 7, 8, 9, 10); // RS, E, D4, D5, D6, D7

int ADXL345 = 0x53;                     

float X_out, Y_out, Z_out;
float roll,pitch,rollX,pitchY,rollF,pitchF=0;


void setup() {
  
  //initialise tilt sensor
  Serial.begin(9600);                  
  Wire.begin();
  Wire.beginTransmission(ADXL345);
  Wire.write(0x2D);
  Wire.write(8);
  Wire.endTransmission();
  delay(100);

  //X-axis cal
  Wire.beginTransmission(ADXL345);
  Wire.write(0x1E);  // X-axis offset register
  Wire.write(1);
  Wire.endTransmission();
  delay(100);
  
  
  //Y-axis cal
  Wire.beginTransmission(ADXL345);
  Wire.write(0x1F); // Y-axis offset register
  Wire.write(-2);
  Wire.endTransmission();
  delay(100);

  
  //Z-axis cal
  Wire.beginTransmission(ADXL345);
  Wire.write(0x20); // Z-axis offset register
  Wire.write(-2);
  Wire.endTransmission();
  delay(100);
  
}

void loop() {
  Wire.beginTransmission(ADXL345);
  Wire.write(0x32);
  Wire.endTransmission(false);
  Wire.requestFrom(ADXL345, 6, true);
  X_out = ( Wire.read() | Wire.read() << 8);
  X_out = X_out/256;
  Y_out = ( Wire.read() | Wire.read() << 8);
  Y_out = Y_out/256;
  Z_out = ( Wire.read() | Wire.read() << 8);
  Z_out = Z_out/256;

  Serial.println("RAW: ");
  Serial.print("Xa= ");
  Serial.print(X_out);
  Serial.print("   Ya= ");
  Serial.print(Y_out);
  Serial.print("   Za= ");
  Serial.println(Z_out);
  Serial.println("  ");
  delay(200);

  roll = atan(Y_out / sqrt(pow(X_out, 2) + pow(Z_out, 2))) * 180 / PI;
  pitch = atan(-1 * X_out / sqrt(pow(Y_out, 2) + pow(Z_out, 2))) * 180 / PI;
  // Low-pass filter
  rollX = 0.94 * rollX + 0.06 * roll;
  pitchY = 0.94 * pitchY + 0.06 * pitch;
  
  lcd.begin(8, 2);
  lcd.print("X: ");
  lcd.print(rollX+6, 0);
  lcd.write((char)0b11011111);
  lcd.setCursor(0,1);
  lcd.print("Y: ");
  lcd.print(pitchY+1, 0);
  lcd.write((char)0b11011111);
  delay(200);

  Serial.println("FINAL: ");
  Serial.print("X: ");
  Serial.print(rollX+6, 0);
  Serial.print("˚");
  Serial.print("    Y: ");
  Serial.print(pitchY+1, 0);
  Serial.println("˚");
  Serial.println("–––––––––––––––––––––––––––––––––––––––");
  delay(200);
}


Rotary Encoder

In this experiment I built an eight step rotary encoder with photo interrupters. It is used to read forward and backward steps. With these data I am able to read a direction, in my case, the direction the wind is blowing.


First Code (not working properly at this stage)

int sensorA;
int sensorB;

int stepOld;
int step;

long PulseCount;

#define SENSOR_A 4
#define SENSOR_B 2

void checkState(){
  sensorA = digitalRead(SENSOR_A);
  sensorB = digitalRead(SENSOR_B);

  if(sensorA == 1 && sensorB == 1){
    step = 0;
    if(stepOld == 1){
      PulseCount--;
    }
    if(stepOld == 3){
      PulseCount++;
    }
    stepOld = 0;
  }

  if(sensorA == 0 && sensorB == 1){
    step = 1;
    if(stepOld == 2){
      PulseCount--;
    }
    if(stepOld == 0){
      PulseCount++;
    }
    stepOld = 1;
  }

  if(sensorA == 0 && sensorB== 0){
    step = 2;
    if(stepOld == 3){
      PulseCount--;
    }
    if(stepOld == 1){
      PulseCount++;
    }
    stepOld = 2;
  }

  if(sensorA == 1 && sensorB == 0){
    step = 3;
    if(stepOld == 0){
      PulseCount--;
    }
    if(stepOld == 2){
      PulseCount++;
    }
    stepOld = 3;
  }

}

void setup() {
  
  Serial.begin(115200);
  Serial.print("                ");
  Serial.print("                ");

  attachInterrupt(0, checkState, CHANGE);
  attachInterrupt(1, checkState, CHANGE);

  PulseCount = 0;
}

void loop() {
  Serial.print("Steps:");
  if(PulseCount > -1){
    Serial.print(" ");
  }

  if(PulseCount < 10 && PulseCount > -10){
    Serial.print(" ");
  }

  if(PulseCount < 100 && PulseCount > -100){
    Serial.print(" ");
  }

  Serial.print(PulseCount);
  if(sensorA == 1){
    Serial.println("  HIGH");
  }
  else{
    Serial.println("  LOW ");
  }

  if(sensorB == 1){
    Serial.println("            HIGH");
  }
  else{
    Serial.println("            LOW ");
  }

}



Next steps: get the rotary encoder working, with interrupts and roll-overs, get the "tachometer" working and connect them to computer fans, to control them.