DC moter - air conditioning system

Submitted by wendy.xue on Tue, 03/12/2013 - 16:05

Description

This is an automated air conditioning system. Imaging the photocell as a thermometer. When it's dark at night, little light shines on the photocell and therefore the room temperature is cool. As the sun rises, more light comes into the room and heats it up. When the heat reaches a threshold, the air conditioner (the fan driven by the DC motor) is automatically turned on. As long as the temperature is above the threshold, the air conditioner remains on, but the speed of the fan varies as the temperature (amount of lights shine on the photocell) increases or decreases. 

Components

1- Arduino Uno
1- Breadboard
1- Photocell sensor
1- DC Motor
1- Diode
1- Transistor
1- 3V Battery Power
1- 1kΩ Resistor
1- 10kΩ Resistor
2 - pieces of magic tap
1- brown vitamin bottle 

Code

/* 
* photocell controls the speed of moter. 
* Calibrated photocell reading to room light by offset 600 from initial reading 
*/ 
int potPin = A0; // select the input pin for the photocell 
int motorPin = 9; // select the pin for the Motor 
int val = 0; // variable to store the value coming from the sensor 
int temperature = 20; //room temperature threshold 
int offset = 600; //offset of room light 

void setup() 
{ 
  Serial.begin(9600); 
} 
void loop() 
{ 
  val = analogRead(potPin); // read the value from the sensor, between 0 - 1024 
  val = val -offset; 
  if (val/4 > temperature) 
  { 
    Serial.println(val/4); 
    analogWrite(motorPin, val/4); // analogWrite can be between 0-255 
  } 
  else 
  { 
    analogWrite(motorPin,0); 
  } 
}

Demo

0
Your rating: None
Drupal theme by Kiwi Themes.