I thought I had this working until I removed the USB cable from the Arduino (Nano v3).
This is a 12v prox switch that I’d like to read into the Arduino. The odd thing is that it is working as long as I leave USB connected, touch the usb ground to the outside of the USB connector on Arduino, or wire the ground to 120v ground (green). I’ve tried everything but I’m at a loss and not real knowledgable about electronic design. In the end, this won’t have a USB connection so it has to work without it, not to mention, there’s obviously something wrong anyway.
I took the 12v sensing portion of the circuit from an Arduino (optoisolator design):
Prox switch from Ebay:
See attached image for wiring.
Any suggestions are appreciated.
Thanks - Brian