I'm using optocoupler ct817 and 4n25 to amplify and control 2 relays for my project. Here's the schematic I've drawn (look at first picture).
But, I'm confused with the input in one of the optocouplers. It states that minus voltage when I pin the input to the arduino. And it's based one the schematic I drew first.
What should I do to have the positive input in Optocoupler? Thanks for Your attention.
This is the code for controlling the relay
int pin1 = 10;
int pin2 = 11;
int pin3 = 12;
int pin4 = 13;
Please read the first post in any forum entitled how to use this forum. http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Hi,
Thanks for the diagram, however it does not show
What pins you are using.
What the relays are.
What is your power supply.
Are you using current limit resistors for the input of the optocouplers?
You only need one output to control one opto, not two outputs.
OP diagram.
I'm using 12VDC relay and I'm not using any resistor to electrify the relay. The power supply is 12 VDC and it's out of Arduino board. The pin is 10 and 11 in Arduino Mega (but I'm testing it at Arduino Uno).
Very few optocouplers can pass enough current to drive a relay. You said in the first post "4N25" which sounds like a transistor. More detail on that part of the schematic is required. Is it a module you've purchased? Can you show a link to the product detail or datasheet?
This is the schematic I aimed that connected to the relay which can change the direction of the electricity. I use Relay to control the trigger and change of resistor value in CD4047 that can varies the frequency. I connect the relay to Arduino Mega (now UNO) for changing the voltage (HIGH and LOW). The change is managed by using temperature sensor to command the Relay and CD4047 that can adjust the resistance which affect the frequency
MorganS:
Very few optocouplers can pass enough current to drive a relay.
If you let us know the part numbers of both the relay and the opto, we would have some chance of checking this for you. Why don't you try reading the datasheets yourself and asking any questions that you have from the data sheet. (Refer to the page numbers and link to the actual document you're reading.)
The use of optocouplers is to isolate the input from the output. By using the same power supply with common gnd and +V there is no isolation so no point in using these. If you don't require isolation use a MOSFET or Transistor. If you require isolation supply a separate PS for the output side of the coupler
MorganS:
Very few optocouplers can pass enough current to drive a relay. You said in the first post "4N25" which sounds like a transistor. More detail on that part of the schematic is required. Is it a module you've purchased? Can you show a link to the product detail or datasheet?
Even the most cursory search shows 4N25 is one of the most commonly used opto couplers. The 4N immediately tells you it has 5 terminals and is silicon based.