I would like to measure the mains power (120vac/60hz) to know precisely when the voltage drops to 0, but in a safe manner for the pi - one solution would be to use a high-value resistor bridge that measures the peaks, and then add (1/240) seconds to when it detects those, but I am wondering if there is a safer/better alternative.


This isn't really a question about the Pi; it is an Electrical Engineering question, and would be better asked elsewhere.

I am always worried by questions about connecting the Pi to the mains, which then proceed to show little understanding of circuit design.

Your primary concern should be YOUR safety, not just the Pi. Some form of mains rated isolation is essential.

It is also unclear what you are asking. The title talks about measuring frequency - if this is your intention the mains is of higher accuracy than the Pi; you could use the mains to measure your Pi clock!

If you want to detect zero crossings then this is easy. Search for zero crossing detectors. A Schmitt trigger is the simplest, and the Pi's GPIO inputs can be configured to do this.

  • It was the zero crossings I was after, I will look into those (I didn't know what it was called "officially"), thanks. And I find it hard to separate Pi questions - if it's software, chances are it is covered under some unix forum, otherwise if it's electrical/GPIO, it's EE – user2813274 Aug 27 '14 at 2:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.