Friday, April 3, 2015

Simple Optocoupler sample (Introduction to Optocouplers)

What is an Optocoupler? It allows you to connect two circuits which do not share a common power source. There is a small LED inside which will illuminate to close and internal switch when you apply voltage. So this will act as a switch in the second circuit.

I'm going to use following simple arduino sketch to blink a LED connected to a different circuit with the use of a 4N35 optocoupler.
int optocouplerPin = 2;
void setup()
{
  pinMode(optocouplerPin, OUTPUT);
}
void loop()
{
  digitalWrite(optocouplerPin, HIGH);
  delay(1000);
  digitalWrite(optocouplerPin, LOW);
  delay(1000);                  
}
I have prototyped following circuit and connected one end to an arduino uno at the same time other end to a 3V power source. 


After uploading above sketch to my arduino following is my outcome :)

No comments:

Post a Comment