What it shows
Pulse width modulation switches a fan on and off thousands of times a second; the fraction of time it is on sets the average power and speed. The Arduino raises the duty cycle as the temperature climbs, as a computer cooling fan does.
The science
The Arduino pin 9 gives PWM with a duty cycle set by analogWrite from 0 to 255. The MOSFET gate needs about 4 V to switch fully on, and a logic-level type such as the IRLZ44N works from 5 V. The 100 Ω gate resistor limits the surge, and the 10 kΩ pull-down keeps the fan off if the pin floats during start-up. The diode across the fan absorbs the back-voltage spike when the fan coil is switched off.
Materials
Cost: under Rs 1,500. Many items come from home or from waste; spare parts such as LEDs, motors and wire are in the store.
- An Arduino Uno or Nano
- An LM35 temperature sensor
- An IRLZ44N logic-level N-channel MOSFET
- A small 5 V DC fan drawing under 200 mA
- A 1N4007 diode, a 100 Ω resistor and a 10 kΩ resistor
- A breadboard and jumper wires
- A USB power bank
Safety
For this project: USB power only. Keep fingers out of the fan blades. The MOSFET can get warm if the fan current is too high.
Never use mains electricity: power models with cells, batteries or a low-voltage adapter. Sharp and hot tools, flames and lab chemicals need an adult or your teacher beside you. Keep magnets, button cells and small parts away from young children, and wash your hands after making.
All the safety rulesStep by step
8 steps. Do them in order, and test each part before you go on to the next. Write what you notice in a notebook as you go.
Connect the LM35 to 5 V, A0 and GND as in the thermometer project.
Place the MOSFET with the gate, drain and source known from its sheet (left to right with the metal tab behind: gate, drain, source).
Connect the source to GND, the 10 kΩ resistor from the gate to GND, and the 100 Ω resistor from pin 9 to the gate.
Connect the fan red wire to 5 V and the black wire to the drain, with the 1N4007 across the fan, band to 5 V.
Write a sketch that reads the temperature, averaging ten readings.
Set the duty to zero below 28 degrees, rising in a straight line to 255 at 40 degrees using map() and constrain().
Warm the LM35 with your fingers or a hair dryer on a low setting held away and watch the fan speed up.
Print temperature and duty to the Serial Monitor and plot them on the Serial Plotter.
What you should see
The fan is off when cool and speeds up smoothly as the sensor warms, and slows again when it cools.
Viva questions
A teacher or a judge will ask how it works. Try to answer each question before you open it, then compare.
1What is PWM?
Switching power on and off quickly so that its average value is controlled by the on-time fraction.
2Why use a MOSFET rather than the pin?
The pin can supply only about 20 mA; the MOSFET switches the larger fan current.
3What does a logic-level MOSFET mean?
It turns fully on with about 5 V on the gate.
4Why add a pull-down resistor on the gate?
It keeps the gate low and the fan off while the Arduino pin is not driven.
Take it further
Add a second threshold that sounds a buzzer if the temperature passes 50 degrees.
Change one thing, measure what happens, and add a table or chart of your readings: that is what turns a model into your own investigation.
Free ebooks for this project
Robotics
Motors, Gears and Motor Drivers
Make things move: DC motors, servos, steppers and how to drive them
