
| Terminal | Label | Function |
|---|---|---|
| DI-1 | IN1 | Pulse input / Encoder A – isolated NPN, 12–24V, active LOW |
| DI-2 | IN2 | Encoder B / hardware batch reset – active LOW falling edge |
| DI-3 | IN3 | Gate inhibit – hold active to pause counting |
| DI-4 | IN4 | Start trigger – falling edge auto-starts counting |
| AI-1 | VI1 | Analog input 0–10V (loadcell amplifier or auxiliary signal) |
| AO-1 | VO1 | Analog output 0–10V (rate signal to PLC, VFD, or recorder) |
| DO-1 | R1 | Relay 1 – configurable logic (default: Running) |
| DO-2 | R2 | Relay 2 – configurable logic (default: Alarm) |
| DO-3 | R3 | Relay 3 – configurable logic (default: Batch Complete pulse) |
| DO-4 | R4 | Relay 4 – configurable logic (default: Running / spare) |
| Mode | Use Case | Wiring |
|---|---|---|
| COUNTER | Products on conveyor, bags, bottles, cartons | NPN proximity / photo-eye → DI-1 |
| ENCODER | Cut-to-length, web length, bidirectional travel | Encoder A → DI-1, B → DI-2. Enable Quadrature. Set debounce to 0. |
| LOADCELL | Weigh hopper, fill-by-weight | 0–10V loadcell amp → AI-1. Calibrate zero/full-scale in Settings. |
| RATE MON | Line speed monitoring, over/underspeed alarm | Tachometer / encoder → DI-1. Set alarm thresholds. |
| BATCH | Pack N items, cut N pieces, fill N bags | Counter sensor → DI-1. DO-3 pulses on complete. Auto-reset option. |
| LENGTH | One-direction length (roll, cable, hose) | Encoder/wheel encoder → DI-1. Set pulses/unit for encoder resolution. |
From the Dashboard you can change the Batch Target and Current Count on-the-fly without going to Settings. Use the edit boxes in the Batch Progress panel and press Set. Changes take effect immediately and are saved to NVS.
| Trigger | When a log entry is recorded |
|---|---|
| Time interval | Every N minutes (configurable). Good for trend logging. |
| Batch complete | Every time a batch target is reached. Records the batch count and rate at that moment. |
| Both | Whichever fires first — interval or batch complete. |
| Manual (Log Now button) | One-shot entry on the Data Log page. Always available regardless of trigger setting. |
| Symptom | Likely Cause | Fix |
|---|---|---|
| Double-counting | Sensor bounce or noise | Increase debounce in Settings (try 10ms–50ms) |
| Count not incrementing | Stopped, gate active, or wrong edge | Press Start, check DI-3 state, verify edge setting |
| Rate always 0 | Sample window too long | Reduce sample window in Settings |
| Encoder drifts | DI-2 not connected or Quadrature not enabled | Enable Quadrature, wire DI-2 to encoder B |
| Loadcell reads wrong | Wrong calibration voltages | Read live voltage in Settings at zero and full load, re-enter |
| Batch target not updating | Saved old value | Use dashboard Set button or save in Settings |
| Log shows uptime not date | Clock not set | Set clock in Settings after power-on |
| No AP visible | WiFi fail triggers AP after 30s | Wait 30s after boot, then connect to KPJ-Counter |
| Pin | Dir | Value |
|---|---|---|
| V0 | Read | Process value |
| V1 | Read | Rate (units/min) |
| V2 | Read | Batch value |
| V3 | Read | Batches completed |
| V4 | Read | Grand total |
| V5 | Read | Status string |
| V6 | Write 1 | Reset batch |
| V7 | Write 1 | Reset session |
| V8 | Write 1 | Toggle counting |
| V9 | Read | Peak rate |
kpj/counter prefix)| Topic | Dir | Payload |
|---|---|---|
prefix/process | Pub | Process value (float) |
prefix/rate | Pub | Rate (float) |
prefix/batch | Pub | Batch value (float) |
prefix/batches | Pub | Batches completed (int) |
prefix/total | Pub | Grand total (float) |
prefix/status | Pub | Status string |
prefix/cmd/start | Sub | Any → start |
prefix/cmd/stop | Sub | Any → stop |
prefix/cmd/reset | Sub | Any → reset session |
Upload via Arduino IDE OTA when connected to WiFi.
Host: kpjcounter.local Password: kpjota1
KPJ Production Counter V2.1 | KPJ-Control + KPJ Expansion Board