Starter Kit Project #15 optocoupler

I'm trying to gain a better understanding of optocouplers. In my project, I am attempting to use an optocoupler to activate a pushbutton that will power an LED (the LED and pushbutton simulate a separate circuit). Once the Arduino powers on, the LED lights up successfully for three seconds before powering off, and never turning on again regardless of the delay values I input into the program. If anyone can explain what exactly is happening I would greatly appreciate it.

Code.jpg

You only activate the Optocoupler LED for 15ms and you expect to see it? Maybe you need to turn on that LED a bit longer... like 2 seconds...

Note to all: USE DRAWINGS not photos of your "air wires". The pictures are almost useless as a reader will run out of patience trying to figure out what your intentions are.

I don't see a current limit resistor for the LED.

StewieStew:
Once the Arduino powers on, the LED lights up successfully for three seconds before powering off, and never turning on again regardless of the delay values I input into the program.


Hmmm. You don't suppose that is because you have it connected to pin 1 of the Arduino instead of pin 2? :astonished: This is the Tx pin, activated while Optiboot waits to see if you want to program it, then shuts off until you activate the serial interface. :roll_eyes:

groundFungus:
I don't see a current limit resistor for the LED.

I do. :grinning:

Hi,
Welcome to the forum.

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?
Currently it is hard to see the orientation of the Opto and LED.

Just as you have a current limit resistor on the input to the opto, you need a current limit resistor in series with the LED.

As has been pointed out the delay(15), is a delay of 15ms, try delay(1000), it will turn the LED on for 1000ms or 1Second.

Thanks.. Tom.. :slight_smile:

Yup this fixed the issue, *Slaps face

[/quote]

Paul__B:


Hmmm. You don't suppose that is because you have it connected to pin 1 of the Arduino instead of pin 2? :astonished: This is the Tx pin, activated while Optiboot waits to see if you want to program it, then shuts off until you activate the serial interface. :roll_eyes:
I do. :grinning: