I am new on this forum and recently joined it. I am facing a problem at the moment.
I have a task in which I need to read the peak amplitudes (only positive peaks) of my signal. However the peak duration of my signal is only 10 microsecond so I need a very fast sampling rate. I managed to do so by changing the clock of adc but still that's not good for me as my peak duration is too small and is only 10 microsecond. I cannot use peak detector for this task and I have to detect peaks by either giving the signal directly to Arduino adc or to use some external fast adc. Now I am trying to find some external fast ADC but I don't know how should I select the ADC as I am also new to ardunio as well. I have found a ADC whose conversion rate is 1 microsecond and I believe it should work. here is the link of that ADC
So can I use this to read the peak values of my signal and then give those values to my arduino to show it on the serial monitor. If I cannot use this then please let me know which ADC I can use here, I would be extremely greatful to get a feedback on this as at the moment I am just stuck with these issues.
The ADC is fast enough, your problem is writing code that is fast enough to read the data out of it, detect whether the pulse has started yet and record the data when it has. On a 16MHz Arduino and using 8 bit ADC resolution, using direct port access, I think is should be possible to achieve one reading about every 2us using 8-bit parallel access, or every 3 to 4us using SPI.
Thanks dc42 but I have tried by programming and I could get the accurate reading and also my professor is saying now that I should use some external high speed adc which can be as fast as of 1 micro second conversion time so if you could give me some idea of selecting a adc which can work with arduino?
Any ADC with an SPI or I2C interface can be made to work with Arduino.
Go to www.analog.com and browse around, Analog Devices will even send free samples if you request from a school address (yourname@yourcollege.edu).
The problem is in knowing where to take the sample at. If you can detect a rising edge, you can use that grab the signal level with an ADC's internal Sample & Hold circuit, do the conversion, read that value in & decide to keep or not based on comparison to an already stored value.
scorp84:
Thanks dc42 but I have tried by programming and I could get the accurate reading and also my professor is saying now that I should use some external high speed adc which can be as fast as of 1 micro second conversion time so if you could give me some idea of selecting a adc which can work with arduino?
Thanks again
When I said the ADC is fast enough, I meant the one you linked to. The ADC in the Arduino is definitely not fast enough. Sorry for the ambiguity.
IIRC there are some ADCs with interrupts, sounds like that might fit the bill (and would be easy). Remember to check for SPI as well, other stuff might be to slow..
From nyquist follows that you need 3 samples within the 10 usec timeframe for a reasonable estimate of the peak. The Arduino cannot clock 3 samples in 10 us.
Fastest SPI I have seen is 4Mhz, so 16 bit sample takes at least 4 usec. 0.5(?) usec to store the sample. So reading one sample takes at least 5 usec.
Given that you need 3 samples at least this means 15 usec as minimum, in practice more.
Then the Arduino must do some math so determine the peak (10 usec estimate ) so we reach at least 25 usec, meaning we could have missed a peak allready,
(determine the peak needs solving a polynome of 2nd degree)
IMHO You have to go to a 100Mhz processor like the MBED (mbed.org) or someone should point out the faults in my reasoning.
There is another solution that is not so demanding of A/D performance or processor clock speed and that is to use a rather simple op-amp circuit configured as a peak hold detector. Such a circuit will accumulate and hold the peak voltage seen until reset from a external signal from the arduino. So the sketch would just reset the peak hold detector, wait for a fixed period of time that insures that peak will have been seen during that selected time window, read the value via an analog input pin, and then reset the circuit, and on and on.
Some application requirements are often better met using analog solutions rather then 'forcing' a digital solution. Peak detection of analog signals is probably one of those applications. While it certainly can be done using digital methods it may not always be the most elegant or cost effective method. Learning about op-amps and their many useful application circuits can be very helpful to the advanced hobbyist wishing to expand on their avalible tool box of solutions.
@ remiss....what I can see that the conversion rate is around 20 micro second with mcp 3208....is it so?
@ el_supremo....the frequency can vary but the duration of my peak is fixed which is 10 microsecond and I have to read the peak values whenever the positive peak comes and I have to use some fast ADC now since arduino is slow for such a signal.
@ retrolefty...thats my task, I cannot use hardware form of peak detector and have to do it in some other way either by programming arduino or by using some fast adc and then giving the peak values of every peak to arduino for the display
Sure - you may need an op-amp buffer on the signal being measured to ensure the chip's sample & hold circuitry is being driven with enouht current to make good measurements. See page 15.
robtillaart:
From nyquist follows that you need 3 samples within the 10 usec timeframe for a reasonable estimate of the peak. The Arduino cannot clock 3 samples in 10 us.
Fastest SPI I have seen is 4Mhz, so 16 bit sample takes at least 4 usec. 0.5(?) usec to store the sample. So reading one sample takes at least 5 usec.
SPI in master mode can be clocked at 8MHz on a 16MHz Arduino. So 2us.
robtillaart:
Then the Arduino must do some math so determine the peak (10 usec estimate ) so we reach at least 25 usec, meaning we could have missed a peak allready,
(determine the peak needs solving a polynome of 2nd degree)
My reading of the original post is that the OP only needs to know the peak amplitude. Therefore all he needs to do is compare each ADC reading with the highest reading so far, not do a complicated polynomial calculation.
Hence my original suggestion that, using the ADC he linked to, it should be possible to take a reading every 4us using SPI.
@ retrolefty...thats my task, I cannot use hardware form of peak detector and have to do it in some other way either by programming arduino or by using some fast adc and then giving the peak values of every peak to arduino for the display
The problem is that the sensible solution has been ruled out by the supervisor because it has been done before. This leaves the OP (through us) to jump through hoops looking for a less than optimal solution. All because the OP wants to use an arduino for his project which is not fast enough even if you get an external A/D.
What is the frequency of this signal and what kind of signal is it?
Pete
I have asked in previous threads and the OP is not telling. I think he wants to keep it a secret for some reason. This is a pity because it prevents any further analysis of the situation and precludes a solution from left field. It also prevents us from assessing by how much short the speed requirement is.
@ Grumpy_Mike I am sorry but I am not hiding any thing. I have no reason to hide anything I really want some solution and therefore I have to tell everything in detail to make it easier for u people to come up with some ideas but as I said my supervisor told me that you can use any frequency that is not the issue but the peak duration must be of 10 microsecond so that is the thing. I hope you are cleared now
Yes you are, you will not say where these pulses are coming from, what frequency they arrive at, what is the nature of the signal. All you will say is that they are a 10uS pulse whose amplitude needs measuring. I don't call that free and transparent disclosure.