I have 2 khz square waves with different amplitudes in an analog input. How to can i read those signal's amplitude?
I'd try a digitalRead to find the rising edge, them immediately do an analogRead
Do you know the approximate amplitude? The ADC normally reads between 0 and +5V (assuming a "regular" 5V Arduino). It can be damaged by negative voltages or voltages greater than 5V.
You can run the code from the Analog Read Voltage Example to read the changing voltage in a loop. You can take-out the delay.
Is the base line voltage zero or is it less than zero, a negative voltage?
Paul
could use a rectifier to make it constant positive amplitude
Do you need to detect the amplitude of each cycle of a given 2kHz input or is one 2kHz source going to have fixed amplitude which may be different from another 2kHz source?
If it's the latter you might consider a peak detector circuit; allow it to sample 'N' peaks (characterize what number 'N' is to get a representative peak output corresponding to the amplitude of the input) and then take an ADC reading of the PD output. Use a digital output to trigger the MOSFET to reset the peak value.
Thanks! That sounds good. I will try it.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.