LJC18A3-H-Z/BX capacitive proximity switch (NPN) with ESP32
Supply 6-36 V
Bus GPIO
Measures proximity, presence
Pins and ESP32 wiring
| Pin | Role | ESP32 pin | Notes |
|---|---|---|---|
| BROWN | Not wired to the ESP32 | — | Supply + from an external 6 to 36 V supply (e.g. 12 V). Never to the ESP32 |
| BLUE | Ground | GND | Supply 0 V. Connect to ESP32 GND too (common ground) |
| BLACK | Output (the part drives it) | D25 | NPN output, LOW when an object is near. Some units pull it up to the supply: measure first, use an optocoupler or divider |
Suggested wiring for the 30-pin ESP32 DevKit, avoiding flash, input-only and strapping pins. BoardPilot checks it for you as you wire.
Starter code (Arduino)
void setup() {
Serial.begin(115200);
pinMode(25, INPUT); // BLACK
}
void loop() {
Serial.println(digitalRead(25));
delay(100);
}
Sources
- LJC18A3-H-Z/BX seller datasheet, Supply 6 to 36 V DC; NPN NO output; range 1 to 10 mm (adjustable); brown +, blue 0 V, black signal
Try it in 3D in BoardPilot
Related parts
A02YYUW waterproof ultrasonic distance (UART)A3144 hall effect switchAM312 mini PIR motion sensorATGM336H GPS/BeiDou moduleBeitian BN-220 GPS moduleBenewake TF-Luna LiDAR (UART mode)
Part data: CC BY 4.0, free to reuse with credit to BoardPilot.