I got a push button and some sensor that need 24V to run but arduino can't take 24V so i want to convert them to 5V logic.
I need your help to know what is the best circuit for me.
I got 2 circuits in attachment.
Circuit 1, MOSFET and resistor, i think this circuit can work in both ways but i'm not sure, can the 2N7000 MOSFET can do this job ? Can this circuit draw to much current on the arduino ?
Circuit 2, optocoupler, i think this circuit is the safest but it don't work on both way. Is the 4N35 is enough for me ?
If you have better circuit propose me. I don't want only a voltage divider because you don't have protection on overcurrent.
The first circuit is not working, I think the Arduino gets damaged in a microsecond.
The second one with the optocoupler is okay.
What do you mean by "both ways" ?
Is the 24V an open collector that is both input and output for the sensor ? I doubt if that is a 24V signal.
Which sensor is it ?
Circuit 1 was take on the pcduino voltage translation board that transfert 5v to 3,3v logic.
I got a 24v illuminated push button and a 24v industrial led that a when to connect to my arduino. When i talk both ways i mean i can connect my led or my push button on this circuit.
one is an input. the opto shows a good DC sensing line. for AC, use an AC opto.
then use a second opto that is out from the arduino that will light the LED.