Recommended · for some experience
#114 No contact mains detector for Arduino & Pi 🥧(just 10 components)
Why people recommend it
Ralph S Bacon's circuit is recommended for sensing whether mains is live without a direct connection; the site cannot confirm how well it isolates a microcontroller, and mains can kill.
Watch for: check suitability for your board before going near mains