Object counter « counting box »

Get a second set that goes perpendicular, the gaps between the sensors are big enough for a small bag to slip through when aligned just right (this sooner or later will happen).

And why the delay? Only gives more opportunity for bags to slip through. I'd read the sensors as often as possible, but after detecting and counting a bag wait some time (300-500 ms maybe) or for the sensors to not detect the bag any more before counting a new one.