Measuring FREQUENCY of 110 VAC using ATmega 32 and LCD

Status
Not open for further replies.

Kryptone

Member level 3
Joined
Mar 14, 2014
Messages
64
Helped
2
Reputation
4
Reaction score
2
Trophy points
8
Activity points
552
Hello,
I need help to design a circuit to measure the frequency of a 110 VAC sine wave signal and display it on an LCD connected to the ATmega 32. I was thinking of using input capture or perhaps some timers via interupts not quite sure of how this is done though. I need help in designing a circuit to convert the 110 VAC sine wave to square waves and then I can then use input capture to measure the period.

Please help!!!!!
 

I'd suggest you use a small transformer to get safe
isolation. Something out of a junk "wall wart", or if
you have an AC-output one, as-is. Apply the output
to a resistor divider that centers the voltage within
the rails of the uC's digital inputs, through a series
resistor that makes the signal rail-rail at the input
node, and now any Schmitt input is a "good enough"
squaring input.
 

as dick_freebird suggested - use a transformer for isolation and drop the voltage, then a schmitt trigger, then determine the length of a pulse against the clock
or
use a transformer, then a frequency-to-voltage converter, then an A/D converter
 

as dick_freebird suggested - use a transformer for isolation and drop the voltage, then a schmitt trigger, then determine the length of a pulse against the clock
or
use a transformer, then a frequency-to-voltage converter, then an A/D converter

And by clock you mean the timer within the MCU?

Also, if possible could you provide me with a circuit diagram....

- - - Updated - - -

Could an OpAmp be used set up as a comparator to convert the sinewave to a square wave where if non-inverting > inverting output of 1 and output of 0 if inverting > non-inverting?
 

What measurement accuracy do you want. The "proper" mains should be locked to an atomic clock over a period of a day, so the frequency may drop by 2% during daytime and increase 2% at night, but over any day it should be +- 1 part in 10^8+++. if you are talking about a domestic generator, then "frequency" is the last parameter you are interested in, getting it going is the main !!
Frank
 

An MCU clock using an external crystal, will be orders of magnitude better than the most accurate AC sinewave (at least on the short term).

But even if you use the internal clock, you can get resolutions below 1%.

Although you may use any generic opamp for the purpose, I recommend that you use a proper comparator like the LM393 or LM339. They are as cheap and available as generic opamps.
 


Does anyone know how to simulate a schmitt trigger configuration with the LM311 in proteus??
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…