I connected the collector of a BJT belonging to an opto coupler TLP521 to the input 53 (with PULLUP) of Arduino MEGA 2560 (but the same happens with the connection to pin4 of Arduino UNO). The relevant emitter is connected to the ground.
The corresponding anode of the TLP521’s photodiode is connected in series with a resistance of 1Kohm to 12DC. The cathode is instead connected to a switch. When the switch closes, it connects the cathode to the ground, making conduct the photodiode. Then phototransistor saturates and pin 53 is read as LOW .
Substituting the TLP521 with a TLP620, all the system begins to not operate, like if there were electromagnetic interference on the microcontroller. Replacing again TLP620 with a TLP521, all operation restarts.
Yet the two TLP seem to be compatible in all and the only difference seems to be the dual LED in input.
Could anyone help me to understand what is happening?
Is there a component identical to TLP521 commercially, given that Toshiba has smeso to produce?
Thanks in advanced