In such applications, it is also quite common to use an encoder to determine the "detection window", in the event that the conveyor stops at the surface edge of the product, or when the bottles shake a lot at slow speed. In general this Is not a big problem in glass bottles, but it is in tall soft drink bottles, once they have a less regular base, hence becoming more unstable. Just to add: There are microcontrollers which have dedicated inputs to deal with incremental encoders.