Arduino + (omron e3z-ls61 photoelectric) or (photoswitch 42sml-7100)

I have been researching about these two photoelectric hardware for a while now, but I don't seem to be understanding on how I could connect them to the arduino.

The first one is an omron e3z-ls61 photelectric
The datasheet can be found at this link:

it has four cords coming out at the end:

Brown : Power supply (+V)
White : BGS/FGS selection
Blue : Power supply (0 V)
Black : Output

I don't know how to wire it and code it on an arduino uno, or if I need to get a shield for it.

The second one is a photoswtch 42sml-7100:
The datasheet can be found at:

But for this one their are only 2 kinds of cords coming out the end.

Red for (+) positive
black for (-) negative

And same as the last one I don't know how to wire it and code it on the arduino uno.

Any help would greatly be appreciated!!!

These are industrial photosensors, which are wonderful devices. They work. No futzing around with shielding ambient light, noise, amplifiers.... The problem for you is that they output whatever their supply voltage is, which is 12-24VDC. You can not put more than 5v on an Arduino input. There are some industrial devices that have "Open collector" outputs, which can work with your Arduino, somewhat directly.

However you can use a resistor divider to provide a 5v signal to the Arduino.

If 12-24VDC is available to you, use the Omron. The BGS/FGS is for Background or Foreground Suppression. Might be needed in your application. The 2-wire device you are talking about is just the light source for the Photoswitch (Allen-Bradley) units, which operate in "Through Beam" mode. If an object blocks the beam you get a signal. You would still need the receiver. Photoswitch does have some "Diffuse" mode and "Retroreflective" mode units, which are single-piece.

Sorry for late reply.

Thank you very much Paulcet. Your advice is really helping me figuring this out. I have lately been working on it, and I'll share it if I finish my project soon.