1
\$\begingroup\$

I have got a LJ12A3-4-Z/BX Inductive Proximity Sensor Switch NPN DC6-36V with this Specifications:

  • Model: LJ12A3-4-Z/BX
  • Theory: Inductive Type Sensor
  • Wire Type: Cylindrical DC 3 Wire Type
  • Output Type: NPN
  • Detecting Distance: 4mm
  • Supply Voltage: DC6-36V
  • Current Output: 300 mA
  • Response Frequency: 100Hz
  • Detect Object: Iron

(I use 12V or 8V to supply one sensor) enter image description here

this should be connected to this ports of a pic (one sensor per limit):

enter image description here

what do I need optocouplers etc.?

\$\endgroup\$
3
\$\begingroup\$

You can use an optocoupler as follows:

schematic

simulate this circuit – Schematic created using CircuitLab

Choose an optoisolator that has more that sufficient CTR such as a TLP291-4(GB,E).

You can get such optoisolators 4 to a package, so only two would be required. The 12V supply that powers the proximity detectors does not need to share a ground (and probably should not share a ground) with the microcontroller.

Edit: If you want a through-hole package, one suitable type is the TLP624-4(F) enter image description here

\$\endgroup\$
2
\$\begingroup\$

schematic

simulate this circuit – Schematic created using CircuitLab

For a 3D printer application with a RAMPS 1.4 and Arduino Mega 2650, I had the best success with putting a diode in series on the black line/signal line of the sensor. The cathode connects to the black wire of the sensor and the anode connects to the Arduino through the RAMPS board. I configured the Arduino with a pull-up on the input port. The sensor is powered at 12V through the brown wire and ground through the blue wire provided by the RAMPS board.

\$\endgroup\$
  • 1
    \$\begingroup\$ A diagram would help explain your answer - there is a built in schematic tool which you can use. \$\endgroup\$ – Tom Carpenter Oct 16 '16 at 10:44
1
\$\begingroup\$

I'd do some more research on this part. I did a quick Google and I think you have the colours of your wires wrong. Brown appears to be positive supply voltage with black as ground although, on another document it had blue and black reversed. I would also suggest that if it is an NPN output it will produce a "contact" closure to the most negative wire.

Your drawing in your question is debatable too. It shows a "+" symbol by the brown wire yet your diagram indicates +power arrives on the black wire.

Below is something I would expect to find for your sensor but there seems to be contradictions as to what the three wires do.

enter image description here

Here are the anomalies I found: -

enter image description here

\$\endgroup\$
  • \$\begingroup\$ I will test the wiring with an extra circuit before the installation \$\endgroup\$ – kimliv Mar 3 '14 at 14:04
  • 1
    \$\begingroup\$ I have some of these sensors. The diagram the OP posted is correct (though perhaps confusing since they're showing the load rather than what's inside the proximity sensor), and why they chose the colors they did I have no idea. \$\endgroup\$ – Spehro Pefhany Mar 3 '14 at 15:19
1
\$\begingroup\$

What anomolies? There are NONE. You're confused. Those drawings show the hookup OUTSIDE the sensors. The NPN one connects the load to ground when it detects metal (NO) or not (NC). The PNP one connects the load to power when it detects metal (NO) or not (NC). Consequently they show the load for the NPN between power and the black wire since the black wire goes to ground when the sensor is active and they show the load between the black wire and ground for the PNP sensor because it connects the load to power when active. Those drawings are correct but they sure are confusing!

Yeah, black is not ground? Good going there Mr. Manufacturer!

And why the optocoupler? Thats only really necessary if you need complete isolation between the sensor and the control/micro board. I don't see the need for that here.

If its a short connection and not too noisy an environment, just use a small signal NPN transistor with a base resistor (10K should work nicely) and a pullup to 5V on the collector and run the collector to your micro input. With the sensor the OP stated they have, now the digital signal to the micro will be high when metal is detected, low when not. If its noisy, hang a cap to ground on the base of the transistor to act as a noise filter (0.1uF for starters but you can go higher if necessary)

Something along the lines of a 2n3904, 2n2222 or equivalent would work nicely.

\$\endgroup\$
  • \$\begingroup\$ Standard colour code for industrial sensors is brown = +, blue = -, black = signal. This one looks right. \$\endgroup\$ – Transistor Dec 20 '15 at 0:12

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.