Hello this is my first post, and I am looking for some hardware advice.
So my project is using 6 retroreflective sensors, and host of LEDs all controlled by an Arduino Mega.
My project will have a 12VDC power supply that will supply power to the Arduino and the retroreflective sensors.
The sensors have three wires... red is 12v pos, black is 12v neg, and white is a normally open switched leg.
My question is this.... Will I need to install a 12v to 5v buck converter between the white leg of the sensor to the Arduino? Or can I hook the white leg directly to the Arduino?
P.S. sorry if I posted this to the wrong part of the forums.
The answer depends on what is on the white wire when the sensor is 'active/closed'.
It could be a connection to ground (NPN sensor) or a connection to sensor supply (PNP sensor).
Leo..
A Mega can be powered with 12volt on the DC socket (safer) or V-in,
but at that voltage you can't power much else from the mega.
I don't know what "a host of LEDs" means, but about 150mA is the limit.
A 5volt buck converter connected to the 5volt pin (and maybe the LEDs) could be the answer.
Post a diagram, so we can verify.
The sensor is easy.
White to a digital pin, with pull up enabled in pinMode.
Black to Mega ground.
pinMode(sensorPin, INPUT_PULLUP); // LOW = active sensor
Use twisted pair for that 6Ft of wire,
and an optional 100n ceramic cap from pin to ground if in a noisy environment.
Leo..