I'm a beginner in electronics. I am trying to use an optocupler (p621) to switch 12v supply to 5v for digital input.
Here is the fritzing diagram
So from the 12v supply I am using 1 1k resistor into the opto P621. So the LED turns on when the button pressed. Then in theory the 5v from arduino connects to pin 2 as a digital input.
Its working fine without much trouble. But even without Optos LED power, the Opto conducts 5v from arduino to the pin.. I've no idea what happens here.
I checked in serial monitor and it says high for that pin randomnly..
So does opto conducts without led voltage or something else wrong in my circuit??