A limit switch interface for 3018 and 1610 cnc machines

They are not the stiffest machines, but lots of folk are making pcbs on them.

Something that is missing when they are bought is automatic end-stops, although the ‘Woodpecker’ control board that comes with the machines, which is based on an earlier Arduino shield, has headers for end stop switches, and the software that runs on the cnc’s ATmega has a firmware switch that can be thrown to enable them, and another to select which of logic ‘hi’ or ‘lo’ represents contact with an end stop.

On the board, those end stop connectors are wired straight to the pins of the ATmega (its internal pull-ups are enabled), sometimes with a capacitor to eat spikes, and the software has a delay to try to help with false triggering.

Even so, the long wires are prone to pick up transients from the (usually) unsuppressed spindle motor as well as the steppers motor drive wires. These transients can run up the signal wires or the ground wire into the board.

Fail safer

The arrangement used (I can see there should be a diagram here…) is that the two end stops on each axis are normally-open and wired in parallel. If either of them closes through physical contact, they pull the pin down, and the MCU software stops the machine.

This is not a fail-safe arrangement as the scheme will not work if a switch wire breaks or disconnects.

A safer arrangement (although vulnerable to short circuits) is to use normally-closed switches and wire them in series so the circuit breaks when an end stop is hit.


To increase resilience to noise, people add opto-isolators, although they usually still power the long sensing loops from the 5V logic rail adding another route for transients into the control pcb.

Luckily, these boards have a more robust 12V rail from which to feed the switches, although it is still returned to the common 0V on the board.

EinW cnc limit switchI propose powering the x, y and z axis switch pairs from the 12V line via 470Ω resistors in both +12 and 0V lines (left side of diagram left), with the resistors at the board end to increasing the impedance of any transients that are heading towards the board. The limit switch pairs go in the square loops in the diagram (one shown open circuit = triggered)

D1, 2 and 3 are the internal opto-isolator leds, and the opto-isolator output transistors (not shown) are connected straight between the limit switch pins of the board and 0V through short connections.

Visual fault indication

Only the six resistors and three opto-isolators on the left of the circuit are needed, but I noticed that many other end stop switch boards come with indicator leds, which I think should remain off until there is trouble.

So the right hand side of the circuit is my attempt to light a single led indicate mechanical contact whenever any of the end-stop switches opens.

Essentially, each pnp transistor compares a reference voltage on the npn emitter with the voltage across the lower limit switch circuit resistors R4, 5 and 6, directing current to the led if the limit switch resistor voltages drop – a sort-of threshold-detecting transistor OR gate.

If you have a simpler circuit, please comment below.

The 1k resistors R10, 11 and 13 are not there to improve indicator circuit function but to inhibit transients that might otherwise gain access to the board via the pnp bases.

It consumes a little over 30mA from the 12V rail whether triggered or not. The indicator gets about 9mA when it is triggered.

To save components, R9 and Q4 can be deleted, and all the pnp emitters returned to the junction of R7 and R8. These two resistors both have to be considerably lower then, and current consumption rises to over 40mA to get a similar current through the indicator led.

Thanks to LTspice for providing somewhere for me to draw the circuit diagram. I tried to put a virtual switch in the circuit to model the scheme as it activated but, however many times I typed in ‘ .model MySwitch sw(……  ‘ , I could not get the statement to associate with the voltage controlled switch model – so I boldly gave up.

Source link

We will be happy to hear your thoughts

Leave a reply

Enable registration in settings - general
Compare items
  • Total (0)
Shopping cart