I can't seem to get my H11AA1 optocoupler to detect 6VAC


I have a 6V line and I need to detect whenever there's voltage/current on the line. I hooked up an H11AA1 optocoupler along with an input resistor on pin 1 as follows:
(6V-1.2V)/91Ohm = 53 ma which is under the 60ma threshold for the chip.
Pin 2 goes to AC ground.

I'm then hooking pin 4 to ground on the Arduino and pin 5 on the chip to pin 27 on the Arduino and configuring it as INPUT_PULLUP. My program detects when pin 27 changes state. When I turn on the power, I get:
Pin 27 is low
Pin 27 is high
Pin 27 is low
Pin 27 is high
Pin 27 is low
Pin 27 is high
etc. It bounces between low and high.

Here's what I don't understand. If I put more voltage through the line, it stabalizes at low. I'm doing the same thing with other lines that have 17VAC on them and I'm not seeing this behavior.

Any ideas what's going on? Thanks for your help.

A schematic, hand drawn and photographed would help, as would seeing your program

You are completely overdriving that opto coupler, its intended for 10mA operation. 60mA is when it dies and fries, game over levels of current.

6Vac has a peak value of 8.5V, so you are definitely exceeding the device's absolute maximum rating. AC voltages are always quoted as rms values, which are 0.707 times less than the peak voltage for a sinusoid.

Use a 470 ohm resistor. Your H11AA1 may need replacing.

etc. It bounces between low and high

Then it is working correctly, despite being overdriven on input. The input is AC, with the voltage close to zero at two points in the cycle.

Yes the 6V is within the 1.2V range too much of the time. I added a 0.1uF capacitor across the input to the Arduino and ground and that got rid of the bouncing.

I'll add a bigger resistor. I used a smaller one thinking maybe I wasn't getting enough current for the opto to work correctly.

Thanks again everyone.