I am testing out some proximity sensors for my (in development) CNC machine, they will alert on the machine reaching the limit of each of its axis. I am using NPN sensors similar to this one:
The sensor is a 3 wire (+ve, -ve and signal) and I am sending 24v to the +ve. When the sensor is not triggered it gives 24v on the signal wire, when it's triggered it gives somewhere around 0v. I added a pull down resistor to ground so I actually see 5v and now I can connect that to a digital input on my Arduino and that works fine. What I want to do, though, is to have one of those sensors on either end of a given axis (X and Y) and for either one of them to trigger the limits. Each limit only has one input on the Arduino (using GRBL). My question, then:
How do I take two 5v signal wires and trigger the single input on the Arduino? I am thinking I can use a quad AND gate IC, which seems to give me the correct logic, which is 1 when both sensors are providing voltage and 0 otherwise (like when one of the sensors is triggered), ala:
Is the the correct way? Seems very cheap way to do it.
-Steve