# Square wave signal with ADC converter

Discussion in 'General Electronics Discussion' started by tnnelectro, Mar 1, 2018.

1. ### tnnelectro

37
0
Apr 5, 2012
Hi,
I have a 7Hz 5Vpp square wave signal, you give me an advice on an easy way, to turn that signal into the corresponding DC voltage, so I can read it through the microprocessor's ADC converter?

Thank you.

2. ### kellys_eye

4,276
1,146
Jun 25, 2010
If the squarewave has a 50% duty ratio then simple smoothing should result in HALF the signal amplitude i.e. your 5V signal will give a 2.5V output therefore a x2 buffer will give the 'real' voltage.

If the duty cycle is variable you have a few more issue to resolve. There are some dedicated frequency-to-voltage converter ICs out there - check out the LM2907 as an example.

3. ### WHONOES

855
206
May 20, 2017
If all that you are interested in is the DC level of the signal then, a peak detector is all that you need otherwise, do as Kellys_eye suggests.

4. ### BobK

7,680
1,685
Jan 5, 2010
If you are trying to measure something, something ought to be varying. You have not told us what. It might be the frequency, the peak voltage, the duty cycle, or something else. So, what are you trying to measure?

Bob

5. ### tnnelectro

37
0
Apr 5, 2012
yes, I need this ...
could you give me an example? thank you.

6. ### tnnelectro

37
0
Apr 5, 2012
the request is:
take a square wave signal with a fixed width of 0-5V and a variable frequency (3Hz to 10Hz, approximately) and convert it into a continuous signal ...
I hope I was clear...

7. ### duke37

5,343
753
Jan 9, 2011
I have never used a modern microprocessor to measure voltages but surely the ADC can be actuated fast enough to enable the average, however you define this, to be calculated.

8. ### Alec_t

2,788
742
Jul 7, 2015
Why can't you use the micro's ADC directly to sample the voltage and deduce the peak value (if that is what you want) from the measured samples?

9. ### BobK

7,680
1,685
Jan 5, 2010
You are far from clear.

I have no Idea what “a fixed width of 0 to 5V” means. Volts is not a measure of width, and 0 to 5 is not fixed.

“Variable frequency” I can understand.

“Convert it to a continuous signal” again has no clear meaning. If I output a steady 5V I would meet that requirement, but I doubt that is what you want.

So how is the output signal related to the input signal? You still have not answered that crucial question.

Bob

10. ### hevans1944Hop - AC8NS

4,459
2,074
Jun 21, 2012
Why is it so hard for people who come here asking for help to tell us up front wtf they are trying to DO? I agree 110% with @BobK, the OP is far from clear. I think @Ian should consider a permanent ban on those who require an extended exchange of questions by EP responders and "answers" by the OP, that do not clarify, just to simply get a coherent and specific message across of what exactly the OP is trying to DO. Makes me think this sort of person is just a troll wasting our time.

We are now up to three responses from the OP and still nothing that defines the problem.

Hop