Arduino Mega and sensor voltage

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..

when the sensor is tripped or closed it creates a connection to the ground (NPN).

Does that sensor have a designation, a name, a manufacturer, or did You bake it Yourself in the oven?

I am using this sensor

Mageway Indoor Retro-Reflective Photoelectric Beam Sensor 12-240VDC 24-240VAC Infrared Sensor Switch Proximity Switch 6FT Cable Induction 4M

Can You please post a link to the data sheet?

Here is the instruction pamphlet that came with the sensor.

I got the colors mixed up, but here they are

Blue is 12vdc in
White is Common or ground
Black is the NO circuit that I will be using.

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..

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.