My Understanding
As far as my understanding of MOC3021 optocoupler goes, it should latch pins 4 and 6 whenever there's a current flow between pins 1 and 3.
The Confusion
Image 1 – D1 not glowing and D2 glowing
So, in this image no current flows between pins 1 and 3, however pins 4 and 6 is latched.
Same happens on the breadboard except that even the LED between 4 and 6 isn't glowing either on the breadboard ( unlike the simulation ).
Image 2 – D2 not glowing and D1 glowing
Same happens on the breadboard
Update : Yes increasing current works out fine
Actually it's part of an arduino circuit in which I would be giving an output from an arduino pin to this, and there won't be any LED ( not white one for sure as I came to know now that it requires more voltage ).
So, perhaps it would be fine with an arduino pin, this was just to check the components before hand.
Also , since MOC3021 has 15 mA forward current, so 5V would do the work ( as high in arduino pin would give 5V ).
I suppose even 3.3V would do the work.
Thanks all .
Best Answer
You quite clearly say you are using a 3 volt battery so I would expect the current into the gate to be quite small circa 1 mA and, given that the MOC3021 is typically rated to switch at 8 mA you just may not be providing enough current to the gate.
The gate current is too small because the device itself will need about 1 volt across its input terminals and the LED in series is probably dropping about 2 volts. Hence you have used up all 3 volts in bearly overcoming the blocking voltages in the circuit.