Introduction: Induction Small Electric Fan

The electric fan when the temperature above 26 degrees it will automatically turn on, under 26 degrees it will close.

Step 1: Step 1 : Preparing the Material You Needs

1. Arduino (Leonardo)

2. Leonardo Wires

3. USB Cable

4. 300 motor

5. Relay

6. Temperature and humidity sensor module

7. Fan

8. LCD

9. Popsicle stick

10. Box

11. Decorating papers

Step 2: Step 2: Writing the Source Code

// DHT Temperature & Humidity Sensor

// Unified Sensor Library Example // Written by Tony DiCola for Adafruit Industries // Released under an MIT license.

// REQUIRES the following Arduino libraries: // - DHT Sensor Library: https://github.com/adafruit/DHT-sensor-library // - Adafruit Unified Sensor Lib: https://github.com/adafruit/Adafruit_Sensor #include #include LiquidCrystal_I2C lcd_I2C_27(0x27,16,2); // set the LCD address for a 16 chars and 2 line display

#include #include #include

#define DHTPIN 7 // Digital pin connected to the DHT sensor // Feather HUZZAH ESP8266 note: use pins 3, 4, 5, 12, 13 or 14 -- // Pin 15 can work but DHT must be disconnected during program upload.

// Uncomment the type of sensor in use: #define DHTTYPE DHT11 // DHT 11 //#define DHTTYPE DHT22 // DHT 22 (AM2302) //#define DHTTYPE DHT21 // DHT 21 (AM2301)

// See guide for details on sensor wiring and usage: // https://learn.adafruit.com/dht/overview

DHT_Unified dht(DHTPIN, DHTTYPE);

uint32_t delayMS;

void setup() { Serial.begin(9600); pinMode(10,OUTPUT); // Initialize device. dht.begin(); Serial.println(F("DHTxx Unified Sensor Example")); // Print temperature sensor details. sensor_t sensor; dht.temperature().getSensor(&sensor); Serial.println(F("------------------------------------")); Serial.println(F("Temperature Sensor")); Serial.print (F("Sensor Type: ")); Serial.println(sensor.name); Serial.print (F("Driver Ver: ")); Serial.println(sensor.version); Serial.print (F("Unique ID: ")); Serial.println(sensor.sensor_id); Serial.print (F("Max Value: ")); Serial.print(sensor.max_value); Serial.println(F("°C")); Serial.print (F("Min Value: ")); Serial.print(sensor.min_value); Serial.println(F("°C")); Serial.print (F("Resolution: ")); Serial.print(sensor. resolution); Serial.println(F("°C")); Serial.println(F("------------------------------------")); // Print humidity sensor details. dht.humidity().getSensor(&sensor); Serial.println(F("Humidity Sensor")); Serial.print (F("Sensor Type: ")); Serial.println(sensor.name); Serial.print (F("Driver Ver: ")); Serial.println(sensor.version); Serial.print (F("Unique ID: ")); Serial.println(sensor.sensor_id); Serial.print (F("Max Value: ")); Serial.print(sensor.max_value); Serial.println(F("%")); Serial.print (F("Min Value: ")); Serial.print(sensor.min_value); Serial.println(F("%")); Serial.print (F("Resolution: ")); Serial.print(sensor.resolution); Serial.println(F("%")); Serial.println(F("------------------------------------")); // Set delay between sensor readings based on sensor details. delayMS = sensor.min_delay / 1000;

lcd_I2C_27.init (); // initialize the lcd lcd_I2C_27.backlight();

}

void loop() { // Delay between measurements. delay(delayMS); // Get temperature event and print its value. sensors_event_t event; dht.temperature().getEvent(&event); // if (isnan(event.temperature)) { // Serial.println(F("Error reading temperature!")); // } // else { // Serial.print(F("Temperature: ")); // Serial.print(event.temperature); // Serial.println(F("°C"));

if (event.temperature >=26.0) { digitalWrite(10,HIGH); }

else //( event.temperature < 26.0) { digitalWrite(10,LOW); } // } // Get humidity event and print its value. // dht.humidity().getEvent(&event); // if (isnan(event.relative_humidity)) { // Serial.println(F("Error reading humidity!")); // } // else { // Serial.print(F("Humidity: ")); // Serial.print(event.relative_humidity); // Serial.println(F("%")); // }

lcd_I2C_27.clear(); lcd_I2C_27.setCursor(0 , 0) ; // set the cursor, counting begins with 0 // lcd_I2C_27.print( "temp" ); // Print a message to the LCD. // lcd_I2C_27.setCursor(0 , 10) ; // set the cursor, counting begins with 0 lcd_I2C_27.print( event.temperature ); // Print a message to the LCD. }

Step 3: Step 3: Connect the Component by the Wires

Step 4: Step 4: Compile the Source Code and Upload