Introduction: Project F.A.N

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

Welcome to Project F.A.N a combination of 3D printed parts, some electronic components, and a little code to allowing you to create your very own desk fan from scratch. The fan is able to turn on/off, oscillate, and output the current room temperature via a temperature sensor onto an LCD screen.

Supplies

1x Arduino

2x Bread Board

1x 9 volt battery

1x DC Motor

1x DP Switch

1x LCD screen

3x 10k Ohm Resistor

1x Diode

1x Temperature Sensor

1x NPN Transistor

Jumper cables

Step 1: Step 1: Setup

The system utilizes two breadboards to allow for the DP switch controlling the fan to be place externally on the base. Also note for the LCD screen i used the SDA and SCL pins paired with the wire header file in order for it to be fully functioning while reducing the number of cables.

The temperature sensor is connected to analog 0 allowing us to read the values that are being input.

The servo is connected to pin 9 allowing us to send the signals oscillating the servo motor.

The Dc motor is attached to pin 12 allowing for us to turn on and off the fan.

The LCD screen uses Analog A4 and A5 to the SDA and SCL pins on the back of the LCD.

Finally the DP switch is connected to pins 2 and 5 allowing us to toggle the functions.

Also very important the DC motor is connected to the transistor and diode to to modify the current running through the motor.

Step 2: Step 2: the Code

//First we include all the necessary libraries allowing us to use our lcd screen and servo

#include

#include

#include //we call to action the servo using the commands from the servo libraryServo myservo;//we set our variables setting ThermPin to analog 0int ThermPin = A0;
int temp;// These variables are going to allow us to set the servo positions

int pos = 0;

int pos2 = 45;

// These pins are for reading the DP Switchconst int buttonPin1 = 2;

const int buttonPin4 = 5;

int buttonState1 = 0;

int buttonState4 = 0;

//setting up our motor to a pwm pin

int motorPin = 12;

//setting up the layout of the LCD screen

LiquidCrystal_I2C lcd(0x27, 16,2);

void setup() {

// First we serial begin and initiate our screen lighting it up

Serial.begin(9600);

lcd.init();

lcd.backlight();

// we use servo commands to pair the servo to pin 9

myservo.attach(9);

// we setup the two buttons as inputs and the motor pin as an output

pinMode(buttonPin1, INPUT_PULLUP);

pinMode(buttonPin4, INPUT_PULLUP);

pinMode (motorPin, OUTPUT);

}

void loop() {

// We first read the input value from our temperature sensor

temp = analogRead(ThermPin);

// We then use a conversion factor converting the value to degree Fahrenheit

temp = temp * 0.48828125;

//Here we are printing to our LCD screen

lcd.setCursor(0,1);

lcd.print("Temp: ");

lcd.print(temp);

lcd.print(" *F ");

lcd.setCursor(0,0);

lcd.print("PROJECT F.A.N");

//we read if the switches are enabled

buttonState1 = digitalRead(buttonPin1);

buttonState4 = digitalRead(buttonPin4);

//if switch 4 is enabled the motor turns on

if(buttonState4 == HIGH){ digitalWrite(motorPin, HIGH);

delay(1000);

digitalWrite(motorPin, LOW);

}

//if not the motor stays off

else {

digitalWrite(motorPin, LOW);

}

// If switch 1 is enabled the Oscillation begins

if (buttonState1 == HIGH) {

//The oscilattion turns the servo from 0 to 90 degrees and then returns

for (pos = 0; pos <= 90; pos += 1) {

myservo.write(pos);

delay(20);

}

for (pos = 90; pos >= 0; pos -= 1) {

myservo.write(pos); delay(20);

}

//if switch is disabled the servo returns to 45 degrees, a middle neutral position

} else {

myservo.write(pos2); delay(50);

}

}

Step 3: Step 3: 3D Printed Components

I will link the designed parts, Scale as necessary for your desired fan parts. I would also suggest using supports for the creation of the fan blade as its fairly thin.

Step 4: Step 4: Create

Good luck creating this project, below is a video showcasing my creation and its features for those interested.

For any questions you can contact me at

Thehenrypool@gmail.com

Enjoy Building!