Peak Detector while Arduino is asleep

Sounds like an XY problem to me.
We know nothing about the input signal or the Arduino.
I doubt a 1uF electrolytic cap would have problems keeping it's charge for eight seconds.
Leo..

What do you mean by that?
Do you anticipate a change in peak value from 0V to 5V in a single 50usec pulse?
Or do you have a pulse train that will be unlikely to change dramatically between one pulse and the next?

Its the dV/dT max you need to design for.

1 Like

The input to the circuit comes from the output of an logarithmic amplifier. The output filter as, I understand it, exhibits a 2-pole response with a corner at approximately 12 MHz and full-scale rise time (10% to 90%) of 40 ns. I'm interested in 10 kHz changes if that makes sense?

The input signal will have different frequencies but I'm only interested in up to 10 kHz.
The Arduino will read the value from the capacitor when it wakes up!

I thought you said you were going to zero it with a MOSFET at boot time... are you going to do it at some other time? How is that intended to work?

The input signal will have different frequencies but I'm only interested in up to 10 kHz.

Do you not need some additional filtering then? Designing the SAH itself for a particular frequency response is not going to be very easy.

Sorry what do you mean? The capacitor will hold a charge until the Arduino wakes up, samples that value and discharges it through a signal to the MOSFET

Tony, I'd like to ask ask about an elephant in the room here. 8 seconds is a very [extremely] long hold time for an analog peak detector. Why such a long time? Can you shorten it to milliseconds?

Related question. Do you only want to detect the fact that there was a peak? Do you also want to estimate the amplitude of the peak? If so, what kind of accuracy do you want for the amplitude?

I'd like it to be able to hold up to 8 seconds cause that is an watchdog timer cycle. Of course it can be shorter but the ability to hold that long is good to save power.

I'd like to estimate the amplitude of the peak, maybe 90-95% accuracy would be sufficient. Any more would be too much I think since each voltage will correspond to a current I have in my look-up table!

I mean, when does the measurement interval begin? I pointed out earlier that you would have to start at zero volts sometime, or the measurement is meaningless (well actually didn't express that in such detail, but that is it). So you mentioned a MOSFET, but "discharges it through a signal to the MOSFET" doesn't sound like the same circuit. Do you mean, "discharges it with a signal to the MOSFET"? Is it the case, you will measure at boot time, and then reset the capacitor to zero volts immediately after that? When will the capacitor reset circuit be released?

So far, as I understand it, you will be allowing peak measurements to continue during the entire time of the operation of the device, not just when it is powered down. Is that what you want?

Just an additional thought - Your MOSFET circuit will have to be designed so that it can not be inadvertently active when the MCU is powered down.

Yes that's what I want. The peak hold circuit will keep on running even when the Arduino is asleep and hold the peak value in the capacitor. Once the Arduino wakes up, it will sample that value and after that discharge the capacitor with the help of the MOSFET and go to sleep again.

Okay, thank you I will keep that in mind! I need to solve this capacitor problem first :sweat_smile:

So the MOSFET will be held ON while the program is active?

It's only a problem if you don't research it. I have seen many application notes about this, it's a really old subject. The component input impedances are so high, the capacitor type is the most critical aspect. IIRC, those app notes mentioned it, is why I remember. But the MOSFET D-S leakage is something I would look closely at.

Yeah it's just a parameter problem, can't seem to find the right component in ADS to simulate a film or ceramic capacitor

I think it's time for you to end simulations and start looking at real hardware, specifications and some test circuits.

This is school work, I don't have access to anything right now so simulations are the only thing I can do for my report :sweat_smile:

I've found, for reports like that, the educators can also be impressed with an honest, detailed explanation of why the project didn't or can't work as desired. It shows depth, integrity and an ability to think outside the box.

1 Like

Hi Tony:

I'm interested in 10 kHz changes if that makes sense?

No it doesnt. Do you mean a change that occurs in a period of 0.1msec?

We are seeing a lot of guessing here, it would help if you could explain what the WHOLE PROJECT is intended to do, maybe with a block diagram, as you've now introduced a new element "logarithmic amplifier" and

Yeah that's a better way to put it, doesn't need to be faster than 0.1msec!

The whole project is that a logarithmic amplifier will measure signals with frequencies from DC up to around 3 GHz. The output of the logarithmic amplifier will go to the peak hold circuit where the highest value will be held until sampled by the Arduino.

So the "log amplifier" AD8313 is actually a demodulator with a logarithmic response
Vout = k log Vin as shown here
image

note the AD8313 does NOT go to DC. "Wide bandwidth: 0.1 GHz to 2.5 GHz min"
also the output is "respectably" linear from 0.6V to 1.6V out.

The problem is the nature of the "random signals".
Your simulation assumes the output from the demodulator is a
Heaviside step function v = 0.5 + 1.1u(t-10^-4).

whereas in reality its more likely the input will be carrying information such as an audio signal.
We are delving here into the field of information theory and the "entropy" of the input signal.
No matter how fast you sample (and the peak detect is a sample) you will always lose some information - unless the signal is STRICTLY band limited.
Whether the information you lose is USEFUL depends on your needs.

As you have specified a samplng time of 100usec it looks from your image in #16 that the components chosen will easily meet that criterion; in fact its charging in 10usec so you could use a larger cap - say 0.47uF

You havent shown the characteristics you set for the voltage source in your simulation, but I assume we can add
v = 0.5 + 1.1u(t-10^-4) -1.1u(t-T) where T is the time the pulse will turn off.

@anon57585045 is right: there are times simulations just dont work right.
The simulation shows the charge time is fine (and will be even with an 0.47UF)
As it disagrees with the calculations regarding the fall time, you can just go with the math.
Taking a leakage current of 0.1nA (from the data sheet)

shows the result in the simulation is wrong.

Why not repeat the simulation for a simpler circuit - just the source, a diode, capacitor and constant current 0.1nA?

1 Like

Thank you for all the help John. I think I will settle for a capacitor value and just explain in theory how the discharge will and should be, just like you did using formulas! I will have to accept the fact that simulations sometimes wont work right like @anon57585045 said.