smart-fan prototype

Dean Ciofani

Sean Mckensie

PJ Niedzwicki

 

The concept for our project is taking a measurable environmental variable, translating this variable, and

altering the immediate environment. Currently the system is setup to measure the humidity of the

room, and then translate this data to what is colloquially known as an “if then” statement. If the

humidity is deemed too high, according to written the program, then the system provides power to a

fan.

 

Concept Diagram 

 

diagram [Converted]

 

Circuit Diagram 

 

circuit diagram

 

Prototype Photograph 

Untitled

 

Code Used

 

// LED connected to digital pin 9

// Digital pins with the ~ are able to do fading also known as PWM

int musclePin = 8;

// Setting my musclewire to pin 9

int repeat;

unsigned long time;

#include <SHT1x.h>

// Specify data and clock connections and instantiate SHT1x object

// I installed the SHT1x library into the sketchbook

#define dataPin 10

// data pin is the blue wire

#define clockPin 11

// clock is the yellow wire

SHT1x sht1x(dataPin, clockPin);

void setup()

{

Serial.begin(9600); // Open serial connection to report values to host

Serial.println(“Starting up”);

pinMode(ledPin, OUTPUT);

pinMode(musclePin, OUTPUT);

}

void loop()

{

float temp_c;

float temp_f;

float humidity;

// Read values from the sensor

temp_c = sht1x.readTemperatureC();

temp_f = sht1x.readTemperatureF();

humidity = sht1x.readHumidity();

// Print the values to the serial port

Serial.print(“Temperature: “);

Serial.print(temp_c, DEC);

Serial.print(” C / “);

Serial.print(temp_f, DEC);

Serial.println(” F.”);

Serial.print(“Humidity: “);

Serial.print(humidity);

Serial.println(“%”);

time =millis();

Serial.print(“Time: “);

Serial.println(time);

delay(repeat);

if(humidity <= 70 || humidity == 100){

digitalWrite(musclePin, HIGH);

for (int fadeValue = 0 ; fadeValue <= 255; fadeValue++) {

// sets the value (range from 0 to 255):

analogWrite(ledPin, fadeValue);

// wait for 30 milliseconds to see the dimming effect

delay(5);

}

// fade out from max to min in increments of 5 points:

for (int fadeValue = 255 ; fadeValue >= 0; fadeValue–) {

// sets the value (range from 0 to 255):

analogWrite(ledPin, fadeValue);

// wait for 10 milliseconds to see the dimming effect

delay(5);

repeat = 0;

}

}

else

digitalWrite(musclePin, LOW);

digitalWrite(ledPin, LOW);

}

 

 

 

Code (semi)optimized 

int fanPin = 8;

int repeat;

unsigned long time;

#include <SHT1x.h>

#define dataPin 10

SHT1x sht1x(dataPin);

void setup()

{

Serial.begin(9600); // Open serial connection to report values to host

Serial.println(“Starting up”);

pinMode(fanPin, OUTPUT);

}

void loop()

{

float temp_c;

float temp_f;

temp_c = sht1x.readTemperatureC();

temp_f = sht1x.readTemperatureF();

humidity = sht1x.readHumidity();

// Print the values to the serial port

Serial.print(“Temperature: “);

Serial.print(temp_c, DEC);

Serial.print(” C / “);

Serial.print(temp_f, DEC);

Serial.println(” F.”);

if(temperature <= 70 || temperature == 100){

digitalWrite(fanPin, HIGH);

for (int fadeValue = 0 ; fadeValue <= 255; fadeValue++) {

// sets the value (range from 0 to 255):

delay(5);

}

// fade out from max to min in increments of 5 points:

for (int fadeValue = 255 ; fadeValue >= 0; fadeValue–) {

// sets the value (range from 0 to 255):

// wait for 10 milliseconds to see the dimming effect

delay(5);

repeat = 0;

}

}

else

digitalWrite(fanPin, LOW);

}