1
\$\begingroup\$

I'm building a 3D printer, and I want to replace my endstop switches with hall sensors instead. I've bought some NJK-5002c hall sensors from Ebay, but am unsure how I can hook them up to replace the switch.

enter image description here

The previous setup that I have, which works, is that each endstop uses a simple two-pole switch. When the 3D printer reaches the top it hits the button on the switch, and connection is made. The two wires from the switch is connected to two pins on a RAMPS board.

The NJK-5002c doesn't have a lot of documentation, but I've found that if I connect the brown wire to V+ (12V), and blue wire to V- then the black wire will toggle between V- and V+ when a magnet comes close to the sensor.

Now, I'm unsure how to hook this up to replace the passive switch. I'm worried that the RAMPS board will be damaged if I hook up V- and the black wire directly to the two pins on the RAMPS. What do you suggest?

EDIT:

Link to the item I bought.

Schematic of RAMPS 1.4 board

Actually, it seems like the RAMPS 1.4 board has three pins for the endstops, and thus matches the hall sensors perfectly. The passive switches I'm using are connected to the "Endstops" pins between signal and GND, and I think that I can just plug in the NJK-5002c sensors directly to the three pins. I've connected it, and think it might work. Just need to reinstall some software tomorrow to confirm that the software detects the triggering.

\$\endgroup\$
  • 1
    \$\begingroup\$ You do have to realize that few if any folks here will have any clue as to what a "RAMPS" board is. It also seems as you fell into the trap of purchasing parts that you do not have legitimate data sheets for. \$\endgroup\$ – Michael Karas Jan 1 '16 at 17:25
1
\$\begingroup\$

There is a previous post about these here at this thread.

If you look at the "overview" section of the item on Newegg, it describes it as:

  • Detection method: Inductive
  • Switch frequency: 320kHz
  • Detective distance: 10mm
  • Model: NJK-5002C
  • Working voltage: DC6-36V
  • Output format: 3-wire NPN normally open

So the black wire is an NPN collector output, which means it switches from open (not connected to anything) to ground (connected to the blue wire.)

If the previous switch output is switching some wire to ground (call it the red wire), then it's a direct replacement: black to red.

If the previous switch output is switching the red wire between two voltages, such as ground and +5v, then do the same as previous, but tie a 10k-1k resistor from black to the +5v power rail. This will "pull-up" the volts to +5v while not activated.

You may find that this new sensor outputs the inverse of the previous switch (functions backwards.) If that's the case, you can either get a different sensor with the inverse output, or use a variety of methods to invert the signal, such as an NPN transistor or FET. Better yet would be a comparator, as a setpoint or threshold can be specified, allowing better position control, such as figure 3 here. enter image description here

\$\endgroup\$
  • \$\begingroup\$ Your sample circuit is inappropriate. Since the Hall-Effect sensor is open-collector, the output of U4 would need a pull-up resistor. \$\endgroup\$ – WhatRoughBeast Jan 1 '16 at 17:36
  • \$\begingroup\$ Open-collector is explained in the preceding text. \$\endgroup\$ – rdtsc Jan 1 '16 at 17:39
  • \$\begingroup\$ True, but the schematic you provided does not include a pullup and will not work reliably as shown. You must not assume the OP is competent to realize that he needs to modify your circuit. \$\endgroup\$ – WhatRoughBeast Jan 1 '16 at 17:43
  • \$\begingroup\$ "You may find that this new sensor outputs the inverse of the previous switch (functions backwards.)" Most major 3D printer firmware supports inverting the logic of an endstop in software. \$\endgroup\$ – Andrey Akhmetov Jan 1 '16 at 20:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.