I have realized what I thought was a classic zero cross detector circuit using an H11AA1 chip: https://www.digikey.com/product-detail/en/on-semiconductor/H11AA1SR2M/H11AA1SR2MCT-ND/2094174
My circuit is the following:
Note, I am using a H11AA1SR2MCT chip in my physical circuit (linked above) which should give me all zero-crossings.
I am now probing with an oscilloscope; I did not attach this circuit directly to 110VAC, I am using a toroidal transformer that gives a ~42V peak to peak isolated output. In the following image, the yellow trace is the transformer output, the green one is the signal at "PAD3" in the above circuit referenced to the local GND. I am using a 3.3V power supply.
I was planning to use that signal to generate an interrupt on a microcontroller very close to zero crossing, but so far it's simply unusable, voltage only goes down to 2.1V instead of zero and the timing characteristics are very far from the actual zero-crossing, even if they stay in sync with the wave. Is there an obvious mistake I am not seeing? Thank you