In industry, a step following the large-scale production, is the high precision and high-speed counting of the parts to be delivered to the customer. Traditionally, this is implemented with the help of a photoelectric emitting sensor, which sends an infrared light beam to a receiving photoelectric sensor, and when a piece on the moving conveyor belt interrupts the infrared light beam, the counter detects it. The electrical signal provided by the receiving photoelectric sensor, is applied to an electronic counter that increments (or decrements) the value in its memory. This automatic part counting system is reliable only if the pieces are opaque to the infrared light beam. If the parts have different holes, or are notched, the infrared light beam emitted by the transmitting photoelectric sensor to the receiving photoelectric sensor is interrupted several times for a single piece, and the counter records more than one unit. In this paper we present our solution to this problem.