Industrial object counting guide
Sensor for Object Counting: Choose the Detection Method and Capture Every Pulse
For separated opaque products, a through-beam photoelectric sensor is usually the strongest starting point. Small guided parts may fit a slot or fiber-optic sensor; metal targets may favor inductive sensing; clear, irregular or touching products need a more specialized optical, ultrasonic, array or vision solution.
- Sensor, beam and target selection
- Object-width and gap timing calculator
- PLC input, filtering and count validation
This page covers discrete object counting on conveyors, feeders and production machinery. People counting, occupancy analytics, legal metrology and safety functions need different sensing architectures and validation. A standard counting sensor must never replace a safety-rated protective device.
The direct answer
Accurate counting needs four conditions at the same time.
A fast sensor alone cannot fix touching objects, a beam wider than the part, an input filter longer than the pulse or PLC logic that counts both edges.
Objects are separable
Each part creates a distinct target-present interval and a distinct clear gap before the next part.
The sensor sees the difference
Target size, material, surface and path create a stable transition under real production conditions.
The pulse survives the input
Both ON and OFF intervals exceed the selected sensor and controller timing requirements.
The logic counts one edge
The counter increments once per approved transition and handles stops, startup and rejected products correctly.
How counting works
The count is the end of a five-link signal chain.
A fault in any link can create the same symptom: a total that does not match the physical batch. Diagnose from the product toward the counter instead of adjusting sensitivity first.
Object flow
Parts arrive one by one, cross the intended path and provide enough separation to restore the clear state.
Sensing event
Light, field or sound changes far enough to cross the sensor's switching threshold once.
Output edge
The PNP, NPN or other output transitions with adequate ON and OFF duration.
Input capture
The PLC, counter or high-speed input accepts the pulse after its configured filter.
Count logic
One selected edge increments the correct total and the machine handles reset and batch control.
A box that stops in the beam should remain one object, not accumulate counts every PLC scan. Use an edge event or hardware counter behavior that is documented for the controller, and define whether the leading or trailing edge represents the product.
Choose by the detection problem
Which sensor is best for object counting?
There is no universal maximum count rate for a sensor category. Select the exact model from its target data, beam or sensing field, ON/OFF response, switching frequency, output, environment and controller compatibility. OMRON's photoelectric selection guidance explicitly includes target size, transparency, velocity, distance, background and environment.[1]
| Sensor method | Good starting application | Why it can count well | Main limitation | Data to verify |
|---|---|---|---|---|
| Through-beam photoelectric | Separated opaque cartons, trays, bags and parts crossing a clear conveyor gap. | The object interrupts a direct emitter-to-receiver path, so detection depends less on target color or surface return. | Requires hardware on both sides; a beam larger than the target or crosstalk from adjacent emitters can cause misses. | Effective beam, minimum object, response both directions, alignment tolerance and interference controls. |
| Retro-reflective photoelectric | Conveyors where one-side wiring is preferred and a reflector fits opposite the sensor. | Creates a beam-interruption event with only the sensor wired on one side. | Clear or mirror-like targets can produce too little attenuation or an unintended return. | Specified reflector, minimum distance, target transparency, polarization and contamination behavior. |
| Diffuse / background suppression | One-sided short-range counting with a controlled target path and background. | Needs no reflector; BGS can reject a conveyor or machine surface behind the target. | Ordinary diffuse response changes with target color, gloss, angle and background. | Worst target reflectivity, cutoff transition, foreground limit, spot size and teach repeatability. |
| Slot / fork / fiber optic | Small guided parts, labels, pins, teeth and components moving through a constrained track. | A fixed opposed optical path or small remote head can create a precise sensing point in restricted space. | The target must fit and pass through the usable opening; minimum-object claims depend on optics and setup. | Slot width/depth, beam, minimum object, orientation, response and fiber bend/mounting limits.[2] |
| Inductive proximity | Metal parts passing close to the sensor in oily, wet or visually dirty machine areas. | Detects metal without depending on target color or an optical lens path. | Short sensing distance, metal-dependent range and effects from surrounding metal. | Target metal, size, set distance, flush/non-flush mounting, switching frequency and environment.[3] |
| Ultrasonic | Transparent, dark or reflective targets when the acoustic field can separate adjacent objects. | Target color, transparency and optical reflectivity are not the primary detection variables. | Beam width, blind zone, sound cycle, air turbulence and closely spaced targets can limit counting. | Detection zone, minimum distance, response, target angle, gap, temperature and mutual interference.[4] |
| Light array / vision / profile sensing | Irregular, perforated, randomly positioned, touching, overlapping or multi-lane products. | Uses more spatial information than a single point, so edges or object profiles can be separated. | More setup, processing and application engineering; still cannot infer hidden objects without evidence. | Field of view, occlusion, lighting, object model, algorithm latency, trigger and validation dataset. |
Magnetic and capacitive sensors can count in specific designs, but they are not default choices: magnetic counting requires an intentional magnet target, while capacitive sensing is strongly affected by material, mounting and surrounding conditions.
Start from the real target
A product name is not enough for sensor selection.
“Bottle,” “box” or “metal part” leaves out the variables that decide whether a clean pulse exists. Send the smallest and largest samples, target photos, conveyor speed, physical gap, path variation, background and electrical input information before selecting a model.
Compare XSZ photoelectric sensor families after defining these conditions.
Mounting geometry
Place the sensing point where one object creates one clean interval.
For a beam-break counter, aim through a solid cross-section that every valid product occupies. Avoid handle holes, open tops, bottle necks, transparent windows and moving flaps unless the counting strategy intentionally uses that feature.
Small-object performance depends on beam size, target position and sensitivity. OMRON notes that the through-beam lens and optical setup affect the minimum detectable object, and that model ratings must be checked rather than inferred from the housing.[2]
- Mount the sensor and receiver or reflector to a rigid machine reference.
- Keep product guides from entering the optical or sensing field.
- Allow alignment and cleaning without moving the counting plane.
- Protect the sensor from product impact and cable strain.
- Verify adjacent sensors do not interfere at all machine states.
Travel dimension
Measure the target length along its direction of motion at the beam. This approximates how long the target state can remain active.
Physical gap
Measure the shortest clear space between adjacent objects. The signal must recover during this interval to create the next edge.
Path variation
Include lateral, vertical and angular movement so every valid object intersects the beam without exposing holes or unintended surfaces.
Pulse and gap planning
Calculate both the target interval and the clear interval.
A counter needs enough time to recognize the object state and enough time to recognize the gap before the next object. The limiting path can include sensor ON/OFF response, output delay, input filter and the controller's pulse-capture method.
target interval (ms) ≈ target travel length (mm) ÷ line speed (m/s)
clear interval (ms) ≈ physical gap (mm) ÷ line speed (m/s)
These equations assume the target and gap cross a fixed sensing point at constant speed. Beam width, object angle, holes, slippage, acceleration and reflective sensing geometry can change the real output pulse. Verify the result from the sensor output or high-speed input diagnostics.
Controller filtering is not a minor detail. Rockwell documentation shows high-speed modules can use configurable ON and OFF filters, while ordinary digital inputs may reject pulses shorter than their selected filter time.[5]
Counting-window estimator
Double counts and missed counts
Fix the physical or signal cause before adding a timer.
Debounce, on-delay and off-delay are useful only when their purpose is defined from a measured waveform. An arbitrary timer can hide one fault while creating another at a higher line speed.
Hole, seam or label gap
One object briefly returns the sensor to the clear state. Move the sensing point, use a wider optical band or apply a justified hold-off that is shorter than the minimum inter-object gap.
Target chatter or vibration
The object repeatedly crosses the threshold. Stabilize the product and bracket, increase optical contrast or use a sensing mode less sensitive to the changing surface.
Pulse shorter than input filter
The sensor switches, but the controller rejects the event. Use a suitable high-speed input or a supported pulse-stretch function after checking the complete timing path.
Gap never restores
Touching products create one long blocked state. Separate them mechanically or use an array, profile or vision method that can identify an edge between adjacent products.
Optical or electrical interference
Adjacent emitters, reflective machine parts, strong light or cable noise creates an extra transition. Isolate the source and use model-supported interference and EMC controls.
Both edges are counted
The program increments on arrival and departure. Define one count edge, one product direction and explicit reset, startup and stopped-in-beam behavior.
Difficult target surfaces
Clear, shiny and dark objects need sample-based selection.
A standard high-gain through-beam pair may see through a transparent target instead of counting it. A dedicated clear-object retro-reflective sensor is designed to detect a small reduction in returned light; ultrasonic sensing can also ignore optical transparency, but its detection zone and response may not separate narrow gaps.[6]
Shiny curved products can send a reflection toward or away from the receiver as they move. Dark products can reduce the return of an ordinary diffuse sensor. The best route is the one that produces a stable difference between every target and every gap, not the one with the largest catalog range.
Glass, PET and film
Investigate a dedicated clear-object photoelectric model or ultrasonic sensing. Test minimum wall thickness, seams, labels, water droplets, double layers and the normal lens/reflector condition.
Metal rings, foil and glossy packs
Consider polarized retro-reflective, through-beam or suitable distance-based sensing. Validate all product rotation and curvature; a reflection that is stable on one face may disappear on another.
Black rubber, foam and dark cartons
Prefer a method that does not rely on target brightness, such as through-beam for opaque products. If using BGS or diffuse sensing, test the darkest sample at the farthest allowed position.
Mesh, handles and irregular edges
Move the point sensor to a continuous feature, mechanically guide the target or use a wider light array that can tolerate holes without creating multiple count edges.
A point sensor cannot reveal hidden boundaries
Touching and overlapping objects are a flow problem first.
When two objects cross a single beam without a clear gap, the output contains one blocked interval. No response-time specification can recreate a boundary that the sensor never observed.
If products overlap vertically or laterally, even a light array may see only a combined silhouette. The solution may require singulation, multiple views, profile data, an encoder-based process model or machine vision trained and tested on the real overlap cases.
Create spacing mechanically
Use belts at different speeds, a screw, star wheel, escapement, track or feeder so each item crosses the counting plane separately.
Detect an exposed edge or profile
Use a slot/fork sensor, light array, edge-sensitive sensor or profile measurement when a point beam cannot tolerate the product geometry.
Use vision when identity matters
Apply machine vision when objects vary in orientation, overlap, occupy multiple lanes or require classification as well as counting.
From sensor output to counter
Match the electrical edge to the input that will count it.
Confirm supply voltage, PNP or NPN output, input common, connector pinout, load limits and light-on/dark-on behavior from the exact model documentation. Wire colors are common conventions, not a substitute for the diagram.
- Output typeMatch PNP or NPN to the PLC, counter or interface input circuit.
- Operating logicChoose the event edge from actual target behavior; review NO vs NC and light/dark operation.
- Input channelUse a standard input only when its filter and scan/capture behavior accept the shortest pulse. Otherwise use a supported high-speed counter or pulse-catch input.
- FilteringSet ON and OFF filters from measured noise and minimum valid intervals. Too much filtering removes real products; too little can pass interference.
- Program eventIncrement on one edge and define reset, batch completion, rejected-product handling, startup state and power-loss behavior.
Voltage level, sourcing/sinking behavior, isolation, common reference and fault protection must be engineered for the interface. Use an approved level-shifting or isolated input method where required rather than a generic resistor value copied from another circuit.
Application starting point
What type of object must you count?
This selector identifies a sensor family to investigate first. It is not a model guarantee; final selection requires target samples, geometry, timing and environmental validation.
Select the hardest condition
Starting route
Start with through-beam or retro-reflective sensing
A separated opaque carton can produce a strong beam-interruption event. Through-beam is the robust starting point when both sides are accessible; retro-reflective reduces wiring when a suitable reflector can be mounted opposite.
Commissioning and acceptance
Validate the total, not just the switching LED.
Run a traceable reference batch through the complete machine at production conditions. The acceptable error criterion belongs to the process risk and customer requirement; do not adopt an arbitrary percentage from a generic guide.
Lock the reference quantity
Prepare a batch whose physical quantity is independently verified and whose target variation represents production.
Challenge the extremes
Include smallest, darkest, clearest, shiniest and most mispositioned approved products where relevant.
Run the maximum conditions
Test maximum speed, minimum gap, normal vibration, machine lighting and adjacent equipment in operation.
Record every layer
Compare sensor status, controller input edges, hardware/software counter and final batch total.
Test abnormal flow
Stop with an object in the beam, restart, create a jam, remove a product and confirm reset and reject logic.
Save the baseline
Document model, alignment, settings, input filter, program edge, sample batch and accepted results.
A useful acceptance record
Preserve enough evidence to reproduce the result.
Record the complete sensor and reflector or fiber part number, bracket position, counting plane, teach or sensitivity setting, supply, output type, input channel, filter, counter mode and program edge.
When the count differs from the reference batch, retain the event sequence rather than only the final number. A short waveform capture, controller trace or high-speed diagnostic can show whether the missing edge originated at the target, sensor output, input filter or counting logic.
Troubleshooting by evidence
Use the error pattern to find the failing link.
Do not change several settings at once. Correlate each incorrect total with the target type, line state, sensor output and controller input, then make one controlled change.
| Observed pattern | Likely layer | Check first | Controlled correction |
|---|---|---|---|
| Misses only the smallest parts | Target / optical geometry | Effective beam or spot, part position, orientation and minimum-object conditions. | Guide the part through a smaller sensing field or select a slot, fiber or small-spot model verified with samples. |
| Misses only at maximum speed | Timing / input capture | Actual ON and OFF pulse widths, sensor response, input filter and counter method. | Use a suitable faster model/input path or change geometry to lengthen the valid pulse; then retest at speed. |
| Two counts from one product | Target profile / logic | Holes, seams, reflection changes, vibration and whether both edges increment. | Move the counting plane, stabilize the product, count one edge or apply a measured hold-off shorter than the real gap. |
| Two products become one count | Flow separation | Whether a clear interval appears between products at the sensor output. | Increase mechanical spacing or use an array/profile/vision method that can reveal the product boundary. |
| Sensor LED changes but PLC total does not | Electrical / controller input | PNP/NPN match, pinout, input common, channel status, filter and hardware counter assignment. | Trace the edge from output to terminal, input tag and counter; correct the incompatible layer. |
| Error grows after cleaning interval | Environment / optical margin | Lens and reflector condition, alignment marks, vibration, bracket movement and contamination source. | Restore the baseline and improve protection, mounting or sensing method rather than repeatedly retuning. |
For a broader diagnostic workflow, see the industrial sensor troubleshooting guide.
Application review
Send XSZ the target, speed, gap and controller input.
XSZ can narrow the sensing method before you build the bracket or commit to the input hardware. A short production video and representative samples make a counting recommendation much more useful than a maximum-frequency request alone.
Continue the selection
Related sensor categories and setup guides
Use the next page that matches the target, mounting layout or electrical issue you still need to resolve.
Counting questions
Sensor for object counting FAQ
What is the best sensor for counting objects on a conveyor?
For separated opaque products, a through-beam photoelectric sensor is often the strongest starting point because each object interrupts a direct beam. Retro-reflective simplifies one-side wiring, slot or fiber-optic sensors suit small guided parts, inductive sensors suit nearby metal targets, and clear or irregular products may need a specialized optical, ultrasonic, array or vision solution.
How do I calculate whether a sensor is fast enough for counting?
Estimate target interval as target travel length in millimeters divided by line speed in meters per second; the result is milliseconds. Calculate the clear interval from the physical gap in the same way. Compare both intervals with the exact sensor ON/OFF response, output delay, controller input filter and counting method, then verify the real waveform at maximum speed.
Why does one object produce two counts?
A hole, seam, label gap, glossy surface, vibration or unstable threshold can split one product into multiple output transitions. The PLC may also be incrementing on both leading and trailing edges. Inspect the sensor waveform, move the sensing point to a continuous feature, stabilize the target and count one defined edge before adding a timer.
Can one point sensor count touching or overlapping objects?
Not reliably when no observable boundary crosses the sensing point. Touching products can create one continuous blocked interval, and overlapping products may hide one another. Create mechanical spacing or use a light array, profile sensor, multiple views or machine vision appropriate to the real product geometry.
Which sensor should count clear bottles?
Start with a dedicated clear-object photoelectric sensor or an ultrasonic method whose beam and timing can resolve the bottle gaps. Validate wall thickness, seams, labels, liquid, droplets, bottle shape, spacing, speed and normal contamination. A standard high-gain beam may transmit through a clear bottle without producing a stable count pulse.
Can an inductive sensor count plastic, glass or cartons?
No. An inductive proximity sensor detects metal targets. It is useful for metal components passing close to the sensor, including visually dirty or oily applications when the selected model is environmentally suitable. Plastic, glass and cartons require another sensing principle unless they contain an intentional metal target.
Do I need a high-speed PLC input for object counting?
You need an input path that can capture the shortest valid ON and OFF intervals. A standard digital input can work when its filter and scan or pulse-catch behavior are fast enough. Use a supported high-speed counter input when the standard path cannot guarantee capture, and configure its filters from the real signal and noise conditions.
Should a counting sensor use PNP or NPN output?
Use the output type that matches the PLC, counter or interface input architecture. PNP sources current to a compatible sinking input; NPN sinks current from a compatible sourcing input. Confirm the input common, voltage, connector pinout and replacement standard instead of choosing by region or wire color.
Evidence and media
Technical references
- OMRON Industrial Automation, Overview of Photoelectric Sensors — sensing modes and selection factors including target size, transparency, velocity, background and environment.
- OMRON Industrial Automation, Further Information of Photoelectric Sensors — relationship between optics, sensitivity and minimum detectable object.
- OMRON, Proximity Sensors Technical Guide — inductive metal detection and environmental/mounting considerations.
- ifm, Ultrasonic Sensors Overview — acoustic detection for colored, transparent and difficult surfaces.
- Rockwell Automation, High-speed Counter Input Filter Definitions — separate ON and OFF input filter behavior.
- Banner Engineering, Accurate Counting of Transparent Pharmaceutical Bottles — why ordinary optical and ultrasonic approaches can struggle with clear bottles and narrow gaps.
- SICK, Reflex Array Sensors — wide optical-band detection for irregular, perforated and variable conveyor targets.
Image credits
- Package conveyor hero: U.S. Department of Agriculture / Wikimedia Commons, public domain.
- XSZ product image: XSZ Sensor.
- Factory conveyor: Yetkin Ağaç / Pexels.
- Clear bottle line: Vladimir Srajber / Pexels.
- Control panels: Shameer Vayalakkad Hydrose / Pexels.
- Bottling equipment: Ben Young / Pexels.