1. Problem Overview
The Omron ZEN programmable relay is a compact logic module designed for small-scale automation tasks. One of its most common beginner applications is a counter-driven set/reset sequence: a digital sensor detects objects on a conveyor or production line, the first detection sets an output (for example, a diverter solenoid or indicator lamp), and after a programmed number of counts the output and the counter must both be cleared so the cycle repeats. This pattern is widely used in batching, indexing, reject-diversion, and parts-counting applications where a ZEN replaces a small relay panel.
The reference requirement for this article is:
- An input (typically
I0) is wired to a NO (normally open) proximity or photoelectric sensor. - On the first true edge of that input, the chosen output (commonly
Y0orY1on an expanded CPU) must latch ON. - On every true edge of the same input, an internal counter (
C0) increments. - When the counter reaches its preset value (4) AND the sensor is OFF, the output must reset and the counter must reset, allowing the cycle to restart on the next detection.
Although the requirement is small, beginners frequently create a working-looking program that fails at runtime: the output resets every time the sensor toggles, the output never sets, the counter never reaches its preset, or the ZEN rejects the program because the wrong I/O addresses are used. This article walks through hardware selection, software setup, ladder design, simulation, and field verification using the official ZEN Programmable Relay Operation Manual (Cat. No. Z211) and the Omron ZEN Quick Guide.
.ZEN or .ZED on disk before reinstalling Windows or replacing the CPU.2. Prerequisites
Before you wire anything, confirm the following:
- CPU selection. Choose an LCD-type CPU such as the ZEN-10C1AR-A (relay outputs, 100-240 VAC supply) or ZEN-10C1DR-D (relay outputs, 24 VDC supply). LED-only CPUs (ZEN-10C2-series with no display) cannot be hand-programmed and require the ZEN-SOFT01-V4 PC software.
-
Output type. The base ZEN-10C provides only
Q(relay/transistor) outputs. If your system diagram calls forY0throughY3, an expansion relay module ZEN-8E must be installed on the right side of the CPU. In the software, open File > Properties > Expansion Unit 1 and select the appropriateZEN-8E**variant. Without that, the symbolY1in the editor will not resolve to a physical terminal. - Power supply. 24 VDC units need a regulated Class 2 power source. The 100-240 VAC units must have a properly grounded protective earth; the PE terminal is required for surge and noise immunity even when no analog sensor is used.
-
Sensor compatibility. A 3-wire PNP sensor with a 24 VDC load voltage sources current into the ZEN input when active. NPN sensors also work on the 24 VDC models by swapping input logic in the ladder (
NOT I0instead ofI0). - ZEN-SOFT01-V4 installed on a Windows PC, with the ZEN-CIF01 USB-serial or modern ZEN-SOFT-SUITE cable for program transfer.
3. ZEN I/O Addressing Reference
Addresses are case-insensitive in the editor but are conventionally uppercase. The base 10-point CPU exposes the following:
| Address | Type | Function |
|---|---|---|
| I0..I5 | DC input | Physical digital inputs on the base unit (24 VDC types only) |
| Q0..Q3 | Relay / transistor output | Base unit outputs |
| Y0..Y3 | Relay output | Outputs on ZEN-8E expansion (4 relay contacts) |
| C0..C15 | Counter | Up counters, each with a present value (PV) and counted value (CV) |
| T0..T7 | Timer | ON-delay, OFF-delay, one-shot, flicker |
| M0..M15 | Holding bit | Battery-backed internal relays |
| H0..H7 | Hold / latch relay | Retains state through power cycle |
Counter behavior: each Cn has a Counted Value (CV) memory location and a Set Value (SV) configured in the parameter view. The bit CN becomes TRUE when CV >= SV. The bit Cn (no second letter) is the increment input. Counter inputs are edge-triggered on the 0 -> 1 transition, so a held-high sensor will increment only once per cycle until the counter is reset.
4. Ladder Logic Design
The logic for "set output on first detection, reset after 4 counts AND sensor off" is best built in three rungs rather than two. Keeping reset logic separate from set logic makes the program readable and avoids the most common beginner failure: a counter or output that self-resets on the same scan that it is supposed to set.
4.1 Rung 1 - First-detection set
This rung latches the output the first time the sensor goes true. Use a SET coil (or a self-holding rung) so that subsequent input pulses do not need to maintain the output.
| I0 C0_NotDone | (SET) Q0
| +---NO I0-------|
| | NC CN |
| +---/ CN -------|
| ( ) Q0 (optional status)
The use of NC CN (the inverse of the counter-done bit) ensures that the output is only SET before the count is complete. If the program is later modified to use a higher count or a different sensor, the set rung will not fight the reset rung.
4.2 Rung 2 - Counter increment
The counter must count on every true edge of the sensor input. No reset coil may be on this rung.
| I0 | C ( C0, 4 ) |
In the ZEN editor, place a Counter instruction block. Set the counter number to C0 and the preset value to 4. The reset input on the counter block must be wired to the reset rung below; do not use a separate RST line on the same rung, because that would clear the counter the moment CV reaches the preset on the very same scan.
4.3 Rung 3 - Reset on count complete AND sensor OFF
This is the rung that beginners most often write incorrectly. The reset must occur only when both conditions are met:
- The counter has reached its preset (
CNis TRUE). - The sensor is currently OFF (
NC I0, that is,/I0).
| CN /I0 | (RST) Q0 -- reset output
| CN /I0 | (RST) C0 -- reset counter
Each line is one rung. The reason the sensor-OFF condition is mandatory is the same as the one experienced in the original PLC-Talk-style discussion: if the reset is keyed only on CN, the output and counter will be cleared immediately on the 4th count, and the LED that the user is watching will appear to flicker. Worse, if a single-reset instruction is also reused to feed the counter, the counter will reset the same scan it reaches preset and the cycle will never advance, because no clean count edge was ever latched.
4.4 Alternative: Holding-relay self-latch
If the output is the kind that must remain latched through a power loss, use a holding relay H0 in place of Q0 on the SET rung and the RST instruction on the reset rung. Then drive a real output such as Q0 or Y0 from a fourth rung that simply contains | H0 | ( ) Q0. This pattern is preferred in batching and process-control applications where a power brownout must not lose the count progress.
5. ZEN-SOFT01-V4 Step-by-Step Programming
- Launch ZEN-SOFT01-V4. The 30-day evaluation period starts the first time the software is opened. From the menu bar select File > New and choose the CPU type that matches the hardware on the bench (for example, ZEN-10C1DR-D-V2).
-
Configure the expansion unit. Open File > Properties. On the Expansion Unit 1 tab, select the appropriate ZEN-8E variant if you need Y-type outputs. Click OK. The symbol tree on the right side of the editor will now expose
Y0throughY3. - Set the system parameters. Click Simulation > Parameters. Tick Display ladder during simulation so the rung state is visible. Under CPU Run/Stop Switch choose whether the CPU should enter RUN automatically on power-up or require a STOP-to-RUN transition.
-
Build the ladder. Drag the NO contact
I0onto Rung 1, then the counter blockC0, then the SET coilQ0. Use the Function toolbox for the counter. SetSV = 4in the parameter pane that appears when the counter is selected. -
Add rung comments. Select Edit > Edit Rung Comments from the menu. Add the following comments (this is the same documentation practice used in the source troubleshooting thread):
- Rung 1 top branch: "When first object is detected, set output."
- Rung 2: "Each time sensor goes ON, count 1."
- Rung 3: "After 4 counts AND sensor is OFF, reset output and counter."
-
Compile and save. Press Ctrl+F9 or click the Convert button. The ZEN compiler checks that all contacts have a matching coil or instruction and that the project fits the selected CPU. Save the project as
first_count.zen. -
Simulate. Click the Simulator button (the green play icon) on the toolbar. The simulation window opens. Use the soft keys at the bottom of the simulator to force
I0ON and OFF. Press the play button to start the simulation: beginners frequently force the inputs but forget that the simulator is in Pause state, which is why "the LED is not lighting up" even though the rung looks correct.
6. Wiring the Real Hardware
| Terminal | Connection | Notes |
|---|---|---|
| L / N | 100-240 VAC supply (ZEN-10C1AR-A) | Protective earth on PE terminal |
| +V / 0V | 24 VDC supply (ZEN-10C1DR-D) | Class 2 regulated source |
| I0 | Sensor signal output (PNP) | Brown wire of typical photoelectric sensor to +V, blue to 0V, black to I0 |
| Q0 (or Y0) | Solenoid or indicator load | Switching capacity 8 A / 250 VAC resistive, 5 A / 30 VDC for base relay outputs; 2 A / 250 VAC for ZEN-8E |
| COM | Common for relay outputs | Some ZEN variants have two COM terminals for grouped commons; consult the operation manual |
For inductive loads such as solenoids or motor contactors, install an RC snubber (for AC coils) or a flyback diode (for DC coils) directly across the load. The ZEN relay contacts are rated for 100,000 operations at full load, but inductive loads without suppression can reduce that by an order of magnitude.
7. Verification Procedure
-
Pre-power check. With power OFF, measure the input voltage at terminals
I0andCOMwith a multimeter in diode-test mode. A PNP sensor in the dark state should show < 0.5 V on the input. A bright state should show > 18 V on a 24 VDC system. - Power-up with no program. Apply power and confirm the CPU enters STOP or RUN per the project setting. The ERR LED must be OFF.
- Download program. Connect the ZEN-CIF01 cable, place the CPU in STOP, then Transfer > PC -> CPU. After transfer, switch to RUN and observe the I0 LED; it should reflect the sensor state in real time.
- Step-by-step stimulation. Manually trigger the sensor four times. The output LED must light on the first trigger and stay latched. On the fourth trigger, with the sensor released, the output LED must extinguish and the counter display must return to 0.
-
Long-run test. Let the cycle run for 200 iterations. The counter
C0should never exceed 4 and the output should never remain latched past the reset condition. If the output stays ON, suspect a sticky contact, an ungrounded supply, or a residual reset coil in Rung 2.
8. Troubleshooting Matrix
| Symptom | Likely Cause | Corrective Action |
|---|---|---|
| Output never turns ON | Y-type output address used without ZEN-8E expansion configured | Open File > Properties > Expansion Unit 1 and add ZEN-8E; rewrite rung with Q outputs if no expansion is wired |
| Output never turns ON, sensor LED works | SET coil missing or counter is incrementing but reset is wired to same rung | Move the RST coil to a dedicated Rung 3 with NC I0 in series with NC CN |
| Output turns ON and OFF on every count | Reset rung does not wait for sensor OFF | Add NC I0 contact in series with the counter-done bit on the reset rung |
| Output turns ON only on 4th count, not 1st | SET rung is wired to CN instead of I0 | Replace CN with NO I0 in the SET branch |
| Counter increments but never reaches preset | Sensor input is bouncing; counter sees multiple edges | Add a 50 ms one-shot timer (T0) between I0 and the counter input, or debounce in the sensor itself |
| Output stays ON after power cycle | Holding relay H0 used in place of Q0 and not reset | Confirm H0 reset is on Rung 3; otherwise use Q0 directly for non-retained applications |
| ERR LED on, CPU in STOP | Syntax error: missing contact, illegal coil, program overflow | Re-open the project; the editor highlights the offending line in red; correct and re-transfer |
| Simulator shows output ON but real CPU does not | Project not transferred; CPU still running the previous program | Place CPU in STOP, transfer project, switch back to RUN |
| Output LED flickers on every scan | Reset coil directly on the counter increment rung | Separate SET, COUNT, and RESET onto three rungs |
9. Extending the Program
Once the basic 4-count cycle is working, the same skeleton extends to many real applications:
-
Batching: Use a second counter
C1driven by the trailing edge of the first reset to count batches of 12. Each C1 pulse advances a Holding relay that selects a recipe word in the LCD. - Reject diversion: Latch Q0 (divert solenoid) on count 4. Use a second output Q1 armed on count 3 to fire a pneumatic nozzle; with a one-shot timer T0 = 200 ms to limit pulse width.
-
Two-stage indexing: Use a flicker timer
T0in place ofCNto produce a pulsed output; the count then becomes a divider rather than a single-event detector. - Counter chaining: Counter C0 reaches 4, sets H0, on the next scan C1 counts the H0 transition. This pattern is the standard way to expand beyond the 16 ZEN counters if you stack multiple ZEN-10C units with comms links.
10. Field Commissioning Checklist
- Project name and version saved in
*.zenwith a paper printout of the ladder attached to the cabinet door. - ZEN-8E expansion present and addressed in software if any Y symbol is used.
- Rung comments explain the intent of every rung (this practice is what made the source troubleshooting thread successful and is the single most useful habit a beginner can adopt).
- Counter preset value entered in the parameter view, not hard-coded as a constant coil.
- Sensor debounce confirmed: one mechanical cycle, one counter increment.
- Reset rung uses BOTH counter-done bit AND sensor-OFF contact.
- Inductive loads have suppression devices.
- PE terminal connected on AC-powered units.
- Final cycle test of 200 iterations recorded in the commissioning log.
11. Frequently Asked Questions
Why does my ZEN output flicker instead of staying latched?
The reset rung is firing on the same scan that the output sets. Make sure the reset uses both the counter-done bit (CN) and a NC contact on the sensor input (/I0). Without the sensor-OFF condition, every increment of the counter or every release of the sensor will clear the output.
How do I add a Y-type output like Y1 to my ZEN PLC?
Y0 through Y3 live on the ZEN-8E expansion module, not on the base ZEN-10C CPU. Mount the ZEN-8E on the right side of the CPU, then in ZEN-SOFT01-V4 open File > Properties > Expansion Unit 1 and select the matching ZEN-8E variant. After transfer, Y0..Y3 will resolve to the physical terminals on the expansion module.
What counter preset value should I use for a 4-count cycle?
Open the counter parameter view in the ZEN editor and enter 4 in the Set Value (SV) field. Do not hard-code the value with a constant instruction: changing the preset must remain a one-field edit so that recipe data can be adjusted in production.
Can I program the ZEN without a PC?
Yes, but only on LCD-type CPUs (ZEN-10C1, ZEN-20C1, ZEN-8C1). Use the front-panel arrow keys to navigate the built-in ladder editor. For complex programs or for a downloadable archive, the ZEN-SOFT01-V4 PC tool is strongly recommended and is free for the first 30 days.
My program works in the simulator but not on the real PLC. What is wrong?
Check three things in order. First, confirm the project was transferred with PC -> CPU and that the CPU is in RUN, not STOP. Second, confirm the I/O addresses in the software match the wiring: a Y0 symbol requires a ZEN-8E expansion. Third, watch the input LED on the CPU: if the input LED never lights when the sensor is active, the sensor is NPN, the wiring is reversed, or the supply is missing.