Maker Pro
Maker Pro

Fast Counter Design

hami1101

Jan 30, 2012
1
Joined
Jan 30, 2012
Messages
1
Hello Everyone

I have a question regarding counter design, actually I have analog signal which has a positive and negative peaks of only 10 micro second duration. I wanted to detect those positive peaks only using arduino microcontroller and then displaying the detected peak values as well but since the adc of arduino is slow and takes about 100 micro second to read an analog input so its not possible by using adc of arduino and I am now required to use some fast counter which can count these positive peaks and then the arduino can be used to display the number of counts.

I hope I have explained my work in a good way and look forward to get support on this :)

Thanks in advance to everyone
 

Laplace

Apr 4, 2010
1,252
Joined
Apr 4, 2010
Messages
1,252
Have you considered using one of the arduino external interrupts? Then just have the interrupt handler increment a register. When you say the signal has positive and negative peaks of 10 usec duration, it suggests there may need to be some signal conditioning for the input.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,505
Joined
Jan 21, 2010
Messages
25,505
I was thinking peak and hold too.

allow a window to find a peak, disable the input, read, reset and re-enable.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
12,513
Joined
Nov 17, 2011
Messages
12,513
You can use a zero crossing detector (comparator) to generate a digital trigger signal from the analog input. The digital signal can be used to
1) control a sample and hold to store the level of the analog input during the peak.
2) trigger the µC to start a conversion of the analog signal from the sample and hold

Harald
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
Don't know whether this would work or not, but I think it might be worth trying. I am more familiar with PIC, so I am not sure you could do the same with an Arduino.

The Arduino ADC certainly has a sample and hold circuit. So why not use it to accumulate the peak? Just use a long sample time and connect to the signal through a diode so that the sample and hold inside the ADC will charge to the peak value over multiple samples. Then do a conversion.

Bob

Edit: For more accuracy you could use an opamp circuit that simulates an ideal diode and elminates the voltage offset you wuold get with a real diode. I forget what this circuit is called, but I have seen it before.
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,505
Joined
Jan 21, 2010
Messages
25,505
The problem with just using a diode may be that the signal source may have an impedance which prevents the capacitor from being charged during a single peak.

It may be sensible to have a buffer and an external capacitor. I believe (but I'm not entirely certain) that these ADC's have some small amount of series resistance which creates a time constant that may be too long for these very short duration pulses (not to mention the capacitance of the diode).

I guess that 10uS isn't particularly short, but a lot depends on the shape of the pulse.
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
I don't know anything about AVR but, for the low end PICs the acqusition time is about 20uS, so a single pulse cannot fully charge the capacitor, which is why I reccommeded a long charge time over many pulses. If there was zero leakage in the diode or hold capacitor circuit, the cap would eventually charge to the highest peak in the sampling period minus the diode drop. The actual leakage may make this too inaccurate.

Bob
 
Top