I am just testing this component MOC3021 optoisolator, its datasheet can be found here.
This is my circuit in Proteus:
Please forgive me for my ignorance of electronics, I have my background in computer science.
I tried the whole day yesterday trying to make out what's written about it in the datasheet, the point of connections was easy to understand, rest I don't know much. However, I did learn a lot and welcome to accept more.
However as you can see the LED didn't glow, now for one thing I know it's an AC optoisolator but shouldn't current flow from one of the diodes of the DIAC?
Thanks a lot 🙂
Update : Problem Solved
Thanks a lot, all of you it's a great community here ( especially for noobs like me ).
This is the final working circuit.
P.S.
All answers were correct but I could only choose one, sorry others 😐
Best Answer
You've got three problems.
1: no current limit on the MOC3021 LED. With 5V there the LED inside the MOC3021 will not last long, so add 220 ohms in series with the input.
2: not enough voltage on the output. The output is is a phototriac which has a forwards voltage drop of 1 to 1.5V - to light the blue LED you want 3V or so and a resistor to limit current, 9V with a 470 ohm resistor in series would be a good starting point.
3: the output is a triac: once triggered on, it will continue to conduct until something else stops the current - using an AC supply to power the output side circuit would help here.