I am new to the Arduino environment and I am planning to build a project involving counting the number of passes. The thing is I don't know which sensors are best to use. I was considering 2 ultrasonic sensors (beside counting I also need to know the direction so I need 2 sensors placed at a certain distance to detect if the movement is left-right or right-left), but 2 of those would probably interfere with each other, or 2 infrared obstacle avoidance sensors, but those don't seem to work at the distance I need (1-1,5 m). I know the alarm systems use a laser or some kind of beam which reflects on a surface and then returns - that seems to be the best solution, but I could find a sensor like that (probably a combination of 2 - emitter + receptor), but the best solution would be something that does not require any other objects (like a reflector).
What do you think I could use?
Is the opening you're wanting to track wide enough for multiple people to go through side by side? Or, can people walk both in and out at the same time? If so, no matter what type of system you use, your counting is going to be wrong.
It may be possible to do this with ultrasonic sensors. The sketch would ping one, then the other, with around 29-33ms of delay between the two. This would allow enough time for any echos to dissipate. For controlling two ultrasonic sensors you could use my NewPing library
which works well with multiple sensors. I'd put the sensors a few feet apart to make sure you get the correct direction.
Probably a better way is to use an optical beam with a reflector on the far side. Or, a two-part system were there's a optical beam on one side and a receiver on the other. This beam is always active and senses when the beam is "cut". The good thing about this system is that it detects the interrupt so it can detect very fast movement (unlike the "pinging" method of an ultrasonic sensor). If you're ever seen the safety sensors on garage doors that detect if something is in the way, those would work prefect. It's a tight beam, and it can detect something going through the beam at a very fast pace. Something like this: Genie Safety Beam Photo Eye Sensors Kit
(you would need two sets).