Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

microcontroller to adjust fan speed

Not open for further replies.


New Member
I'm designing a PIC based project, which involves using the microcontroller to control the fan speed in an enclosed room with two exits.

The circuit will detect the temperature and density of people in the room, and send a signal to adjust the speed of the fan accordingly..i.e: raise the fan speed if the temperature is low/ many people in the room etc.

Does anyone have any useful tips/ links or experience with this? I'm a relative newbie to microcontrollers and this is my final year degree project.

Its still in the proposal stage but any help would be of great use.

Anybody have any ideas on what type of circuit to use to calculate the density of people in the room?


New Member
A fan cannot cool a room all it does is push air, so looking at a fan that is temperature controlled will not work because if it is a hot day then the fan will be on full speed with no one in the room.

If you want to control the fan just to speed up with more people in the room maybe controlling it off CO2 sensor would be the answer. Most commercial sensors output a 0-10vdc output for connection to BMCS (Building Management Control System) the program just ramps up or down the output when the figure gets out of the set point.

You have to work out your sample time and how responsive you sensor is no matter what sort of sensor you use static pressure, temperature, CO2, Humidity and so on.

There are way to many variables to advise you properly.

How big is the room compared to the fan? Will one of your exit doors be open or will you use spill air to control static pressure because if the doors are closed with no “spill air “ you will increase static pressure in the room until the fan can no longer push air.

Most of these controllers have a start point for the fan speed say 70%. Then increment the speed up or down depending on the reading and then wait for a new reading.

1 Start fan at 70%
2 Is the reading within the dead band (how far can the reading be out before the program responds)?
3 Is reading above or below set point?
4 What % is reading above or below to set amount to be incremented?
5 Change value to the fan speed
6 What is your sample time (how responsive is the fan and sensor) delay?
7 Goto 2


New Member
thanks for the input dingo.

Okay, but i still want it to be a 2 input system, so do u have any ideas for the other input?

do u have any links or tips on how to implemet a co2 sensor in the circuit?

if i still want to use a fan, what is the best parameter used to control it, if temperature is not suitable?


Active Member
Dingo's response gets at some of the questions I'd ask. If you actually plan to make this device and use it then it would seem that much more needs to be done. If it's a class project that is supposed to be simple then some simplifying assumptions can be made.

If the fan simply stirs up the air in the room and you want more movement as it warms then the task seems simple enough. The people density might be a challenge - sensing someone passing an opening isn't tough but knowing whether they entered or left isn't as easy.

If you are bringing in air that is cooler, in order to cool the room when people warm it up then that's one problem. If air that you might bring in isn't cool, or is actually warmer, you might need to account for that.

Some building codes allow carbon dioxide sensors to control the fresh air that must be brought in - some codes do not allow it - if the room is occupied it must be ventilated regardless of activity level. Some municipalities look closely at this - others do not.

Don't forget that along with people, lights, computers, etc all produce some heat that can warm a room.


New Member
If this is just a class project

Place 2 PE beams at each doorway depending on what beam breaks first you can tell if a person is entering or leaving the room. Count each person as they enter and subtract as they leave. This way you know how many people are in the room and can adjust fan speed to suit.

In real life this will not work because 2 people can enter at the same time or walk in front of the beams but not enter the room.


New Member
thanks for the idea dingo, but what method do u recommend for a final year bachelor's degree project to calculate the number of people?

Actually this whole thing was recommended by my supervisor, so i'm just trying to gather some info.

okay, provided that i do carry this out, can a PIC16F84A microcontroller do the job? To calculate the no.of people/temperature and control the fan speed? I really hope so because i already have the chip/programmer and the circuit to download the program on the chip.

Or do i need a higher level PIC?


New Member
I couldn't really advise you on PIC models or end of year projects for that matter.

As for using temp for control, unless the fan is used in conjuntion with evaporation, radiator or pushes air of a different temp it cannot influence temperature in a room. I suppose you could assume that the air you are pushing is cool air.

CO2 sensors are a little on the expensive side although a fan can influence the co2 content the people in the room will produce. If you just want to increase the complexity of the design how about using the PIC to control the pulse width modulation to set the fan speed as well as counting the people that enter and leave the room. That would mean 4 inputs and a PWM output for the fan.


New Member
fan speed control using pic

i am doing the fan speed control project using pic contorller, i generated the pwm o/p for total time period of 2.5ms ,but the fan is working with some noise. can any one help to me.
Not open for further replies.

Latest threads