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.