Temperature Controlled Fan !

Introduction: Temperature Controlled Fan !

Living in a tropical country like Singapore, it is frustrating to sweat all day and meanwhile, you need to focus on your study or work in such stuffy environment. To make the air flowing and cool yourself off, I came up with the idea of temperature controlled fan which will switch on automatically when the temperature reaches 25 Celsius (That is when most people start to feel hot )and the fan speed even increases and brings stronger wind at 30 Celsius.

Components needed:

1.One Arduino Uno.

2.One Temperature Sensor(TMP36 which has analog output).

3.One TIP110 transistor.

4.One 6V DC Motor with fan blade.

5. One diode(1N4007).

6.One LED.

7.Two resistors(220Ohm and 330Ohm)

8.6V Power Supply.

Step 1: Create a Schematic

Here is the schematic I have created for this project using Eagle.

The temperature sensor circuit gives the analog input based on which the motor is switched on and varies its speed. As shown in the pin layout above, pin1 should be connected to the power supply. Since TMP36 operates well under voltage of 2.7V to 5.5V(from datasheet), 5V from Arduino board is enough to power the temperature sensor. Pin 2 outputs analog voltage value to A0 pin in Arduino which is linearly proportional to centigrade temperature. While Pin3 is connected to the GND in Arduino.

Based on the temperature detected, the PWM pin 6 will "output different voltage"(different voltage is achieved by switching on and off the signal repeatedly) to the base of the TIP110 transistor. The R1 is used to limit the current so it won't exceed the max base current (for TIP110, it's 50mA based on the datasheet.) A 6V external power supply rather than the 5V from Arduino is used to power the motor as the large current drawn by the motor may destroy the Arduino. Transistor here also serves as a buffer to isolate the motor circuit from the Arduino for the same reason(prevent current drawn by motor to damage the Arduino.). The motor will spin at different speed at different voltage applied to it. The diode connected to the motor is to dissipate the induced emf generated by the motor at the moment we switch on and off the fan so as to prevent transistor from damage.(sudden change in current will induce back emf which can damage the transistor.)

Digital pin 8 is connected to LED which will light on when fan is spining, resistor R2 here is for limiting the current.

Note*: All components in the circuit share the same ground so there is a common reference point.

Step 2: Coding

Comments in my coding have explained every step, the following is the supplementary information.

The first part of my coding is to define all the variables and pins(First Photo):

Line 1: Temperature is defined to be float so it is more accurate.

Line 3 & Line 4: The minimum temperature at which the fan is switched on can be customized to be other values as well as the "tempHigh" at which fan spins faster.

Line 5: The fan pin can be any PWM pins ( pin 11,10,9,6,5,3.)

The second part of my coding is to control the whole circuit(Second Photo):

Line 3 & Line 4: The analog-to-digital converter in Arduino get the value of an analog signal from analogRead() and returns a digital value from 0-1023(10-bit). In order to convert the digital value to temperature, it is divided by 1024 and multiply by 5 V to calculate the digital voltage output from the temperature sensor.

Line5 & Line 6: According to the datasheet of TMP36, it has a voltage offset of 0.5V so the 0.5v is subtracted from the original digital voltage to get the actual voltage output. Lastly, we multiply the actual voltage with 100 as TMP36 has a scale factor of 10mV/degree Celsius. (1/(10mV/degree Celsius))=100degree celsius/V.

Line 18 & Line24: PWM Pin outputs voltage ranging from 0-5V. This voltage is determined by the duty cycle ranging from 0-255 with 0 representing 0% and 255 representing 100%. So the "80" and "255" here are the fan speed.

Step 3: Testing and Soldering

After drafting the schematic and coding, it's time to test the circuit out on the breadboard!

Connect the circuit as shown in the schematic.

I used a 9V battery during this phase that is not appropriate for a 6V DC motor, but it should be okay to connect them together for a short while. During the actual prototype, I used external power supply to power 6V for the motor. After testing, the circuit is shown to work well. So it is time to solder them on a stripboard!

Before soldering the circuit...

It is good to draw the circuit on a Stripboard Layout Planning Sheet to plan the where to put the components and where to drill holes. Based on my experience, it is easier to solder when you leave a column between two solderings.

When soldering...

Be cautious about components with polarity. In this circuit, they will be the LED whose longer leg is the anode and diode whose grey part is the cathode. The pinout of TIP110 transistor and that of TMP36 temperature sensor should also be considered.

Step 4: Demostration

To make the whole circuit neat and not that messy, I use the female to male header to stack the stripboard on the Arduino while connecting to the pin in the Arduino. I also 3D print a fan holder to hold the fan, the stl file is attached below. During the demonstration, I use the external power supply as my 9V battery is not working.

The final demonstration video is attached above. Thank you for watching!

Be the First to Share


    • The 1000th Contest

      The 1000th Contest
    • Battery Powered Contest

      Battery Powered Contest
    • Hand Tools Only Challenge

      Hand Tools Only Challenge