leomane
November 20, 2025, 2:59pm
1
Good day
I am building a CNC router using grbl and Arduino. I am using Universal G-code Sender (UGS). I added mechanical limit switches and they worked, but I want to replace them with M12 Proximity sensors NPN Normally Closed. I am struggling with the wiring. With the wiring as in my rough diagram,
the alarm is displayed on UGS and I cannot clear it. I am using the Arduino's pin 10 because that is the pin for the limit switch for one of the axes.
Have you got a common GND connection between the sensor and the Arduino ?
What voltage is the power supply and is it shared with the Arduino ?
leomane
November 20, 2025, 3:35pm
3
The power supply is 12V and is separate from the Arduino.
And the common GND connection ?
leomane:
my rough diagram,
That will not work. It has no GND between the M12 and the Arduino.
leomane
November 21, 2025, 2:55am
6
I am unfortunately very much a beginner with electronics and Arduino. I followed the following advice from a post that I found:
leomane
November 21, 2025, 3:11am
7
Do you mean I need to move the GND from the external power supply to the Arduino?
JCA34F
November 21, 2025, 4:11am
9
We need to know which prox switch you are using, brand name and exact part number or link to datasheet or seller's web page.
leomane
November 21, 2025, 4:28am
10
This is the proximity switch I am using:
The M12 NPN Normally Closed Inductive Proximity Sensor is used for non-contact metal detection, commonly for limit sensing and homing on CNC machines, 3D printers, and automation equipment. This sensor activates when it is within 4mm of a metal...
Price: ZAR 59.00
JCA34F
November 21, 2025, 4:42am
11
Connect the blue wire to 12V ground AND Arduino GND, connect black wire to Arduino pin 10, also connect a 10k resistor from pin 10 to Arduino +5V, connect brown wire to 12V+.
1 Like
leomane
November 21, 2025, 5:14am
12
Thank you. Now it is working.