you might find this useful if you've got a 3d printer or cnc setup with an mks sbase board (a cheap smoothieboard clone), and if you want to add one of the typical cheap "LJ" inductive probes (for levelling, homing, whatever).

board background

i've got a "mks sbase v1.3" driving my 3d printer, and it works quite well.

it's not entirely 100% identical to any of the smoothieboards but that's neither unexpected (the smoothieboard is open hardware) nor bad in my opinion - i for one certainly don't mind not having to bother with separate +5V and +12V power supplies, and the other idiosyncracies aren't too crazy either. the sbase board is fairly cheap but not badly made, as far as i can tell.

one of the relevant differences is that the sbase board has fixed pull-ups to 3.3V on all endstop pins (thanks to pixel3design-hub for producing board schematics!).

lj* probes

because my printer is a from-scratch build i wanted it to have some cool things, first of which was to be a z probe. the most common probes are inductive ones, which also happen to be the cheapest.

so i bought one 18mm (diameter, not sense distance...) and a 12mm probe for a few dollars each: one LJ18A3-8-Z/BX and one LJ12A3-4-Z/BX. both are npn - normally open types, and need at least 6V to work. my printer runs on 12V, so that's not a problem per se.

the 18mm probe triggers at about 4mm with my alu heatbed, which works well - i can mount it 2mm above the nozzle and not worry about curling up plastic hitting it etc. the lj12 is of marginal usefulness because it triggers no higher than 2mm with my alu bed.

trivial wiring: just one diode

these probes' output signal is at the input voltage when untriggered, and at or near ground when sensing. any smoothieboard or clone likely won't survive 12V on a 3-5V input pin for long, so some transformation needs to happen.

the simplest solution (from here) consists of one garden-variety diode between the board input and the probe signal, biased against the probe (ie. anode on the board side). together with smoothieboards' pull-ups that setup reads high when the probe is untriggered (because the voltage on the cathode is higher than on the anode side), and low when the probe triggers (because now the cathode is near ground level so the diode conducts so the pull-ups are overpowered and a low signal is read).

this circuit works ferpectly with my 18mm probe on the 'z max' endstop pin, with this smoothie config fragment:

gamma_max_endstop nc
zprobe.enable true
zprobe.probe_pin 1.29^! #pull up and invert logic

interestingly that circuit does not work, at all, for my 12mm probe or a friend's 12mm probe or his SN04-N probe. i'm not entirely sure why.

also easy and doesn't work: voltage divider

next i tried two voltage divider circuits, with 10k:15k ohm and 100:150k ohm ratios - which didn't work either. the voltage on the signal pin never dropped low enough to read as low, no matter what my smoothie config said about pull-up or pull-down or no pullup.

after a lot more head-scratching i figured out that on the sbase board the endstop pull-ups are fixed (which the schematic confirms). i suspect (but haven't fully verified) that my fairly high resitor values were too high to overpower the builtin pull-ups.

i suspect that if i had used a different input pin i'd have had less trouble, but the z-max endstop pin is oh so handy, both logically as well as connector-wise.

transistor to the rescue

this working solution luckily isn't much more complex, just one 10k ohm resistor and one npn transistor, and relying on the builtin fixed pull-ups:

probe output via 10k ohm resistor into the transistor base, emitter connected to ground and collector connected to the z-max signal pin. this setup produces a low signal for the smoothieboard while the probe is untriggered (12V probe via base resistor into base, transistor conducts, so collector side is dragged low), and high when triggered (the transistor base is now near ground, so the transistor doesn't conduct, so we read high on the collector side).

with the mks sbase having the endstops conveniently arranged in three-pin connector blocks (signal, ground, 3.3/5V) it's easy to wire that up dead-bug style or on a tiny strip of protoboard.

let's hope this page saves somebody else some time and trouble :-)

[ published on Tue 19.06.2018 18:52 | filed in interests/tinkering | tagged 3dprinting, smoothieboard, mks-sbase, electronics, lj18a3, lj12a3 | ]
Debian Silver Server
© Alexander Zangerl