Blog

August 12, 2019

Arduino + Integrated Design

M.A. Thesis, Integrated Design based on Functional Paradigms

Dynamic Module based on Environmental and Structural Integration

All we need to have an Integrated system is to know how to handle parameters connectivity with each other. The main question is what would be possible if we can have the whole scenario from design, analysis toward fabrication altogether. In this project (My M.A Thesis), I have tried to define this path from Environmental Factors to Structural ones. While the module has been designed here had to work with temperature and relative humidity affected by wind and the ambiance under the pavilion, it had to react to Load cases either. The detailed story can be found here in this post but the codes related to how the module was working is defined here.

// Stepper by Sensors

/*============================================================================
This code is preparing for running a stepper in both clockwise and conterclockwise rotation controled by temp and humidity sensor inputs. The aim is also adapted to a prototype and could not be appropriate for simillar situations. But it can be used as a sample of how these parameters can come together.
in addition, by all means of thanks to whose tries are included, you can modify,
use free, update this code and just please tell us to share new ideas and improvments.
============================================================================*/

//The Code Below has been Written By Mahdi Soheyli Fard // M.Soheylifard@gmail.com
//Lots of cool libraries gotten from references staff on www.arduino.cc
//tBeat and Timer library for time scheduling and event processing
//DHT for sensor DHT22
//the code also is a combination of samples and modifications toward the aim


// THE TIME SCHEDULE DEFINING PART
//==============================================================================
#include "Arduino.h"
#include "tBeat.h"
#include "Timer.h"
Timer t;
int Delta_t;
 

//==============================================================================


// THE FUNCTIONS DEFINING PART
//==============================================================================
void ccw_r(); //counterclockwise rotation function for stepper void cw_r();  //clockwise rotation function for stepper
//==============================================================================


// THE SENSOR DEFINING PART
//==============================================================================
#include "DHT.h"
#define DHTPIN 2  // what pin we're connected to in Arduino Board
#define DHTTYPE DHT22 // DHT 22 as Library saved in Arduino Folder in MyDocuments
DHT dht(DHTPIN, DHTTYPE);
//==============================================================================


// VOID SETUP PART
//==============================================================================
void setup() {
Serial.begin(9600);
Serial.println("First is Humidity, Second is Temp, Third is Delta(t)!");
tBeat.init();
tBeat.start();
 

dht.begin();


// initialize the digital pin as an output on Arduino Board for connecting the STEPPER. pinMode(8, OUTPUT);
pinMode(9, OUTPUT); pinMode(10, OUTPUT); pinMode(11, OUTPUT);
}
//==============================================================================


// VOID LOOP PART
//==============================================================================
void loop() {

// Delta_t Figuring out by sensor performing

// Read the Humidity as % 
float h = dht.readHumidity();
// Read temperature as Celsius (the default) 
float t = dht.readTemperature();

// Check if any reads failed and exit early (to try again).
if (isnan(h) || isnan(t)) {
Serial.println("Failed to read from DHT sensor!");
 

return;
}

// Challenging the rotation of the motor to what really can be mapped
// If below break the rotation between 15 and 40 in Temp

if (h >= 70) {
h = 40;}  // the condition makes it to avoid going upper celcoius 40 degrees

else if (h <= 15) { h = 15;} // the condition makes it to avoid going lower celcoius 15 degrees else { h;} // This would keep the veriable 'h' to the same as it is int tx = dht.readHumidity(); static int fix_t = 0; int Delta_t = tx - fix_t; // the period which will define the rotation in minute, Delta(t) = t2-t1, fix_t = tx; if (Delta_t>0)  {
  tBeat.newHook((abs(Delta_t))*1, cw_r);

}
 

else if (Delta_t<0) { 
  tBeat.newHook((abs(Delta_t))*1, ccw_r);

}
else  { 
  Delta_t=0;
}


delay(100);
tBeat.exec();
Serial.print(h);
Serial.print(",");
Serial.print(t);
Serial.print(",");
Serial.print(Delta_t);
Serial.println(" ");
}

// FUNCTIONS PART
//==============================================================================
// both clockwise "(cw_r)" and counterclockwise "(ccw_r)" are written with functions below 
void cw_r() { //revolve clockwise
 

step1(); step2(); step3(); step4(); step5(); step6(); step7(); step8();

}

void ccw_r() { //revolve counterclockwise 

step1(); step7(); step6(); step5(); step4(); step3(); step2(); step1();

}

void step1(){ 
  digitalWrite(8, HIGH);
  digitalWrite(9, LOW);
  digitalWrite(10, LOW);
  digitalWrite(11, LOW);
;delay(1);

}
 

void step2(){ digitalWrite(8, HIGH); digitalWrite(9, HIGH); digitalWrite(10, LOW); digitalWrite(11, LOW); delay(1);
}

void step3(){ digitalWrite(8, LOW); digitalWrite(9, HIGH); digitalWrite(10, LOW); digitalWrite(11, LOW); delay(1);
 

}

void step4(){ digitalWrite(8, LOW); digitalWrite(9, HIGH); digitalWrite(10, HIGH); digitalWrite(11, LOW); delay(1);
}

void step5(){ digitalWrite(8, LOW); digitalWrite(9, LOW); digitalWrite(10, HIGH); digitalWrite(11, LOW);
 

delay(1);

}

void step6(){ digitalWrite(8, LOW); digitalWrite(9, LOW); digitalWrite(10, HIGH); digitalWrite(11, HIGH); delay(1);
}

void step7(){ digitalWrite(8, LOW); digitalWrite(9, LOW); digitalWrite(10, LOW);
 

digitalWrite(11, HIGH); delay(1);
}

void step8(){ digitalWrite(8, HIGH); digitalWrite(9, LOW); digitalWrite(10, LOW); digitalWrite(11, HIGH); delay(1);
}

//==============================================================================
// THE WHOLE FILE
 
Architecture, CAD/CAM, Coding, Computational Design, Digital Fabrication, Energy Analysis, Environmental Design, Fab Systems, Functional Paradigm, Integrated Design, OpenSource, Performative Design, Research & Development, Responsive Facade, Structure, Structure analysis, Structure Linear Analysis, Technical Design , , , , , , ,
0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments