The purpose of the project was to implement a system which can count the number of occupants in a closed area and control the speed of the fan according to the temperature. The implementation was carried out by three subsystems such as one system for occupant counting, one for temperature measurement and other to control the speed of fans. It was found out that this can be done using basically IR sensors (Transmitters and Receivers), a temperature sensor and a micro controller. But this implementation was carried out under certain assumptions. Under those assumptions this system works in a reasonably precise manner and serves the purpose and can be used in real world applications which adheres those assumptions. But this system can be further developed so that it can be used in any situation.
The micro controller we used was 16F877A. The temperature sensor was LM35DZ.
Here I am not going to explain how the circuits were built. My contribution to the project was mainly programming the micro controller. I preferred PIC C.
Since we had to do several tasks we had to decide how are we going to use the microcontroller to achieve the expected results.
Basic algorithm we had in mind was,
Occupants counting algorithm
Emitters (Emitter1 and Emitter 2) emit IR signals, which are received by Receiver1 and Receiver 2 respectively.
At the time when there is no interrupt the receiver will receive the IR signal.
When an interrupt is taken place that will be notified by the receiver.
If the Receiver 1 notices an interruption first and then the Receiver 2 it indicates an entrance to the closed area.
If the Receiver 2 notices an interruption first and then the Receiver 1 it indicates an exit from the closed area.
The time delay (T) between the detection of an interrupt by Receiver 1 and Receiver 2(or Receiver 2 and Receiver 1) will determine the time taken to travel between two sensors.
There is a ceiling value (T1) and a floor value (T2) for this time delay.
For the accuracy movement is taken as an exit or an entrance only if T1 < T < T2.
The increment or decrement of the counter is done according to the movement.
It was decided to use the B0 interrupt pin of 16F877A for people counting task.
But the problem was we had two IR beams but one interupt pin. So the solution was, connecting an XOR gate to the inputs from IR sensor circuit and connecting the gate's output to PIN B0, PIN B1 and PIN B2.
By this method we could successfully detect when a person enters or leaves.
To get the analog input from temperature sensor, PIN A0 was used.
To control the fan(AC), we used phase controlling.
Below is the source code. Hope to explain the project further.