Count the people that enter to a room and exit

Hi guys I need your suggestions on how to make such a thing I was thinking about receiver and led but I cant figure it out how counting people that are exiting can be done beside the people are getting in I'm really confused plz guide me

If you don't mind some error in the total number of people counted, then maybe a 3 beam trip wire system could work. If a person comes in, the first light beam would get cut, followed by the second light beam, followed by the third. And if the person goes the other way, then the beams would be cut in the reverse order. So could tell which way they're going by the timing of beam cutting. As for multiple people coming in .... this could get tricky. But if one person at a time, and if the rate of coming in is low... then maybe ok.

Hi Tnx for the reply would you give me a link of
3 beam trip wire description I couldn't find and people might come in together and of course fast I can't tell them go slow, so do you think by better programming this issue could be solved or it's a problem over hardware and can't do nth about it?
My overall point is understand somebody is in the room no matter how many and then when they exit immediately understand nobody is in. The movement sensors are not good for this reason because the person might settle and sit somewhere without any motion so the sensor thinks nobody is in there which is wrong.

Kind of like this.... click here

....except.... instead of 3 beams vertical.... make them horizontal, spaced apart. They don't need to be spaced apart too far. Even millimeters apart is good.

Unless the system thinks and sees like a real person (that's us), there's going to be some error involved. But then again, if lots and lots of people come in or out.... even a real person (doing the counting) can get mistakes too.

I got your point let me ask a question let's say two ppl are coming in for sure not at the same time a few milliseconds delay for the second person so when the first person arrives at the third beam the first goes to the first so can the system detect the second person at this situation?

And another question can I use something like an event like when the person goes to the beam of detects it immediately and comes here and does some operations I wanna do this 24/7/365 so I don't want to ruin the arduino and I should also consider this arduino should do some other things as well.

Stevemoretz:
I got your point let me ask a question let's say two ppl are coming in for sure not at the same time a few milliseconds delay for the second person so when the first person arrives at the third beam the first goes to the first so can the system detect the second person at this situation?

Basically three beams (1, 2, 3) at say 1 cm apart with beam 1 at the outside of the room.
Person walks in: beam 1 goes dark, then beam 2, then beam 3. When the person continues walking, after a while beam 1 will be up again, then beam 2, finally beam 3. That'd be the event of one person passing through. About half a second later or so the next person may walk in (people do tend to keep some distance from each other). When someone walks out, it's of course in reverse. The beams are so close together (2 cm between 1 and 3) that one person will have well cleared the beams before the next comes in. People don't usually walk that close together.

Add some detection for someone that turns around in the doorway (so the beams light back up in the order 3, 2, 1), and detection for waving hand (too short time of the beam blocked - too soon after someone passes through), and you should be pretty accurate.

If your doorway is so small only one person at a time can pass, there should be no problem with the beam method. Now if your doorway is much bigger, two people may walk together and you see only one. Or one may walk in as another walks out, and you don't see this. Putting it at leg level may give two signals (two legs); putting it at chest level you may miss children.

For cases where the passage is much bigger and many people walk in and out the same time the best option may be a camera and image recognition but that's way out of reach of an Arduino.

For a slightly easier image recognition problem, try a Panasonic infrared GridEye sensor mounted on the ceiling. Count the number of warm blobs in the room.

wvmarle:
Basically three beams (1, 2, 3) at say 1 cm apart with beam 1 at the outside of the room.
Person walks in: beam 1 goes dark, then beam 2, then beam 3. When the person continues walking, after a while beam 1 will be up again, then beam 2, finally beam 3. That'd be the event of one person passing through. About half a second later or so the next person may walk in (people do tend to keep some distance from each other). When someone walks out, it's of course in reverse. The beams are so close together (2 cm between 1 and 3) that one person will have well cleared the beams before the next comes in. People don't usually walk that close together.

Add some detection for someone that turns around in the doorway (so the beams light back up in the order 3, 2, 1), and detection for waving hand (too short time of the beam blocked - too soon after someone passes through), and you should be pretty accurate.

If your doorway is so small only one person at a time can pass, there should be no problem with the beam method. Now if your doorway is much bigger, two people may walk together and you see only one. Or one may walk in as another walks out, and you don't see this. Putting it at leg level may give two signals (two legs); putting it at chest level you may miss children.

For cases where the passage is much bigger and many people walk in and out the same time the best option may be a camera and image recognition but that's way out of reach of an Arduino.

Well wow Tnx for the complete reply I appreciate it . however i considered almost all you send before you mention it but not all of them. Got a question should the beams be 3 i think in theory 2 would be enough why do you say 3 all the time? I can't figure this out.

MorganS:
For a slightly easier image recognition problem, try a Panasonic infrared GridEye sensor mounted on the ceiling. Count the number of warm blobs in the room.

TNx for the suggestion can it work on arduino?looks to be convinceing when your project is all about knowing how many ppl are in one place but at I mentioned its a sub project and other projects run in the same time in arduino so image recognization even if possible would take all the calculating power and then can't do nth else.btw Tnx again.

The Grid-eye suggestion is a bit facetious. Yes it's possible but so far, I'm not aware of any shields for this sensor. You would have to design a PCB, which is not hard but probably not what you need to do at this stage.

3 beams helps resolve some of the ambiguities inherent in 2 beams. What happens if someone stops in the doorway and then goes back?

Aha Tnx so 3 beam is for that but it would take more pins something really involved my mind in for a long time the lack of pins imagine I want to to this project for 5 doors at the same time that would at least take 15 pins any idea about, is it possible to add pins to arduino?not by xbee and another arduino all of us know that analog pins can get 0 to 1023 numbers that would be 512 on and off boolean values so if there any module out there to add pins to arduino using this or any other thing Tnx for your replys.

Use port extenders, such as the PCF8574 or the MCP23008. Easy to add 64 ports that way, or if you add a second i2c bus even more.

Look for "port extender" or "multiplexer".

Depending on how far apart the doors are, it may be appropriate to put one Arduino at each door and have them communicate back to a master or central one.

Well wow Tnx guys awesome I didn't know such a thing exists and is possible.would you please introduce some simple tutorial to start with the I found some tutorials but they were advanced and complex not good for start.Tnx guys you're great!

I noticed that beam sensor is not i2c is it?