Edge Detection and One-Shots in Roll Forming PLC Programs — Avoiding Double Counts
Introduction — Why Double Counts Are a Serious Problem in Roll Forming
One of the most common PLC programming problems in roll forming machines is double counting. The machine detects one physical event, but the PLC processes that event multiple times.
Examples include:
- panel counter increments twice for one panel
- punch fires twice for one hole location
- stacker drop cycle triggers twice
- inkjet marking repeats unexpectedly
- scrap detection counts multiple times.
These problems almost always occur because the PLC reacts continuously to a signal instead of reacting only once when the signal changes.
The solution is to use edge detection or one-shot logic.
Edge detection ensures that the PLC responds only when a signal transitions, not while the signal remains active.
This technique is essential in roll forming machines where sensors often remain active for several PLC scan cycles.
Understanding PLC Scan Cycles
To understand edge detection, it is important to understand how PLCs operate.
A PLC does not evaluate logic continuously. Instead, it runs in cycles called scan cycles.
Each scan typically performs three steps:
- Read all input signals
- Execute program logic
- Update outputs
This cycle repeats continuously.
Typical scan times for industrial PLCs are:
- 2 ms
- 5 ms
- 10 ms
- 20 ms
During one physical event, the PLC may process the same input multiple times.
Example of the Double Count Problem
Consider a panel detection sensor at the end of a roll forming line.
A panel edge passes the sensor and activates it for 200 milliseconds.
If the PLC scan time is 10 ms, the PLC will see that sensor ON:
20 times
If the program increments the counter whenever the sensor is ON, the counter may increase 20 times instead of once.
This is the classic double count problem.
What Edge Detection Does
Edge detection identifies the moment when a signal changes state.
There are two types of edges.
Rising Edge
The signal changes from OFF to ON.
Falling Edge
The signal changes from ON to OFF.
Edge detection ensures that the PLC reacts only at the moment of transition.
For most roll forming applications, rising edge detection is used.
What a One-Shot Means
A one-shot is a logic signal that becomes true for only one PLC scan cycle.
Even if the sensor remains active for many scans, the one-shot occurs only once.
This means the PLC executes the associated action exactly one time.
Example uses include:
- incrementing panel counters
- triggering punch cycles
- starting shear sequences
- activating marking systems.
Rising Edge Detection in PLC Logic
Rising edge detection compares the current input state with the previous scan state.
If the signal was previously OFF and now is ON, the PLC detects a rising edge.
This creates a one-scan pulse.
This pulse can safely trigger events without repetition.
Falling Edge Detection
Falling edge detection works similarly but detects the transition from ON to OFF.
This is less common in roll forming but may be useful for:
- trailing edge detection of panels
- release of certain machine interlocks
- completion detection after sensors clear.
Why Edge Detection Is Essential in Roll Forming Machines
Roll forming machines frequently rely on sensors for production control.
These include:
- panel detection sensors
- punch position sensors
- shear position sensors
- stacker sensors
- coil end detection sensors.
Without edge detection, many of these signals can trigger events multiple times.
Panel Counting Example
Consider a panel detection sensor used to count finished panels.
Incorrect logic might look like this conceptually:
If PanelSensor = ON
Increase PanelCount.
Since the PLC sees the sensor ON many times during the scan cycles, the count increases repeatedly.
Correct logic uses edge detection:
When PanelSensor changes from OFF to ON
Increase PanelCount once.
This ensures accurate production counts.
Punch Trigger Example
Punch systems are another place where edge detection is essential.
If the PLC triggers the punch while a position window signal remains active, the punch could fire multiple times.
Using a rising edge ensures the punch is triggered only once when the window opens.
Shear Trigger Example
In stop-to-cut systems, the PLC triggers the shear when the target panel length is reached.
If the PLC repeatedly evaluates the condition without edge detection, the shear sequence may restart incorrectly.
Using a one-shot ensures the shear request occurs only once per panel.
Common Roll Forming Applications for One-Shot Logic
Several functions almost always require edge detection.
Panel Counters
Used in stackers or production reporting systems.
Punch Position Windows
Ensures the punch triggers once when the strip reaches the correct location.
Shear Cut Requests
Prevents repeated cut commands.
Coil End Detection
Triggers scrap handling logic once when the coil end is detected.
Marking and Printing Systems
Inkjet printers often rely on a single trigger per panel.
Why Raw Sensor Signals Are Not Enough
Sensors do not produce perfect signals.
In roll forming environments, sensors may experience:
- vibration
- oil contamination
- electrical noise
- strip movement variations.
These conditions can cause signals to flicker or repeat rapidly.
Edge detection ensures the PLC responds only once even if the raw signal fluctuates briefly.
Combining Filtering with Edge Detection
Edge detection alone is not always enough.
If the raw sensor signal is unstable, the PLC may detect multiple edges.
To solve this, combine:
- input filtering
- edge detection.
Typical signal processing sequence:
Raw Sensor → Filtered Signal → Edge Detection → Machine Logic
This structure produces much more reliable control behavior.
One-Shot Logic for Encoder Events
Encoder-based events also benefit from edge detection.
For example:
When panel length equals target length, the PLC triggers the shear.
If this condition remains true across multiple scans, the PLC could generate multiple cut requests.
A one-shot pulse prevents this by generating a single trigger event.
Programming Best Practices
When implementing edge detection in roll forming PLC programs, several best practices should be followed.
Always Use Edge Detection for Counters
Any logic that increments a counter should use a rising edge signal.
Never Trigger Sequences from Raw Inputs
Sequence triggers should use filtered and edge-detected signals.
Separate Detection from Action
The logic that detects an event should be separate from the logic that executes machine actions.
This improves program clarity.
Use Clear Signal Naming
Clear naming helps technicians understand the signal path.
Example structure:
Raw_PanelSensor
Filt_PanelSensor
Rise_PanelSensor.
Troubleshooting Double Count Problems
If double counts occur in a roll forming machine, technicians should investigate several areas.
Check Raw Sensor Stability
Watch the raw input in the PLC online view.
If the signal flickers, filtering may be required.
Verify Edge Detection Logic
Ensure the PLC is using a rising edge signal rather than the raw input.
Inspect Sensor Alignment
Sensors positioned too close to the switching threshold may produce unstable signals.
Check Cable Routing
Electrical noise from motors or VFDs can affect sensor signals.
Confirm Correct PLC Program Structure
Ensure that counting logic uses the edge-detected signal rather than the raw input.
Commissioning Checklist for Edge Detection
When commissioning a roll forming machine, edge detection should be verified.
Typical tests include:
1 pass one panel through the sensor
2 confirm the PLC counter increments once
3 test at production speed
4 observe signal behavior during vibration.
Correct edge detection prevents production counting errors.
Preventative Maintenance for Sensor Systems
Regular maintenance helps maintain reliable sensor operation.
Recommended practices include:
Monthly inspections:
- clean sensors
- verify sensor alignment.
Quarterly checks:
- inspect sensor cables
- verify PLC signal filtering.
Maintaining sensors reduces the risk of double counts.
Benefits of Proper Edge Detection
Using proper edge detection techniques provides several advantages.
These include:
- accurate panel counts
- reliable punch timing
- stable shear triggering
- fewer nuisance faults
- improved machine reliability.
For roll forming machines operating at high speeds, proper edge detection is essential.
FAQ — Edge Detection and One-Shots
What is edge detection in PLC programming?
Edge detection identifies when a signal changes state, allowing the PLC to react only once at the moment of transition.
What is a one-shot signal?
A one-shot signal is a pulse that lasts for only one PLC scan cycle, ensuring an action occurs only once.
Why do roll forming machines experience double counting?
Double counting occurs when the PLC processes a sensor signal multiple times while it remains active.
Why is filtering often combined with edge detection?
Filtering stabilizes noisy signals so that edge detection triggers only once per real event.
What functions in roll forming machines require one-shots?
Panel counting, punch triggering, shear activation, and coil end detection commonly require one-shot signals.
How can technicians diagnose double count problems?
By observing raw sensor inputs, verifying edge detection logic, and inspecting sensor alignment and wiring.