Why is my Proximty sensor output being pulled to .1V on pin 11

I am making a CNC machine using GRBL on and arduino UNO R3. I am using proximity sensors for homing/limits. I am using an LJ12A3-4-Z/BX, this is an NPN sensor. See Circuit drawing below, data sheet for sensor here.

I the goal is to use the GRBL library, but even with a blank sketch loaded, I get the same result.
Code:

void setup() {
}
 
void loop() {
}

I am using 24V as the voltage source for the sensor. I have a voltage divider on the output made from 1K and 220 resistors. I have the output from the voltage divider wired to a pin 11 on the arduino. The ground from the voltage source, Sensor, and Arduino are tied together

When I test the sensor output pin (Not plugged in to the arduino) it is 0V, when triggered it is 4.26V.

When I plug the output pin into the arduino, I get .1V when not triggered, and .5V when triggered.

What is happening that is pulling down the voltage on the input? Is the pullup resistor internal to the arduino affecting the circuit? How? What do I need to do for the arduino to correctly read the states of the sensor output?

A schematic of how you have it wired up would be useful as well as the code your are using. If you have not enabled the internal pullup resistor, it is not part of the circuit. If you did, then it will affect the circuit.

Do you have the ground from the 24V connected to the arduino ground?

Rude but straight reply: Forget it. Following a discussion...... There are more members asking for assistance so please present the important information here.

Hi, @ttalma
Welcome to the forum.

Please read the post at the start of any forum , entitled "How to use this Forum".

This will help with advice on how to present your code and problems.

A hand drawn circuit diagram will be fine.

The sensor looks like it is OPEN collector NPN.

Is the gnd of your 24V supply connected to the gnd of your UNO?

Thanks.. Tom... :grinning: :+1: :coffee: :australia:

What genius wrote this:

"First, we read the sensor output. If it is LOW, no object is near the sensor and if it is LOW, it has detected an object. This is done every half second."
From here:
https://electropeak.com/learn/interfacing-inductive-proximity-sensor-lj12a3-4-z-bx-with-arduino/

See this:
https://www.techonicsltd.com/product/lj12a3-4-z-bx-proximity-sensor-inductive-npn-no-output/

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.