Dugan:
I am trying to use an arduino to control a 12V photoelectric sensor. Im trying to use this sensor to detect an object and give an output of 0 or 1.
"to control" - meaning precisely to do what? Turn the power to it on/off?
Any links to this "photoelectric sensor"?
Why not use a 12 V power supply and use a voltage regulator to bring it down to 5 V for Arduino?
For the output, use something from the ULN family or similar.
For input an optocoupler.
Shpaget:
Why not use a 12 V power supply and use a voltage regulator to bring it down to 5 V for Arduino?
For the output, use something from the ULN family or similar.
For input an optocoupler.
The only input to the system is 240V, I did think about storing a smaller computer power supply or such into the assembly and using one branch of the 240 to power it
Shpaget:
A computer power supply? Why would you need such a monstrosity for an Arduino and one sensor?
Just looked it up, Im just going off what I've used when I was a lot younger experimenting with 12V outputs and its all I had laying around. I can get small ones cheap I just saw.
there will be 4 sensors total along with a reed switch that will control a 240V relay and a timer circuit to cut power to an object after no detection for 60 seconds.
The 12v rating of the photo sensor will be the max voltage the sensor will take. It may well be happy on 5v try it out. If not buy a new one they only cost pennies!.
holmes4:
The 12v rating of the photo sensor will be the max voltage the sensor will take. It may well be happy on 5v try it out. If not buy a new one they only cost pennies!.
Is it an M51 or M51P?
OK, those devices have "open collector" outputs (the P units are PNP though).
(Either way, the output is not a voltage hi/lo, it's a transistor.) If it's an M51:
The easiest thing to do would be to connect the "black output" terminal to an Arduino input pin and use the "internal pull-up" - make the pin an input and then digitalWrite it HIGH (yes, digitalWrite to an INPUT).
The device's Ground ("Blue" / 0V) must be connected to Arduino Ground, too.]
So are you trying to get the sensor to input to the Arduino? If so you can use a simple 4N25 Optoisolator its a NPN type and you could use it either as a input from the 12 volts to send a signal to the Arduino or as a output from the Arduino to your 12 sensor. Best part is since its isolated you wont damage either device.