# Converting squarewave to analog voltage.

I have a squarewave that i would like to convert into a voltage that i can use with the analog input of a uno.

The squarewave frequency changes from about 10hz to 600hz ans would like 10hz to be 0v and 600hz to be 5v

I was thinking of a low pass filter and a comparator to do the job but was not certain

Thank you

Instead, you can use pulseIn() or digitalRead() with a timing loop, to determine the frequency directly.

I was thinking of a low pass filter and a comparator to do the job but was not certain

I'm curious about how you're thinking that would work.

what do you want to know about this squarewave? Amplitude?
frequency? is it truly square or asymmetrical?

regards

Allan

You can try with a frequency to voltage converter, like LM331, or others IC like that. In the linked datasheet you'll find schematics and formulas.

Ciao, Ale.

When you filter a square wave the resultant voltage is 0.5 times the peak to peak value irrespective of what frequency it is. When you know this you might understand some of the answers better.

Reading through the original post it seems the op needs a F-V convertor.

Given it's a digital level as given bu the op , pulseIn , as suggested by jremington would do the job.

regards

Allan

I've used the LM2907N-8 (datasheet) very successfully in a different application with similar frequency range on the input (my application was (70-700Hz square wave).

Agree dlloyd - the LM2907 is a handy device - I've used them in revcounters

regards

Allan