Sunday, 5 February 2017

Adding a LJ12A3-4-Z/BX NPN Inductive Proximity Sensor to a RAMPS

In building the hypercube printer I wanted  to add an inductive sensor for the Z endstop/probe

I specifically wanted a 12v sensor so as not to load down the already over taxed 5v rail on the RAMPS. 

The main issue is that this sensor has a 12v output and the mega IO pins are 5v input max.

Commonly other have used a 10k and a 15k resistors as a voltage divider so that the output is 5v.  This did not work on my sensor, the result was more like 3v. Which is not high enough to count as a logic high. My sensor seems weird.. I needed to tweak the values.

Second issue, Power.  I didn’t want to run separate power from the supply. The 2 pin 12v ramps connector is already used for hotend fan and I didn’t want to tap into that. I wanted a solution I could just plug in.

My solution was a little unique (well I've not seen anyone else doing this trick)

I'm going to use the E1 socket for power and signals.

This is the result

Note the E1 motor connecter is directly plugged into the inductive sensor and the endstop IO line.

The details.

The circuit is still just a simple voltage divider, but using a variable resistor so the output voltage can to tuned. 

If you look at the pololu pin outs

On the right hand side you see the first 2 pins are VMOT and GND.  That is 12v power, and I will use that for the probe.

The next 4 pins are the 4 stepper motor pins. On the ramps these only go to the stepper plug, so can be reused. I redefined them as +12v, gnd, signal_raw and signal_ttl.

The probe:

Wire up the 3 wires of the probe into a 3 pin plug in the order +12v, GND and signal_raw. Plug this into the E1 "stepper" header, making sure to get it in the right location and orientation. (+12v is pin closest to ramps power plugs)

The board:

Next we build up a simple replacement module, I used vero board

Cut out a piece of vero 7*4 holes in the following orientation.
I used  8 * 4 just to make it a little more pololu sized

Ignore the nick out of the side and the top, these are not deliberate.

The top line will plug into the pololu socket, top left is column 1, row 1 for the following notes.

Add a 10K resistor to the board, on the copper side (connects to columns 2 and 6)

This could be under the board if you really want. (or if your variable resistor doesn’t have clearance to sit over it)

Next add in the variable resistor, I used 20K

This is wired from column 5 row 2 to column 6 row 4. NB column 7 is also now electrically live, but is not used. Make sure you don't connect this to anything (ie don't put in all 8 mounting pins, without isolating this from pin 7)

Add in the power wires.

This is the underside. So column 1 is at the right.
12v (red) is connected from column 1 to column 3
GND (black) is connected from column 2 to column 4

The top now looks like this

Next add in the 6 connecting pins.

 Bottom view


Apply +12v to pin 1 and GND to 2 of the connector
Attach your inductive probe to pins 3,4 and 5 (12v, GND and signal_raw)
Attach a multimeter to GND and pin 6 (signal_ttl)
Adjust the variable resistor till you get a nice 5v out. Check that when its triggered the voltage still drops to about .5v    

All going well you can now just plug the adaptor into the E1 socket.

Now all you need to do is wire up signal_ttl to your Endstop signal line.
in the first result image above this is the green wire from the Z min endstop signal line to the 4th pin of what used to be the motor connector.

NB if you over volt the ramps 12v 5amp input (ie use a single 13v supply on both power inputs generally used make the bed heat faster, make sure you re adjust the variable resistor so the output is still 5v.)  

Objective achieved. A plug in play solution for a 12v NPN Proximity Sensor that doesn’t involve splicing cables for power, or nasty cables with inline resistor divider circuits.

1 comment: