Introduction: Computer Engineering Final Project: Temperature Regulated Fan

For my project, I decided to design a fan that responds to changes in temperature. When the temperature gets above a certain point, the fan will kick in to try to bring the temperature down. This is done through an Arduino Kit, a DC motor with a 3D printed fan, foam board, and lots of Duck Tape (lol).

Step one is to gather all the supplies.

(above are pictures of some of the electronic components needed)

*Make sure you have Arduino installed on a computer!!!

Supplies

DC Motor

Jumper wires (Tons!)

Arduino Uno R3 or RedBoard

Breadboard

330Ω Resistors

PN2222 Transistor

1N4001 diode

Temperature Sensor

LED

Paper and Pen

CAD software

Large foam poster board

Cutter Knife

Ruler

Lots of Duck Tape

Step 1: Setting Up the Motor

1. Connect Ground to the negative and 5V to the positive.

2. Place the transistor with the flat side facing right.

3. Connect a wire from the 1st socket right of the transistor to Ground(-).

4. Connect a wire from the 3rd socket of the transistor to "d11".

5. Connect a 330 resistor from the middle socket to the other side of the Breadboard.

6. Connect a wire from the other side of the resistor to "-9" on the RedBoard.

7. Connect the black end of the DC motor to the same row as the other side of the wire that connects to the 3rd socket of the transistor.

8. Connect the red end of the motor to a row above.

9. Connect a diode from the row you just placed the red end of the motor to the row you placed the black end. (Make sure the part of the diode with the thick black tip is facing north).

10. Connect a wire from the row with the think black end of the diode to Power(+).

Basically, set up the motor exactly the way it is presented in the above image.

Step 2: Hooking Up the Temperature Sensor

On another area, on the same half of the breadboard (not on the opposite side like in the picture), the DC motor was attached, place the temperature sensor in the same direction the transistor was placed.

Connect:

Top - Ground(-)

Middle - A0 on RedBoard

Bottom - Power(+)

Basically: Follow the picture again without placing the temperature sensor on the other half of the Breadboard.

Step 3: The LED

Place the LED with the shorter end facing you

Connect a 330 resistor from the negative end of the LED to Ground(-)

Connect a wire from the positive end of the LED to pin 13

Congratulations, you have completed the setup!!

Step 4: Code Time

HERE IS A PICTURE OF THE FINAL WIRING SET UP ON MY BREADBOARD AND REDBOARD!!

Now for the code! The comments explain what each part does

//Variables
const int temperaturePin = 0;<br>const int motorPin = 9;
void setup()
{
  pinMode(motorPin, OUTPUT);
  pinMode(13, OUTPUT);
  Serial.begin(9600);
}
float getVoltage(int pin)
{
  return (analogRead(pin) * 0.004882814);
}
void loop()
{

// this tells you what the voltage and temperature is so that it can be printed in the Serial Monitor
  float voltage, degreesC, degreesF;
  voltage = getVoltage(temperaturePin);
  degreesC = (voltage - 0.5) * 100.0;
  degreesF = degreesC * (9.0/5.0) + 32.0;
  
//Prints the Stuff
  Serial.print("voltage: ");
  Serial.print(voltage);
  Serial.print("  deg C: ");
  Serial.print(degreesC);
  Serial.print("  deg F: ");
  Serial.println(degreesF);
  
  //If the temp gets higher than 80 degrees, then, turn on the fan
  if (degreesF >= 80){
    digitalWrite(13, LOW);
    motorOnThenOffWithSpeed();
  }

//if it is lowe than 80 degrees then flash the LED.
  else{
    digitalWrite(13, LOW);   // Turn on the LED
    delay(100);              // Wait for one second
    digitalWrite(13, HIGH);    // Turn off the LED
    delay(100);
  }
 
}
//This method opporates the fan. 
void motorOnThenOffWithSpeed()
{

//Variables
  int Speed1 = 200;  // between 0 (stopped) and 255 (full speed)
  int Time1 = 12000;  // milliseconds for speed 1
  int Speed2 = 0;   // between 0 (stopped) and 255 (full speed)
  int Time2 = 3000;  // milliseconds to turn the motor off
  //Turns it on for 12 seeconds then turns it off
  analogWrite(motorPin, Speed1);  // turns the motor On
  delay(Time1);                   // delay for onTime milliseconds
  analogWrite(motorPin, Speed2);  // turns the motor Off
  delay(Time2);                   // delay for offTime milliseconds
}

Step 5: Designing the Propeller

Go to Onshape and design a propeller that can fit on top of the gear attached to the DC motor.

Mine has 4 blades.

3D print it so it can be attached at the end of the motor.

In my project, I attach it as the last step because it was the last part that I received.

Step 6: The Box: Part 1 Holes Holes Holes

Cut a sheet of paper 17cm x 17cm.

Cut hole for LED.

Cut 3cm x 2.5 cm hole for the temperature sensor.

Cut 8cm (circumference) hole for the motor to go through.

Step 7: The Box: Part 2 Bringing Out the Foam Board

Cut two 17cm x 17 cm squares from a foam poster board. (One for the top and one for the bottom).

Use an Xacto knife and cut the exact same dimensions onto one of the 17 x 17 foam boards.

*From the picture, you can see how the holes allow space for the LED, Temperature Sensor, and Motor.

Step 8: The Box: Part 3 the Actual Box

Cut four 4cm X 17cm rectangles.

Use duck tape to create a box around the Arduino kit.

To make the hole from the motor smaller, cover it with tape or paper.

Step 9: The Box: Part 4 USB Slot

On the 4th side, the side with the USB, cut a slot wide enough to fit the USB through it.

Close up the last end with tape.

Step 10: The Box: Part 5 the Stand

Cut 4 tiny rectangle to serve as the wall of the temperature sensor slot.

Cut two 10 x 2.5 cm rectangles for the motor stand and cut semicircles for the motor to sit.

Create a slot at the bottom of one and place a small foam piece inside.

Hot glue stands in a triangle shape and tape down the motor onto the stand.

Secure the wires to the box with tape if needed.

Step 11: The Box: Part 6 the Housing

Cut two 17 x 16 cm rectangles for housing and duct tape them together.

Tape to the base of the box to create walls.

Cut one last 17 x 17 cm square and tape it on the top.

Step 12: Attaching the Fan

Finally, Attach the 3D printed fam piece to the motor, and you're finished!!

*In my case, The hole was not big enough to fit over the gear. So, I took the gear off, and hot glued the propeller on.

Step 13: Here Is a Video of the Project Working!!