How to use ir transmitter/receiver to count parallel vehicles

I plan to use an infrared sensor transmitter/receiver to calculate the number of vehicles.
This is my idea:

  • Use 8 pairs of transmitter/receiver infrared sensors
  • The distance between each pair is one meter
  • If at least 3 pairs of consecutive sensors detect the signal at the same time, it is judged that the vehicle passes (normal car width is about 3 meters)
  • If 4 pairs of consecutive or more pairs of sensors detect a signal, two or more vehicles may pass in parallel.
    It is easy to calculate the vehicles one by one.
    But I have no idea to count how many vehicles pass in parallel? Any suggestions?

Could you help someone trying to understand what you are doing with a sketch or two? Where I am unless you refer to a truck as a car the width would be typically less than 2m and length 4-5m. Are the sensors static and the vehicles moving at 90 degrees to the line of sensors? By passing in parallel do you mean at the same time and side by side? If the vehicles can be driven side by side then there needs to be at least one sensor cover the gap - likely that 1m spacing is too large! If I understand the setup you need some sort of state for each sensor and a transition history of the last state. You can then assess the number of vehicle using a decision tree type of logic - like pattern matching.

1 Like