Machine control
A USB module as a small PLC: where it works, and where it does not
For sequencing a fixture, switching valves and logging the result, a USB module is a reasonable substitute for a small PLC. For a guard interlock it is not, and the difference is worth stating in numbers rather than in adjectives.
What the isolated solid-state relay outputs really are, reading 24 V field signals without an interposer, IEC 61131-2 input types and the two-wire sensor trap, inrush and flyback, debounce, and where determinism genuinely runs out.
The question comes up on almost every small machine: the sequencing logic is a dozen steps and the I/O count is under thirty, so does this need a PLC at all? Often it does not. But the answer depends entirely on which of two jobs the hardware is being asked to do, and those two jobs have different requirements.
The first job is sequencing, actuation and monitoring: open this valve, wait for that sensor, take a reading, log it. A USB module does this well, and in some ways better than a small PLC because the same box also acquires analog data. The second job is protecting a person from the machine. That one has its own standards and its own hardware, and a general-purpose DAQ does not belong in it.
What the isolated relay outputs actually are
The USB-6525 carries eight solid-state relay outputs. They are specified as ±60 VDC at 500 mA per channel, with isolation between channels. Read that specification literally, because all three parts of it matter.
- ±60 VDC means DC. It is not a 230 VAC contactor rating, and it is not a 120 VAC rating either. If the machine has mains loads, the module switches a contactor coil and the contactor switches the mains.
- 500 mA is a switching rating, and it is per channel. Loads that draw more than that at 24 V — a large solenoid, a heater, a DC motor — need an intermediate relay.
- Channel-to-channel isolation means the eight outputs do not share a common return. That is what allows one output to switch a 24 V DC load while another sits in a different circuit entirely, and it removes the common-return mistake that a shared-ground output card invites.
- Solid state means no contact wear, no audible click and effectively unlimited switching cycles — and also a small off-state leakage current and a small on-state voltage drop. With a very light load, the leakage can be enough to keep it faintly energised.
The input side, and why it saves a whole tray of hardware
Every other module in the range has 5 V logic inputs. Reading a 24 V limit switch or an inductive proximity sensor on one of those means a level-shifting interface — eight channels of it if there are eight sensors, plus the terminal blocks and the space to mount them.
The USB-6525's inputs accept ±60 VDC directly, so 24 V field wiring lands on the module with nothing in between. On a machine with a dozen sensors, that difference alone frequently decides the choice of hardware, because it removes a failure point, a wiring run and a mounting plate.
Input types, and the two-wire sensor trap
IEC 61131-2 classifies 24 V DC digital inputs into types, and the distinctions are not academic — they decide whether a particular sensor will work. The figures below are the commonly cited ones; the standard itself is the authority and should be consulted before a design is signed off.
| Type | ON state | What it is for |
|---|---|---|
| Type 1 | 15–30 V, drawing at least 2 mA | The general-purpose case, typically driven by a mechanical contact or a three-wire sensor. |
| Type 2 | 15–30 V, drawing at least 6 mA | Defined higher ON current, so that a two-wire sensor has a known load to work against. |
| Type 3 | 11–30 V, drawing at least 2.5 mA | The most sensitive of the three, useful where the field voltage sags below 15 V. |
Swipe the table sideways to see all columns
The trap is specific to two-wire sensors, which have no separate supply conductor and therefore must draw their own operating current through the signal line. In the OFF state they still leak a small current — that is how they stay powered while signalling "no target". If the input circuit is high-impedance enough to be turned on by a few hundred microamps, the sensor's own leakage will hold that input permanently ON, and no target will be reported correctly.
Inductive loads: the diode is not optional
A relay coil, a solenoid valve or a contactor coil stores energy in its magnetic field. Interrupting the current collapses that field and produces a voltage spike of the opposite polarity, large enough to destroy a semiconductor output. A freewheeling diode across the coil in reverse bias is the standard remedy, and it is the single most frequently omitted part on a prototype panel.
- Size the diode's reverse voltage for the application, not for the coil voltage. A 24 V coil wants a diode rated well above that — 100 V is the usual choice — because the spike is what it has to survive.
- A plain freewheeling diode slows the release. The coil current now decays through the diode's forward drop rather than across an arc, so a valve that used to close in 10 ms may take 30 ms to 50 ms. On a machine with a cycle-time budget, that matters.
- Where release speed matters, a Zener diode in series with the freewheeling diode — cathode to cathode — lets the coil voltage rise further before clamping, which dissipates the energy faster. The switch then has to tolerate that higher voltage.
Inrush, or why a 500 mA rating is not 500 mA of load
| Load | Typical inrush | Consequence |
|---|---|---|
| Incandescent lamp | 10× to 15× steady-state current, because the cold filament resistance is far lower | A 40 mA lamp can momentarily draw half an amp. On a 500 mA output this is fine; on a 4 mA logic line it is not. |
| Solenoid valve or contactor coil | 5× to 10× until the armature pulls in and the magnetic circuit closes | The transient is short but it is what the output actually has to survive, cycle after cycle. |
| DC motor | Locked-rotor current, often several times running current | Treat motor starting as a separate design problem, not as another digital output. |
Swipe the table sideways to see all columns
Debounce, and the difference between a contact and a state
A mechanical contact does not close cleanly. For somewhere between half a millisecond and twenty milliseconds it makes and breaks repeatedly as the surfaces settle. A controller that reads the raw line will see a burst of transitions, and one that counts them will report several operations where there was one.
- A 10 ms to 20 ms software debounce covers the great majority of panel switches, limit switches and pushbuttons, and costs nothing but a timer.
- Where the input is a counter rather than a state — an encoder, a flow meter, a totaliser — software debounce is the wrong tool. Filtering there destroys the count you were trying to keep, and the answer is a sensor with a clean output or a hardware Schmitt trigger.
- Debounce the state, not the transition. Decide what the input *is* after the settling time has passed, rather than trying to detect the moment it changed.
Where determinism runs out
A PLC executes a scan: read all inputs, solve the logic, write all outputs, repeat, in a cycle time it guarantees. A USB DAQ module does not work that way. It is a device on a general-purpose bus, scheduled by a general-purpose operating system, and the host can be busy.
This is fine for sequencing a fixture, because the consequence of a late output is a slower cycle. It is not fine for a guard interlock or an emergency stop, because the consequence of a late output is an injury.
Picking the module
| The job | Part | Why this one |
|---|---|---|
| Switching real DC loads and reading 24 V sensors, in one box | USB-6525 | Eight isolated solid-state relays at ±60 VDC / 500 mA plus eight ±60 VDC inputs — no interposer on either side, no common return to get wrong. |
| Many logic-level outputs and no analog | USB-6509 | 96 lines at 24 mA sink, enough to drive a lamp panel or a bank of small relays directly. |
| A small number of logic-level lines alongside other tasks | USB-6501 | The low-cost 24-line option when the loads are already handled elsewhere. |
Swipe the table sideways to see all columns
Errors that cost a day each
- Driving a relay coil with no freewheeling diode, then replacing the output module.
- Treating a ±60 VDC relay rating as if it covered mains switching.
- Connecting a two-wire proximity sensor without checking the input's threshold current, and finding it reads ON permanently.
- Sizing an output by steady-state current and ignoring lamp and solenoid inrush.
- Debouncing an encoder input and quietly losing counts.
- Putting a guard interlock through the measurement PC because it was already there.
Every figure in this note is either arithmetic from published resolution and sample-rate specifications, or a value stated by the standard it cites. Where a number depends on a particular module, confirm it against that module datasheet before design freeze.