• Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Square wave signal with ADC converter

Thread starter #1
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.


Well-Known Member
Most Helpful Member
Do you want to measure P-P voltage? or peak or average or RMS.
I have a 7Hz 5Vpp square wave signal
What does the 5Vpp look like? Is it oV to 5V or is it -2.5 to +2.5 ? Is it AC coupled through a capacitor?
I assume the 5Vpp signal must change in value. Why measure some that you know to be 5Vpp? So when the signal changes what happens? Will it change to 0 to 4.8V? or does it change like this (0.1 to 4.9V)?
It is safe to assume it is 50% on 50% off. (0/5V)

I think it is 0 to 5V and DC coupled. I think you ADC reads form 0 to 5V but don't know.
Thread starter #3
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...


Well-Known Member
Most Helpful Member
In the schematic:
Signal source; 0V 5V 10hz
The diode catches the peak signal. The capacitor stores the energy.
There will be some voltage loss because the diode. Vout is 4.7 volts. This is how a volt meter measures AC voltage.
Green trace is the 5Vpp signal. Blue trace is output.


Well-Known Member
Most Helpful Member
Why do you have to convert the signal to a DC voltage before reading it with the ADC?


Well-Known Member
Most Helpful Member
This method will read 2.5 volts because it takes the average. And any change in duty cycle will effect the readings. But because we don't really know what you want to do we are just giving ideas.
I believe "any change in duty cycle" is exactly what he wants to see. He has not stated the duty cycle being fixed.


Well-Known Member
Why is it so hard to show what one is doing LOL 5 volts p to p is that 10 volts or is that 5 volts total was it made with a uC running at five volts.

If so just stick a cap on it and read that put a high ohm resistor across it Like post4 without diode tho.
If it's AC use post 4

If it's more then 5 volt total come back a tell us what it is and what's making it you'll need a voltage divider added to the mix.


Well-Known Member
Most Helpful Member
tonytnnelectrotech: How long are you willing to wait for the dc level to accurately represent the average value of (pulse width/pulse period) before sampling it with the ADC? (This has to do with how aggressive the filtering has to be.)

How accurate is the 5V peak value of the pulse train? (Does it need to be normalized to the the ADC's Vdd supply in order to make the reading accurate.)


Well-Known Member
Most Helpful Member
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 ...
As long as every one had a different idea as what is wanted:
"square wave" usually = 50% low, 50% high

"fixed width" = on for 0.05 seconds and off for a variable amount of time so the frequency can be from 3hz to 10hz. Example: fixed on time, variable off time. (not 50%, 50%)

"continuous signal" A square wave is continuous if it is never turned off. A triangle wave is also continuous if it goes forever. I am certain that who ever made up this assignment wants a output that never changes voltage; that is not stated.

What is almost clear is that Tony has given up on us and gone away.
As the saying goes :
Describe the problem correctly, and you have the problem halfway solved.

Unfortunately on this and most of the technical forums I lurk, stating or describing a problem incorrectly is commonplace.

And I am not talking about members whose mother tongue is not English. Those I can understand if they have a poorly translated sentence.
No, I am talking about individuals which do not understand what they want to accomplish or why they want to do it a particular way.

Latest threads

EE World Online Articles