Welcome! Log In Create A New Profile

Advanced

Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3

Posted by dont_go_away 
Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
October 28, 2016 02:53PM
Hi,
first of all, sorry for my english, I try to explain my problem about my new inductive sensor.
I bought this sensor: LJ18A3-8-Z BX NPN NO

I wired my sensor following this scheme:

Brown wire to power supply and blue and black wires to the ZMIN on the ramps 1.4 and the sensor works, because if I pass below the sensor, an alluminium foil, the sensor turns on.

My problem is: when I type G29 the X and Y axis go to home perfectly, instead the Z axis goes down without stopping when the led turns on. If I don't stop with the "STOP button" on Repetier-host, the extruder continues to go down untill touch and break the glass over the heated bed.

I think that is a firmware problem, but I haven't idea what's the cause. I try to search in the posts on this forum the answer for my question but I could not find it.
I use the Marlin RC7 firmware and I have made that changes for the autobed leveling:

- uncommented these lines:
#define AUTO_BED_LEVELING_FEATURE
#define AUTO_BED_LEVELING_GRID

- commented this line:
//#define ENDSTOPPULLUP_ZMIN
it was already commented.

- uncommented this line:
#define FIX_MOUNTED_PROBE

then, since the problem wasn't solved, i tried to uncommented these lines:
#define ENDSTOPPULLUP_XMAX
  #define ENDSTOPPULLUP_YMAX
  #define ENDSTOPPULLUP_ZMAX
  #define ENDSTOPPULLUP_XMIN
  #define ENDSTOPPULLUP_YMIN
  //#define ENDSTOPPULLUP_ZMIN
  #define ENDSTOPPULLUP_ZMIN_PROBE
leave commented only this line:
  //#define ENDSTOPPULLUP_ZMIN

But nothing to do, the problem still exist.

I attach my configuration.h ( Configuration.h ) hoping someone help me to resolve this problem and sorry again for my english.
Thanks to all for the helps. smiling smiley

Edited 1 time(s). Last edit at 10/28/2016 08:00PM by dont_go_away.
Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
October 29, 2016 07:27AM
you need to fit a switching diode (in4148 or similar) in the black wire,cathode (bar on diode) goes to the black wire, anode goes to the ramps z min pin,
this will stop the 12 volts output when probe is not trigered from damaging the port.
Allso you will need to enable the zmin pullup.
Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
October 29, 2016 11:19AM
Thanks for the answer, but in your opinion, this fix will solve my problem? Because I have read in this forum that for my sensor diode or resistors are not needed. I think if it was a wiring problem, the sensor wouldn't turns on. Instead the sensor turns on when it's near an aluminium foil, but it doesn't stop. Infact the result of M119 for z_min is always:
z_min: open
either with the sensor LED on or off.

I tried to decomment this:
//#define ENDSTOPPULLUP_ZMIN

but the problem remains.
Thanks again
Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
October 29, 2016 05:07PM
when i posted the above answer i was in the process of testing the exact same probe prior to fitting on my system.
The probe has its own pullup internally connected the its supply voltage, so if the red wire is connected to 12 volts, then the output will
be 12 volts when not triggered and 0 volts when it is triggered.
Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
October 29, 2016 08:28PM
Ok, thanks a lot! I will try your fix and post the result of test.
The 1N4148 diode is the right diode? Is this the right scheme?

Thanks for the help!

Edited 1 time(s). Last edit at 10/29/2016 08:58PM by dont_go_away.
Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
October 31, 2016 07:57AM
Your diagram shows the diode the wrong way , turn it around so that it blocks the 12 volts from the sensor , when the sensor triggers it will then pull the endstop pin to ground thru the diode (endstop pullup needs enabling).
Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
October 31, 2016 10:33PM
Just to be clear, here's how the diode should be wired.


Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
November 01, 2016 03:42PM
Ok, thanks for the answers! I ordered the diodes, when the diodes will come, I will test and I will post the result winking smiley
Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
November 05, 2016 10:00PM
Hi!
I received the diode, I mounted it but the sensor doesn't work now...When I put the aluminium foil under the sensor, the LED doesn't turns on.
I wired the wires in this way, is right?:



Thanks to everybody!
Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
November 07, 2016 02:50AM
Are you talking about the LED on the sensor itself? What happens if you disconnect the diode altogether? Have you tried sensing something more solid, like a metal washer? Are you sure that the black wire is connected to signal, and the blue one connected to ground? Is 12V on the brown wire? Have you tried disabling the endstop pullups in the software?

Edited 1 time(s). Last edit at 11/07/2016 02:51AM by nebbian.
Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
November 07, 2016 03:35AM
Quote
nebbian
Are you talking about the LED on the sensor itself? What happens if you disconnect the diode altogether? Have you tried sensing something more solid, like a metal washer? Are you sure that the black wire is connected to signal, and the blue one connected to ground? Is 12V on the brown wire? Have you tried disabling the endstop pullups in the software?

Thanks for the answer, yes, I talk about the LED of the sensor.
If I disconnect the diode the sensor works, the LED turns on when it's near a aluminium foil, but the voltage of signal wire is about 12v.
I tried with aluminium foil and metal and it detects both, it doesn't works only if I connect the diode to the black wire.
The wiring is as in the diagram above, brown wire to power supply, black and blue wires to the z_min pins.

I tried with the pullups active and then I tried to disable the endstop pullups, but nothing to do, with the diode, the sensor doesn't works, without the diode, the sensor works (the LED turns on when it's near aluminium or metals) but the z axis doesn't stop when the LED turns on.

Sorry again for my english, I trying to do the best I can.
Thanks! smiling smiley

Edited 1 time(s). Last edit at 11/07/2016 03:35AM by dont_go_away.
Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
November 07, 2016 08:04AM
I have no experience of ramps but hope I can clarify some of the issues.
The circuit in the sensor requires a permanent power circuit so Brown is connected to a + source (seems OK here). Blue is connected to an earth source. The - pin on the RAMPS sensor pins seems OK. The Black signal goes to the S pin on the RAMPS sensor pins (I assume this is right but I don't know RAMPS). This sensor its Normaly Open so there is no connection on the sensor wire until it switches. This is NPN so when activated it will switch the sensor wire to the same voltage as the input (12V in this case). So you need the RAMPS to recognise the end stop active when there is 12V on the Signal.
I don't see the value of the diode. The S pin must sink the voltage. It does without the diode and allows sufficient current for the LED to illuminate. (So we could assume its normally at 0V) However if the S pin is pulled up to 5V then the 12V from the sensor will not cause the RAMPS to switch but may allow enough current for the LED to trigger.
I am inadequate here as I am not clear on the workings of the pullups etc .
I guess you can check operation by measuring the voltage on the S pin. Applying a voltage to the S pin to confirm it triggers. I would use the voltage from the + pin for this rather than risk the whole 12V through the RAMPS.
Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
November 07, 2016 10:05AM
NPN when referring to sensors like this, normally means that the NPN is hooked up in "common emitter" mode, ie one leg of the NPN transistor is connected to ground. The switched side of the NPN transistor is then used as the signal line.

If your signal goes to 12V when the light is on, then you have a PNP sensor (which needs some different electronics to interface with the RAMPS).

It sounds like something strange is going on.
Is the signal ground of your RAMPS board connected to the ground of the 12V line you're feeding to the sensor?
Is the 12V you are feeding into the sensor, directly from the 12V on the RAMPS, as indicated in the diagram above?

I just rechecked my NPN proximity sensor with a diode, and it works properly according to the diagram I posted above. When the sensor is near metal, the voltage after the diode goes to 0.7V (with a weak pullup). When the sensor is not triggered, the voltage is free to float at whatever voltage it likes to, normally 5V on a RAMPS setup.

Edited 1 time(s). Last edit at 11/07/2016 10:08AM by nebbian.
Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
November 07, 2016 03:56PM
Hi,
I try to summarize:
I sure that my sensor is NPN NO because I read the datasheet and it's write on the sensor.
At the beginning I wired the sensor in this way and the sensor doesn't works:



But maybe I was wrong to wire the wires, infact, inverting the diode (anode to the power supply and cathode to ramps) the sensor LED turns on when is near a metal. Now I have 6.31v from the cathode to the RAMPS and 5.69v from the anode to power supply. I don't know if this wiring is right, but is the only way that I found to make it work. I hope not to be wrong sad smiley

However the initial problem isn't solved: the sensor continues to go down without stopping when the LED turns on.

And now I have a new problem: the z_min pin doesn't work. This means that if I connect the sensor to Z_MIN pin it doesn't works and the voltage is always 0.00v. I think it's because at the beginning (before I opened this post) I connected the black wire directy, without a diode, and I burned the z_min pin of the RAMPS.
For this reason I must use the Z_MAX pin but I don't know the configuration on Marlin to disable z_min and enable z_max. I tried to enable Z_MAX_PLUG and disable Z_MIN_PLUG but Marlin reports this error:
#error "A probe needs a pin! Use Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN or Z_MIN_PROBE_PIN."

If you think that I was wrong the wiring or Marlin configuration, please, help me to resolve it =)

Thanks again! smiling smiley
Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
November 07, 2016 10:18PM
Can you take a photo of where your brown wire is connected to please?

Also what sort of diode is that?

Can you please disconnect the black wire from the diode, and measure the voltage coming out of the sensor when:
a) near metal
b) not near metal
Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
November 08, 2016 03:47AM
Quote
nebbian
Can you take a photo of where your brown wire is connected to please?

Also what sort of diode is that?

Can you please disconnect the black wire from the diode, and measure the voltage coming out of the sensor when:
a) near metal
b) not near metal

Yes, sure!
The brown wire is connected to + of the power supply, anyway when I will come back home, I'll do the photos smiling smiley . The diode is: 1N4148.
I'll test your advise and I will post the results, thanks!
Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
November 08, 2016 06:23PM
Hi,
This is the photos you're asked me:



Quote
nebbian
Can you please disconnect the black wire from the diode, and measure the voltage coming out of the sensor when:
a) near metal
b) not near metal

If I connect the black wire without diode, I'm afraid to burn the z_max pins also, because I have already burned z_min pins connecting the black wire without diode. And if I burn the z_max pins I must change RAMPS (or Arduino, I don't know) sad smiley
Do you have another advice? Thanks!
Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
November 08, 2016 06:34PM
Quote
dont_go_away
Hi,
This is the photos you're asked me:
[attachment 85923 2016-11-0720.20.15.jpg]
[attachment 85925 2016-11-0823.33.44.jpg]

Quote
nebbian
Can you please disconnect the black wire from the diode, and measure the voltage coming out of the sensor when:
a) near metal
b) not near metal

If I connect the black wire without diode, I'm afraid to burn the z_max pins also, because I have already burned z_min pins connecting the black wire without diode. And if I burn the z_max pins I must change RAMPS (or Arduino, I don't know) sad smiley
Do you have another advice? Thanks!

Sorry, I meant this:
Do not connect the black wire to anything, just measure the voltage on the black wire with it only touching your multimeter. I need measurements with the sensor triggered (close to foil, LED showing), and also a different measurement when the sensor is not triggered (LED is dark).
For this measurement, the black wire of your multimeter should be touching the negative terminal on your RAMPS input.

Edited 1 time(s). Last edit at 11/08/2016 06:35PM by nebbian.
Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
November 08, 2016 06:47PM
btw you might need this code:

#define Z_MIN_PROBE_ENDSTOP Z_MAX_PIN


Also in the picture above, the diode is around the correct way. Didn't you say that you had to reverse it?
Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
November 08, 2016 07:54PM
Quote
nebbian

Also in the picture above, the diode is around the correct way. Didn't you say that you had to reverse it?

Yes, sorry, I forgot to say that I took photos before reversing diode. Now the diode is reversed compared to the photos.

Quote
nebbian
Do not connect the black wire to anything, just measure the voltage on the black wire with it only touching your multimeter. I need measurements with the sensor triggered (close to foil, LED showing), and also a different measurement when the sensor is not triggered (LED is dark).
For this measurement, the black wire of your multimeter should be touching the negative terminal on your RAMPS input.

I tried: with the black wire without diode, the voltage of the negative terminal (blue wire) is always 12v (with the LED on and with the LED off).
I found a strange thing, maybe: I tried to measure the voltage of the black wire and is always 6.26v, it's right?

Edited 1 time(s). Last edit at 11/08/2016 07:55PM by dont_go_away.
Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
November 08, 2016 09:27PM
Those measurements don't make sense.

How can the voltage on the negative terminal (blue wire) be 12V when it's grounded?

The measurement of the voltage on the black wire should be done with the brown wire connected to 12V, and the blue wire connected to 0V (but with the black wire from the sensor only connected to the red probe of your multimeter). The black probe from your multimeter should be connected to 0V as well.

Edited 2 time(s). Last edit at 11/08/2016 09:29PM by nebbian.
Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
November 09, 2016 03:54AM
Quote
nebbian
How can the voltage on the negative terminal (blue wire) be 12V when it's grounded?

Is very strange, surely I'm wrong.
I connected the blue wire to the - of the z_max (central pin), the brown wire to the power supply and the black wire to nothing, I put the red probe of multimeter to brown wire and the black probe to blue wire and I saw the voltage on the multimeter, it's right?
Sorry for my mystakes but I'm a beginner sad smiley
As soon as I can, I retry the measuraments.
Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
November 09, 2016 07:44PM
I retried the measuraments without diode and this is the result:
I connected the blue wire to the power supply and then I put the black probe of the multimeter to the blue wire of the sensor and the red probe of the multimeter to the black wire of the sensor.
I have 5.76v when the LED is off and 5.71v when the LED is on.
Is this possible?
Thanks!

Edited 1 time(s). Last edit at 11/09/2016 07:54PM by dont_go_away.
Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
November 10, 2016 02:29AM
Quote
dont_go_away
I retried the measuraments without diode and this is the result:
I connected the blue wire to the power supply and then I put the black probe of the multimeter to the blue wire of the sensor and the red probe of the multimeter to the black wire of the sensor.
I have 5.76v when the LED is off and 5.71v when the LED is on.
Is this possible?
Thanks!

When you made these measurements, what was the blue wire connected to? It should have been connected to 0V (ground) on the RAMPS board. The black wire on the multimeter should also have been touching 0V (ground) on the RAMPS board.
Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
November 10, 2016 09:16AM
The 2 photo's above show that you do have the conections correct, this is how mine is wired and working ok.
Take black wire off of the endstop sence pin.
measure the voltage between the blue wire and the black wire(probe end of the diode ie cathode),(meter - to blue, meter + to black)
you should get ~11 volts when probe not trigered(led off). and 0 volts when probe is triggered(led on).
if the black wire is not switching from high to low then you have a faulty probe.
Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
November 10, 2016 02:17PM
Thanks for the answers.
So, I did some tests:
1 - With diode (cathode to the sensor and anode to the ramps) --> I tried to connect blue wire to - of the ramps and black wire to nothing. I touch with the black probe the blue wire and with the red probe the black wire. The result is that the LED doesn't turn on and the voltage is always 0.04v

If I connect the black wire to the RAMPS the result is the same.

this is a simple diagram:


2 - With diode (anode to the sensor and cathode to the ramps) --> I tried to connect blue wire to - of the ramps and black wire to nothing. I touch with the black probe the blue wire and with the red probe the black wire. The result is that the LED doesn't turn on and the voltage is always 11.50~v

If I connect the black wire to the RAMPS the LED turns on when is near a metal and the voltage is 5.76v when the LED is off and 5.71v when the LED is on.

this is the diagram:


3 - Without diode ---> The result is the same of case 2

By any chance the sensor is broken?

Edited 1 time(s). Last edit at 11/10/2016 02:18PM by dont_go_away.
Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
November 10, 2016 05:10PM
OK, 1st, never connect diagram 1 to the ramps ,you will blow the sense input pin.

what readings do you get when you trigger the sensor as in this diagram ?
Attachments:
open | download - wiring2.jpg (169.7 KB)
Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
November 10, 2016 07:49PM
Quote
obewan

what readings do you get when you trigger the sensor as in this diagram ?

Before the diode the voltage is 11.90v, after the diode is 11.50v


Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
November 10, 2016 09:07PM
Quote
dont_go_away
Quote
obewan

what readings do you get when you trigger the sensor as in this diagram ?

Before the diode the voltage is 11.90v, after the diode is 11.50v

[attachment 86012 wiring21.jpg]

What readings do you get when the probe is
a) triggered
b) not triggered
Re: Sensor LJ18A3-8-Z BX NPN NO - problem with Prusa i3
November 11, 2016 03:54AM
Quote
nebbian

What readings do you get when the probe is
a) triggered
b) not triggered

If I don't connect the black wire to RAMPS the LED doesn't turns on, and the voltage is always 11.90v before the diode and 11.50 after the diode
If I connect the black wire to the RAMPS I have 5.76v when the LED is off and 5.71v when the LED is on.
But in Repetier-host, by the command M119 the z_min endstop is always: open

Today I tried with this sensor: LJ18A3-8-Z BY PNP NO and, with two resistence (10k and 15k) it works perfectly!
I think that the previous sensor is broken, maybe.

Now my problem is that the sensor is smaller then the previous, and it has a lower accuracity, so I have to put it more closer to the heatbed and I haven't space near the extruder sad smiley
The previuos sensor it would have been perfect, but at least I have the auto-bed leveling smiling smiley
Thanks to all for the help!
Sorry, only registered users may post in this forum.

Click here to login