Visitor Counter using PIC Microcontroller

im doing a project that use PIC microcontroller 18F452 to count visitor using C programming. the project consist of two sensor (sensor1 and sensor2). when the person enters the door, sensor1will detect it, followed by sensor2. then when the person leave the room, sensor2 will detect it 1st followed by sensor1. hence, i can calculate the number of people entering and leaving the room. but im facing a problem. my problem is what if a really big person stand in between both of the sensors for a certain period of time. my program will keep counting up although there is nobody leaving or entering the room. so how should i solve this problem.
These sensors. What are they reading? Do they have one state when blocked and another state when clear?

If so, you can simply sample them every tenth of a second, and only increase the count when the state goes clear->blocked->clear. If someone just stands there, the state changes will have been clear->blocked, and the system will just wait for the next clear before counting.
i have already figure it out to solve this problem. but then i got new problem which when a person stand on the both sensor, an error will occur. but how do i define when the person form outside, will the counter increase if the person decide to go in after he stand on the both sensor.
Topic archived. No new replies allowed.