Setup and Configuration of Limit Switches
Here is how my board is wired. This document is focused only on the connector highlighted in red. HobbyCNC has a new board, please verify the pin-out is the same. As I recall, each of the inputs on this terminal block have a 10k pull-up resistor. I feel this is sufficient to allow the pin to be un-connected, but I am not comfortable taking a high impedance line too far away from the board, and sure-as-hell not laying in a wire tray alongside high current stepper motor power wires.
Opto Isolation Board
To keep the noisy, nasty outside world away from the HobbyCNC driver board I made a simple 5 channel isolation board – to match the 5 inputs on the HobbyCNC board. Below is the schematic for the opto board.
- 12 volts in is fused.
- Opto outs go straight to the HobbyCNC board.
- There is no electrical path between the 12V side and the HobbyCNC side of the circuit.
- D1 and R7 create a 4.7 volt reference to the base of each of the PN2222 transistors. This makes a basic constant-current source of approx 20ma.
- This constant current source design allows me to add up to 3 extra LEDs in the circuit without having to worry about changing any resistor values.
- I was able to add additional LEDs out at the milling machine for validation that the circuit is indeed complete (especially important if you need to remember to put a wire on your tool prior to probing).
- To aid in verifying wiring is all working without a voltmeter, I included on the circuit board an LED on each of the 5 lines, plus a power LED.
- An external 12VDC power source is required
Board design is very simple, single sided – which is why the SMT opto isolators mount under the board. I used isolation routing on my mill to make the PCB. I never got around to putting the actual resistor values in the schematic, but you should be able to read them from the image below (red, red, brown = 220Ω, brown,black, red = 1k, Blue, grey, brown = 680Ω)
Wiring the limit switches
All 6 limit switches are wired in series – if any limit switch is tripped, regardless of which one, the circuit is ‘broken’, no current flows through the opto isolator, the opto transistor shuts off, and the input on the HobbyCNC board is pull high (10k internal pullup). The wiring ‘daisy chains’ from the NC of switch 1 to the COM of switch 2, from the NC of switch 2 to the COM of switch 3, from the NC of switch 3 to the COM of switch 4, etc.
Configuring LinuxCNC for limit, home and probe inputs
I have wired 5 lines: Z Home, X Home, Y Home, Limit and Probe. Here is how I configured the LinuxCNC system using the StepConfig wizard. I have several setups, one with all three axis ‘homes’ enabled, one setup with only Z ‘home’ configured and a third with no home lines configured (I use this one when I’m routing wood).
The pin numbers I selected follow the wiring recommendation from the HobbyCNC site.
For my ‘all inputs enabled’ setup, I have:
- Pin 10 – all 6 limit switches wired in series
- Pin 12 – Probe In, inverted (this is NOT the same as Z axis home)
- Pin 12 – Z axis home
- Pin 13 – X axis home
- Pin 15 – Y axis home