Omron CJ1M Load Cell Filling: 4-20mA Scaling and Ladder Logic
Gravimetric filling of 1 L milk bottles is a classic high-precision, high-throughput automation cell. The core challenge is closing a milk fill valve in the few hundred milliseconds it takes for the in-flight stream to settle, while keeping every bottle inside a tight legal-for-trade tolerance. This reference walks through a complete implementation on an Omron CJ1M platform using a DACell CB1-K015 compression load cell, a SM110 digital weight indicator/transmitter, a CJ1W analog input module, and a step-by-step ladder program with two-stage (coarse + fine) valve control and in-flight weight compensation.
1. System Overview and Application Envelope
The target machine is a linear or rotary bottle filler for fresh milk. The rated throughput assumed here is 30 bottles per minute per station (two-second cycle), with one head per station. Every bottle arrives empty, is clamped under a fill nozzle, is tared with the bottle on the load cell, is filled, is verified, is capped, and is released downstream.
Operating envelope used for the worked example:
| Parameter | Value | Notes |
|---|---|---|
| Container | 1 L HDPE bottle, ~30 g empty | Tare at fill station |
| Target fill weight | 1030 g (density-adjusted for 1 L milk) | Adjust per product |
| Legal tolerance | ± 5 g at 95 % confidence | 2 sigma, OIML R76 class III |
| Throughput | 30 BPM / station | 2.0 s cycle |
| Coarse shut-off point | 200 g before target | Bulk flow |
| Fine shut-off point | Target weight | Trickle flow |
| Load cell capacity | 15 kg (K015) | 3:1 safety vs. gross |
2. Hardware Bill of Materials and Signal Chain
The signal chain must be sized so that the total combined error (cell non-linearity, indicator noise, ADC quantisation) stays under one third of the legal tolerance. The parts below are the recommended minimum.
| Item | Model | Role | Spec to verify |
|---|---|---|---|
| Compression load cell | DACell CB1-K015 | Weighing platform | 15 kg nominal, 2.0 mV/V, 350 Ω bridge, IP67 |
| Digital weight indicator | SM110 (or equivalent 4-20 mA transmitter) | Excitation, mV/V amp, 4-20 mA out | Output 4-20 mA proportional to gross weight; 16-bit internal |
| Analog input module | Omron CJ1W-AD041-V1 or CJ1W-AD081-V1 | 4 ch / 8 ch isolated analog input | ±10 V, 0-10 V, 4-20 mA selectable; 8000 / 27648 resolution |
| PLC CPU | Omron CJ1M-CPU13 or CJ1M-CPU23 | Sequence, math, I/O scan | 10 ksteps / 20 ksteps program, built-in RS-232C port |
| Power supply | CJ1W-PA205R or PA202 | 5 VDC / 24 VDC to rack | 5 A / 2.6 A |
| Output relay module | CJ1W-OC211 (or OD211 for 24 VDC outputs) | Drive fill valves, cap release | 16-point, 2 A / 24 VDC sink |
| HMI | Omron NB / NS series | Recipe, setpoints, diagnostics | Ethernet to CJ1M ETN21 |
2.1 Signal-flow diagram
3. CJ1M CPU and Analog Input Module Selection
The CJ1M mid-range family accepts a wide mix of special I/O on the same rack. The minimum configuration for a single-head filler:
- 1 × CJ1M-CPU13 (10 ksteps, two built-in pulse outputs unused here).
- 1 × CJ1W-PA205R power supply, 5 V / 24 V.
- 1 × CJ1W-AD041-V1 analog input (4 channels, set channel 1 to 4-20 mA).
- 1 × CJ1W-OC211 or CJ1W-OD211 16-point output card for valves, cap release, bottle-stop.
- 1 × CJ1W-ID211 16-point input card for prox sensors, photocells, E-stops, valve feedback.
- Optional CJ1W-ETN21 Ethernet for HMI / SCADA recipe download.
Refer to the CJ1M Series Catalog (Cat. No. P059) for slot count, current budget, and supported special I/O. Analog ranges are set per channel using the four range bits in the I/O table of CX-Programmer; 4-20 mA uses input range code 0000 hex on the CJ1W-AD041-V1.
4. Wiring Topology: Load Cell to PLC
4.1 Load cell cable
Use 4-conductor shielded cable between CB1-K015 and SM110. Tie shield to ground at the indicator end only. Avoid running the load cell cable in the same tray as VFD output cables; cross at 90° if unavoidable.
4.2 Indicator to analog card
SM110 typically provides 4-20 mA on a two-wire loop powered from the analog card. The CJ1W-AD041-V1 supplies loop power when set to current mode. Wire:
| SM110 terminal | CJ1W-AD041 CH1 | Signal |
|---|---|---|
| I+ (current out) | V1+ / I1+ | 4-20 mA + |
| I- (return) | V1- / I1- | 4-20 mA - |
| PE (shield) | FG terminal of rack | Earth, indicator end only |
Set the CJ1W-AD041-V1 input range for CH1 to 4-20 mA in CX-Programmer I/O Table. Confirm with a milliamp calibrator before powering the cell that the loop reads 4.000 mA on the empty platform and 20.000 mA on a 15 kg test load.
5. Analog Scaling: 4-20 mA to Engineering Units
Omron analog modules return a signed 16-bit integer where 4 mA maps to 0 and 20 mA maps to 27648. The end-of-range and fault markers are:
| Region | Current (mA) | Raw value (decimal) |
|---|---|---|
| Underflow | ≤ 1.1845 | -32768 |
| Underrange | 1.1852 to 3.9995 | -4864 to -1 |
| Rated range | 4.000 to 20.000 | 0 to 27648 |
| Overrange | 20.0005 to 22.810 | 27649 to 32511 |
| Overflow | ≥ 22.815 | 32767 |
The rated engineering span is 27648 counts. The single scaling constant used in ladder is therefore:
Weight[g] = (Raw_counts ÷ 27648) × Full_Scale_Weight[g]
For a 15 kg full scale with the empty platform tared out:
Weight[g] = Raw × 15000 ÷ 27648 = Raw × 0.54254
5.1 Why the integer constant matters
The CJ1M does not have a built-in floating-point engine. Scaling is done with integer math. To preserve one decimal place of resolution (0.1 g) over 15 000 g of span, keep the math as:
Weight_dg = (Raw × 150000) ÷ 27648 (units: decigrams, 1 dg = 0.1 g)
This keeps the numerator 24-bit (max 16 588 800), well within the 32-bit signed range the CJ1M uses for multiply (B × C). For finer work on a 5 kg cell use (Raw × 50000) ÷ 27648, giving 0.1 g resolution on 5 000 g.
5.2 First-order filter
Raw counts from a 4-20 mA loop are not stable enough to drive a fine-fill cutoff directly. Implement an exponential moving average:
Filtered[n] = (Raw × 1 + Filtered[n-1] × 7) ÷ 8
This is a 1/8th-weight filter. On a 1 ms scan, 8 cycles reach ~75 % step response, fast enough for a 2 s fill cycle but slow enough to kill the 50 Hz noise that the loop picks up from VFD cabinets. Tune the divisor 4 / 8 / 16 in field.
6. Two-Stage Fill Sequence and Setpoints
A single-stage fill cannot meet legal-for-trade accuracy at 30 BPM: the in-flight stream alone at 200 g/s coarse flow is ~5 g. Two stages - bulk coarse and trickle fine - reduce the in-flight mass at cutoff to under 1 g, which the software compensation absorbs.
| Stage | Valve | Open point | Close point | Notes |
|---|---|---|---|---|
| Tare | Both closed | Bottle detected | Stable zero | Subtract empty bottle mass |
| Coarse (bulk) | CV_COARSE | Tare OK | 830 g | 200 g before target |
| Fine (trickle) | CV_FINE | 830 g | 1022 g (after in-flight comp) | Settles the meniscus |
| Verify | Both closed | 1022 g reached | Stable at 1030 g ± 5 g | 200 ms stability window |
| Release | Cap release, conveyor advance | Verified | — |
7. In-Flight Weight Compensation
The mass of milk still falling between the valve seat and the bottle mouth at the instant the valve closes is the largest single error term. With CV_FINE closed, capture the actual weight and compare to the commanded setpoint:
InFlight = Setpoint_Fine − Actual_At_Cutoff
Add this to the next bottle's fine setpoint:
Setpoint_Fine(n+1) = Setpoint_Fine(nominal) + InFlight_n
Bound the value to ± 20 g; if the in-flight mass jumps outside this window, the milk temperature, supply pressure, or valve seat is changing and a recipe correction or alarm is required. On a properly tuned machine the steady-state in-flight term converges to 1-3 g within 5 bottles.
8. Shift Register for Multi-Station Sequencing
For a single station a sequential state machine is enough. For a linear or rotary filler with N stations that share a single CJ1M, drive the sequence with a shift register so each station advances on the conveyor pulse:
| Channel | Bit | Meaning |
|---|---|---|
| W_bit[1] | Station 1 active | Copy into W_bit[0] on each station index |
| W_bit[2] | Station 2 active | |
| … | … | |
| W_bit[N] | Station N active |
Use the Omron SFT(014) instruction. Reset the register on a station-home prox. Clock it with the conveyor index pulse. A single ladder rung drives the state for whichever station is active:
| SFT(014) W_bit[1] W_bit[1] | Rung 1: shift on index pulse
| | | | |
| IndexPulse Station1 Station1 |
| | Rung 2: state machine on active bit
| LD W_bit[1] |
| AND NOT State_Tare |
| AND BottlePresent_1 |
| OUT Cmd_Tare_1 |
The shift register pattern is the recommended structure for any N-station filler; per-station coils are gated by the active bit, so a single SFT handles sequencing and the per-station I/O map stays in one place.
9. Tare, Zero, and Weight Stability Detection
The empty bottle mass is 30 g ± 1 g. A pre-fill tare is non-optional. A stability check is required after tare and after the fine cutoff, because the weight reading wobbles for ~150 ms after the valve closes.
9.1 Stability algorithm
Implement a band check over N consecutive scans:
IF ABS(Filtered[n] − Filtered[n−1]) < 1 dg for 20 scans → Stable = TRUE
1 dg = 0.1 g is tight enough for a 15 kg cell. Widen the band to 3 dg if the platform is mechanically noisy (long bellows, suspended hopper).
9.2 Tare sequence
- Bottle prox ON.
- Wait for Stability = TRUE (no bottle yet, just empty platform).
- Sample 16 scans of the filtered weight, average into
D_Tare_Offset. - Subtract
D_Tare_Offsetfrom every subsequent reading in the cycle. - Set
State_Tared = TRUE, advance to Coarse.
10. CX-Programmer I/O Table and Module Setup
After online connection to the CJ1M, the I/O table must reflect the actual rack. CX-Programmer auto-detects slot contents. Set:
| Slot | Module | Setting | Memory address |
|---|---|---|---|
| 0 | CJ1M-CPU13 | — | CIO 0 / W0 |
| 1 | CJ1W-ID211 | 16 DI, PNP | CIO 1 |
| 2 | CJ1W-OC211 | 16 DO, relay | CIO 2 |
| 3 | CJ1W-AD041-V1 | CH1 = 4-20 mA, CH2-4 disabled | CIO 200 (input) |
| 4 | CJ1W-DA021 (optional) | 2 AO for valve trim | CIO 210 |
For a CJ1W-AD041-V1 the 4-20 mA range writes the 0-27648 count into the channel's input word. Confirm the address in the I/O Table dialog - on a CPU13, the first analog input module on slot 3 lands at CIO 200 + (channel - 1). The CJ1W-AD041 Datasheet lists exact addresses per slot.
11. Ladder Logic Implementation
The example below is a single station. It assumes:
- Raw 4-20 mA value lands in
W_AI_Raweach scan. - Filtered value in
W_AI_Filt(1/8 EMA). - Scaled grams in
W_AI_Grams(integer grams, tared). - Setpoints stored in DM:
D_Target=1030,D_CoarseOff=830,D_FineOff=1022.
11.1 Analog input and filter
| LD Always_ON | Read raw counts
| MOV(021) CIO_200_CH1 W_AI_Raw |
| |
| LD Always_ON | EMA filter
| * W_AI_Raw 1 Tmp1 |
| * W_AI_Filt 7 Tmp2 |
| + Tmp1 Tmp2 Tmp3 |
| / Tmp3 8 W_AI_Filt |
| |
| LD Always_ON | Scale to grams
| *L W_AI_Filt 15000 Tmp4 | Long multiply, 32-bit
| /L Tmp4 27648 W_AI_Grams |
For finer resolution multiply by 150000 and divide by 27648 to get decigrams into W_AI_dGrams. Then divide by 10 to obtain W_AI_Grams for setpoint comparison.
11.2 Tare
| LD BottleProx | Bottle present
| AND NOT State_Tared |
| AND Stable |
| MOV(021) W_AI_Grams D_Tare_Offset |
| SET State_Tared |
11.3 Coarse fill
| LD State_Tared |
| AND State_Coarse |
| AND NOT State_Fine |
| OUT Cmd_CV_COARSE | Energize coarse valve
| |
| LD State_Coarse |
| AND (W_AI_Grams GE D_CoarseOff) | Reached 830 g
| SET State_Fine |
| RSET State_Coarse |
11.4 Fine fill and cutoff
| LD State_Fine |
| AND (W_AI_Grams GE D_FineOff) | Reached 1022 g
| RSET Cmd_CV_FINE |
| SET State_Verify |
| |
| LD State_Verify |
| AND Stable |
| AND ABS_Diff LE 50 | 1030 ± 5 g
| SET State_Verified |
11.5 In-flight update
| LD State_Verify |
| AND Stable |
| MOV(021) W_AI_Grams W_ActualAtCutoff |
| |
| - D_FineOff W_ActualAtCutoff |
| MOV(021) Result D_InFlight |
| |
| + D_FineOff D_InFlight | Apply on next bottle
| MOV(021) Result D_FineOff_NEW |
| LIMIT check ± 20 g | Alarm if out of band
11.6 Bottle release and station advance
| LD State_Verified |
| PULSE Cmd_CapRelease 200 ms |
| PULSE Cmd_BottleStopRelease 100 ms |
| RSET State_Verified |
| RSET State_Tared |
| RSET State_Coarse |
| RSET State_Fine |
| RSET State_Verify |
12. Commissioning and Calibration Procedure
- Mechanical check. Bottle-stop closes fully, load cell is mechanically isolated from the conveyor, no contact between bottle and nozzle during fill. Apply a 15 kg test mass; the cell must read 15 000 ± 5 g on the HMI before any software scaling is touched.
- Loop check. Disconnect the SM110; inject 4.000 / 12.000 / 20.000 mA from a calibrator into the analog card. The HMI raw counts must read 0, 10322, 27648 within ± 2 counts. If off, the analog card is suspect.
- Zero and span. Reconnect SM110. With no load, execute a software zero. Apply a 5 kg test mass; adjust the scaling multiplier so the HMI reads 5 000 g.
- Tare test. Place an empty bottle. Confirm the tared weight reads 0 g within 1 second. Lift the bottle; weight returns to ~30 g. Repeat 5 times; if any reading drifts more than 2 g, the SM110 is not stable or the mechanical isolation is leaking.
- Single-stage dry run. Disable the fine valve; perform 20 fills in coarse only. Record the actual mass and the cutoff timing. Compute the in-flight mass range; this is the value the fine stage must compensate.
- Two-stage dry run. Enable fine. Adjust the fine shut-off point until the actual mean weight equals the target. The in-flight update should converge within 5 bottles.
- Throughput run. Run 200 bottles at the rated 30 BPM. Verify the weight histogram is inside ± 5 g at 95 % (2 sigma). If not, see the troubleshooting matrix below.
13. Verification and Acceptance Test
| Test | Method | Pass criterion |
|---|---|---|
| Static repeatability | 10 × 1 kg mass, read at each placement | Standard deviation ≤ 0.5 g |
| Linearity | 0, 1, 5, 10, 15 kg mass | Each reading within ± 2 g of nominal |
| Tare stability | 100 tares, 1 s apart | All within ± 1 g |
| Fill accuracy | 200 bottles, gravimetric verification | Mean within ± 1 g, 2 sigma ≤ 4 g |
| Throughput | Run at rated BPM for 10 min | No alarms, drift < 1 g per 1000 bottles |
| EMC immunity | Operate VFD within 1 m, fill 200 bottles | No 4-20 mA outliers > 1 g |
14. Troubleshooting Matrix
| Symptom | Likely cause | Diagnostic | Fix |
|---|---|---|---|
| Weight reads 0 g, raw 32767 | Loop open or SM110 not powered | Measure mA at card terminal | Repair loop, check SM110 excitation |
| Weight reads 0 g, raw -32768 | Loop reversed or card in voltage mode | Check polarity, range code | Swap +/-, set range to 4-20 mA |
| Weight noisy, > 5 g peak-peak | 50/60 Hz pickup, mechanical vibration | Scope raw counts, watch conveyor | Re-route cable, raise EMA divisor to 16 |
| Weight drifts up over time | Milk dripping on platform / nozzle | Visual inspection | Realign nozzle, add drip tray |
| Coarse valve never reaches 830 g | Flow too low or setpoint wrong | Read HMI trend | Increase supply pressure, raise coarse shut-off |
| Fine overshoots > 5 g | In-flight comp disabled or wrong sign | Compare D_FineOff_NEW vs nominal | Re-enable comp, check arithmetic sign |
| Every other bottle is 30 g short | Station index off-by-one | Check SFT clock, station prox | Re-align station prox, reset SFT |
| Output card does not energize coarse | Wiring reversed on OC211 vs OD211 | Measure coil voltage | Match output card to valve coil polarity |
| CJ1M reports I/O verify error | Slot mismatch with I/O table | CX-Programmer online I/O table | Re-create I/O table or fix rack |
15. Frequently Asked Questions
What is the rated unit constant 27648 used in the scaling formula?
The constant 27648 is Omron's full-scale integer for 4-20 mA analog inputs. The scaling formula is Grams = Raw × Full_Scale_Grams ÷ 27648; 27648 is the rated unit and 27648 = 20 mA − 4 mA span expressed in counts.
Why does the raw value sometimes read 32767 instead of the expected value?
32767 marks an analog input overflow (current ≥ 22.815 mA). It indicates a broken loop, an open wire, or a cell over-range condition. Treat it as a fault and inhibit fill until the loop is restored.
Can I scale the 4-20 mA value with the SCL or SCL2 instruction instead of integer math?
Yes. CX-Programmer's SCL(194) and SCL2(486) instructions accept scaled BCD or binary points and produce the engineering value in one rung. Use SCL2 for the 4-20 mA span, with the input lower limit at 0 and the upper limit at 27648. Integer math is preferred for scan-time determinism on a CJ1M.
How long should the stability window be before allowing fill to start?
200 ms (about 12 scans at 60 ms / scan, or 20 scans at 10 ms) is typical for a 30 BPM filler. Long bellows on the load cell can require 500 ms. The window is set in the stability detection rung using a counter of consecutive in-band scans.
Does the load cell need re-calibration after replacing the SM110?
Yes. The SM110 is part of the metrological chain. After replacement, perform a zero and span calibration with 0 % and ~50 % of full scale test masses, then re-verify with the linearity table from Section 13. The PLC scaling is unchanged because it works on the 4-20 mA span, but the SM110's own mV/V calibration must be redone with a precision test mass.
Why use a shift register instead of a sequencer instruction?
On a multi-station rotary or linear filler, a single shift register bit per station lets the same state-machine ladder rung drive the active station. This keeps the per-station I/O map in one place and avoids duplication. For a single-head filler the shift register is optional; sequential state bits are sufficient.
What resolution does the CJ1W-AD041-V1 provide for 4-20 mA inputs?
The CJ1W-AD041-V1 is a 4-channel, 8 000-count module; with the 27648-rated span it gives ~0.27 mA per count. For a 15 kg full scale that is 0.27 mA × (15 000 / 16 mA) ≈ 0.25 g / count. The internal SINT value in CX-Programmer displays the 0-27648 span directly.