I need to use an opto coupler to reduce 24V to 5V to directly pulse the AVR. This is the first time I'll be using an opto coupler.
As per what I know the OptoCoupler is a 6 pin package. Internally there is a LED on one side and a light detector of some sort on the other.
What pins stand for what. How do I mate the 24V to the opto and which pins should I receive the 5V from ?
What resistors should I use to control current?, series or parallel.
Please give me the resistor values, since I understand the only the basics of it.
I/P pulse from an encoder @ 24V
O/P pulse required for AVR @5V
Overall current required depends on the opto and AVR I guess (Technically a very low current).
Also here's a link to opto couplers which I have easy access to, can I use one from these ? :
You need to tell us exactly what opto you are using in order to calculate the seriese resistor value.
I to the arduino connect the emitter to ground and the collector to the input pin and enable the internal pull up resistors.
The only suitable one for your application in that list is the MCT2E, which is also the cheapest. Connect the output to the Arduino as Mike has suggested (pin 4 to Arduino ground, pin 5 to the Arduino digital input pin, and enable the pullup resistor on the input pin). Connect pin 2 to the negative side of your 24V input, and connect a resistor between pin 1 and the positive side of the 24V input. See pin diagram here http://www.ti.com/lit/ds/soes023/soes023.pdf. For the value of the resistor, anything between about 500 ohms and 10K should work. I would choose 2.2K or 4.7K.
Pull up resistor as in digitalWrite(pinNum,HIGH) when the pin is an INPUT ?. Currently instead of doing that I've been using a 10k resistor in series to ground and the pin, same thing ?
Why? Because "on" = high.
Why? Because "on" = high?
Lots of times, especially in industry, things are "tied high" and the active state is LOW.
Anyway, if you can't reconcile to that, with the attached drawing, when the opto-LED is on (conducting) then its output goes High. Don't use an internal pullup with it.
vikramnayak:
I'll be using falling as an interrupt then ?, I prefer using RISING, probably need a PNP photocoupler for that then ?
Why?
There is no advantage in either using rising or falling why do you prefer one over the other?
Good luck on finding a PNP opto isolator, I haven't seen one.
Is there any IC (Optocoupler) available to have 24vdc digital input convert to 5vdc signal for Aurduion Due board? Want to avoid more component on board.
You have a voltage into the input LED, and a pullup to 5V on the output. So the output is then either 5V normally or 0V when the LED is on.
You need resistor on the input to bring the input voltage down to Vf for the LED, to limit the current through the LED to whatever the maker says it must be.
This page shows the connection and links the datasheet of a 4N25, as an example.
Thanks for reply. I have 24vdc signal from proxy & other sensors. To keep my aurduino board safe side wan to isolate this signal. Since arduino support 5v or 3.3v as input, want to convert this signal to his level with isolation.