loading

This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com)

Required Components

-Arduino Uno Micro Processors

-Breadboard

-Electrician Tape

-LCD Crystal

-Thermistor

-IR Remote

-IR Receiver

-IBM 4 Pin PWN 12 V CPU Fan

-Male/Male Wires (pack)

-Male/Female Wires (pack)

-Resistor (100 Kilo-Ohm)

-Micro-Servo

-Walmart Desk Lamp

-Hot-glue gun

-Make Course Box

-3D Printed Parts

-9V Battery with connector into Arduino

Step 1: Mechanical Setup

-attach and glue the top hook of of the four legs of the CPU fan to the top edge of the dome of the lamp with the bulb inside

-place some glue on the other three hooks so they stick on the interior of the lamp dome

-3D print the first file attached "Support.ipt" and have the hooks be inserted and glued into the supported structure with bump facing downwards

-insert the screw that came with the rotor inside the servo to ensure the rotor does not fall off when the blade gets attached to the servo (ensure the rotor is facing forward at 90 degrees from the 0-180 degrees scale

-3D print the blade attached "Rudder.ipt" and carefully glue it extensively upright to the rotor that is screwed into the servo and let it dry

-use extensive amounts of electrical tape around the rotor to ensure that the servo and the blade are securely attached together

-glue the back ends and bump of the micro-servo into the front end of the support structure

-tape with electrical tape the servo with the support structure together with the wirings from the servo secure attached underneath the tape

-finally wrap the electrical tape around the top hook of the CPU fan to ensure that it is securely attached to the dome of the lamp

Step 2: Electronic Components

Arduino Setup:

-Connect the 5V Arduino pin to the Red Positive Terminal (+) on either side of the Breadboard

-Connect the GND Arduino pin to the Blue Negative Terminal (-) on the Breadboard

-Connect the 9V Battery to the Arduino using the positive/negative wire attached with the connecting head

Step 3: CPU Fan

-attach a wire from the black-wired part of the CPU fan to

ground on the negative (-) terminal of the breadboard (to ground)

-attach another wire from the yellow-wired part of the CPU to Arduino Pin 7

-use extra male/female wires as necessary on both to allow the wires to the reach from the breadboard to the fan inserted way up into the lamp

Step 4: Servo Attached to the Fan Blade

-attach a wire from the brown-wired part of the servo to

ground on the blue negative (-) terminal of the breadboard (to ground)

-attach another wire from the red-wired part of the servo to the red positive (+) terminal of the breadboard

-attach the final wire from the orange-wired part of the servo to Arduino Pin 10

Step 5: IR Receiver

-attach the female end of 3 of the male/female wires to all

three pins of the IR Receiver (tape the female ends to the pins with electrical tape

-attach the male end of the 3 wires on the breadboard next to each other, simulating the extension of the IR Receiver being connected to the breadboard itself

-attach the very far left of the pin (1st pin) in line with the wire extension to the back left of the IR Receiver (where the bump is on the other side of the pin) and connect it to Arduino Pin 3

-attach the middle part (2nd pin) of the IR Receiver pin extension to ground

-attach the furthest right part of the IR receiver final pin (3rd pin) to the positive (+) terminal of the breadboard

Step 6: Thermistor

-attach the female end of two of the male/female wires to both pins of the IR Receiver (tape the female ends to the pins with electrical tape to ensure the connection remains secure

-connect a wire from ground in series into the 100 kilo-ohm resistor where you then attach another wire from the other end of the resistor into the Arduino analog A0 pin

-connect the female/male wire extension from one end of the thermistor into the positive (+) terminal of the breadboard

-connect the other of the thermistor parallel to the other one of the resistor (the end in line with the wire that is connected to the analog pin)

Step 7: LCD Display Screen

-attach four female to female wires into the four combined pins of the LCD screen

-use four male/male wires to make extensions from the LCD to the Arduino and breadboard

-connect the end of the male wire pins to their respective outputs: GND to the negative (-) ground terminal of the breadboard, Vcc to the positive (+) terminal of the breadboard, and the remaining two wires to their respective Arduino pins (next to 13 and GND)

Step 8: Integration of All Components

-you can place all electrical components inside the given Make Course Box

-leave the component and the wirings of the IR Receiver, Thermistor, 9V battery connector, LCD and the wirings to the Fan and servo outside the edge of the box

-gently screw in the lid on top of the box making sure it is not too tight or else it will interfere with the wiring components causing major glitches

-use the electrical tape to tidy up the and support loose wires around the LCD Screen and the lamp for the wirings to the servo and CPU fan (careful for the pins to not disconnect during the taping)

-attach and support the base of the lamp to the top of the box with glue for the control system to be completely integrated

Step 9: Activation of Fan

-with thesuccessful integration of the mechanical, electrical and Arduino sketch components, the blue (+) would activate the system with the status of the fan being printed on the LCD screen

-the fan should run for 45 seconds (If you want to change the run cycle, adjust the variable originally "int countdownInput = 46;" in the first while loop to your wanted duration added by 1 to compensate for the iteration of the loop)

-it will only operate when the thermistor sense it's surrounding temperature to be over 30 Degrees Celsius and turn off if the temperate is below that (you can adjust the activation temperature by changing the variable "int temperatureInput = 30;" to whatever you want it to be

-after the cycle has finished, there will be a very short delay period before you can activate the fan again by pressing the blue "+" button

-if the system glitches up, it is due to the 9V battery running out so if that is the case, simply replace the battery with another battery attached the connector

Step 10: The Arduino Sketch

#include //Import the IR Remote Library into the skectch

int RECV_PIN = 3; //Declare the pin number for the IR Receiver

int FAN_PIN = 7; //Declare the pin number for the CPU Fan

#include //Allow to calculate math functions into this sketch

#include

#include //Standard LCD Library

#include //Arduino standard servo library

#define servopin 10 //Declare the pin number for the servo which will turn the blade

Servo myservo; //Instantialize the servo

LiquidCrystal_I2C lcd(0x27,16,2); //Instantialize the LCD

//Calculate the temperature from the thermistor

double Thermistor(int RawADC) {

double Temp;

Temp = log(10000.0*((1024.0/RawADC-1)));

Temp = 1 / (0.001129148 + (0.000234125 + (0.0000000876741 * Temp * Temp ))* Temp );

Temp = Temp - 273.15;

return Temp;

}

int val; //initialize the "val" variable as the angle of the servo blade

IRrecv irrecv(RECV_PIN);

decode_results results;

void setup() {

// initialize the digital pin as an output.

pinMode(RECV_PIN, INPUT);

pinMode(FAN_PIN, OUTPUT);

irrecv.enableIRIn(); // Start the receiver

lcd.init(); // initialize the lcd

lcd.backlight(); // initialize the backlight

myservo.attach(servopin); //initialize the servo

Serial.begin(9600);

}

void loop() {

// Declaring hexadecimal value sent from the IR Remote

long FAN_ON = 0xFFA857; // the "+" button of the remote

long FAN_OFF = 0xFFE01F; // the "-" buttom of the remote

// Printing out the LCD Display in a consistent cycle

lcd.clear();

lcd.print("Turn fan on");

delay(2000);

//activate the IR Input proceess once they receive an IR signal

if (irrecv.decode(&results)) {

int temperatureInput = 30; // set the activation temperature as 30 degrees celsius

val = 180; //set blade motor all the way to the side

myservo.write(val);

//Turning off the fan if "-" button is pushed

if (results.value == FAN_OFF){

Serial.println ("Fan off");

digitalWrite(FAN_PIN,LOW); //Turns off the fan

boolean ON = false; //setting condition that fan is not on

}

// Activating the fan if the IR "+" is pressed

else if (results.value == FAN_ON)

{

Serial.println ("Fan on");

digitalWrite(FAN_PIN,HIGH); //Turns on the fan

boolean ON = true; //set condition that the fan is turned on to true

//while loop to keep tract of time and the temperature whilst the fan is activated

while(ON = true)

{

int countdownInput = 46; //sets how long you want to turn the fan on for (+1 second)

int countdownInputFinal = countdownInput + 2; //compensating for delay in the fan timing

// countdown while the time is not = 0 (the variable 2 will when the LCD will print "0" due to the delay)

while (countdownInputFinal != 2){

countdownInputFinal = countdownInputFinal - 2; //decriment the time by two second

thermister(temperatureInput,countdownInputFinal); //call the temperature sensing function with the above variables as inputs

}

//turn off the fan when times is up (when variable is 2, but will print "0" instead of "-2")

if (countdownInputFinal == 2) {

for(int i = 0; i < 15; i++) {

lcd.clear();

lcd.print("WAKE UP!"); //print waking up message

digitalWrite(FAN_PIN,LOW); // turn off the fan

myservo.write(90); // point the fan blade forward

delay(1000); //delay for 1 second

}

break; //break the loop when the fan has been turned off

}

}

}

irrecv.resume(); // Receive the push of the button

}

}

//function to calculate

void thermister(int temperatureSettings, int countdown)

{

//Declaring variables

int val;

double temp;

val=analogRead(0); //determining which angle the servo blade will turn

temp=Thermistor(val); //takes in temperature value from the thermistor

delay(500);

countdown = countdown - 2; //decriment the time by two seconds as a countdown

lcd.clear();

//if the temperature is above the activation temperature, the fan will turn on

if((temp >= temperatureSettings) || (temp < -4)) //set temp < -4 incase battery is running low affecting the thermistor values

{

myservo.write(45); // turn the fan midway to the left

Serial.println ("Fan on");

digitalWrite(FAN_PIN,HIGH); // turn fan on

lcd.print("Fan on"); // print fan status on the LCD Screen

lcd.setCursor(0,1);

// then we print at the cursor position

lcd.print("Time left: "); // printing how much time for the fan cycle is remaining

lcd.print(countdown);

lcd.print("sec");

delay(1000);

myservo.write(135); // turn the fan midway to the right

lcd.clear();

lcd.print("Temp="); // print the temperature in Celsius on the LCD Screen

lcd.print(temp);

lcd.print("C");

lcd.setCursor(0,1);

//then we print at the cursor position

lcd.print("Time left: "); //printing how much time for the fan cycle is remaining

lcd.print(countdown);

lcd.print("sec");

//turn off the fan if the temperature is below the activated temperature

} else if ((temp < temperatureSettings) || (temp > -4)) {

myservo.write(90); // face the blade directly straight ahead

Serial.println ("Fan off"); // print status of the fan

digitalWrite(FAN_PIN,LOW); // turn off the fan

lcd.print("Fan off");

lcd.setCursor(0,1);

//then we print at the cursor position

lcd.print("Time left: "); // printing how much time for the fan cycle is remaining

lcd.print(countdown);

lcd.print("sec");

delay(1000);

lcd.clear();

lcd.print("Temp="); // print the temperature in Celsius on the LCD Screen

lcd.print(temp);

lcd.print("C");

lcd.setCursor(0,1);

//then we print at the cursor position

lcd.print("Time left: ");

lcd.print(countdown);

lcd.print("sec");

}

}

<p>That is a good idea. I have a temperature activated heater in the winter. Why not have a temperature activated fan for the summer. </p>

About This Instructable

711views

10favorites

License:

More by PeterN121:Temperature Activated Portable Fan System 
Add instructable to: