+-------------------+ | | +----)------------+ | | | | | | +-------+ | | +---------+----o Digital output | | | | | | | +24V ac o---\/\/\/\/--+ | __ __ __ __ | 10K | | | | | | | | | | | | | +--------------------------+ | | | | | +--|(+)\ | | \ Voltage | | | | | >---+ / / Pull-up resistor Divider | | | +--------|(-)/ | \ ~100K | | | \ / | | | Dual Comparator (LM 393) | \ | | +--------------------------+ | | | |__| |__| |__| |__| | -24V ac o-+-\/\/\/\/--+ | | | | 1K | +---------+----o Vcc | | +---------------+----------------------------------------o Ground The 120Vac <-> 24Vac transformer could be replaced by a larger voltage divider, but that would couple the USB ground line to one pole of the AC line. Comparator is LM 393 or equivalent, used as a zero-crossing detector. Digital output is connected to pin B0 of the Teensy.