# Measure current peak of a capacitor

Thread Starter

#### E_enthusiast

Joined Aug 20, 2020
31
I was wondering if with the help of a low value resistor and a peak detector attached in parallel with the resisto i can measure the current peak of the charging capacitor, and then maybe send that value to a uC

#### Attachments

• 4.1 MB Views: 16

#### AlbertHall

Joined Jun 4, 2014
11,500
1. You might be better connecting the sense resistor in the ground leg of the capacitor so the uC is measuring the voltage between the output of the peak detector and ground.

2. Also using the circuit you show the first 200mV or so fo the voltage across the shunt will produce no output because of the forward voltage needed by the diode. To solve that you can use an op-amp peak detector circuit as shown here: https://sound-au.com/appnotes/an014.htm

3. Having the sense resistor in series with the capacitor will raise its ESR and may affect the operation of whatever is inside the box labelled power supply.

Thread Starter

#### E_enthusiast

Joined Aug 20, 2020
31
1. You might be better connecting the sense resistor in the ground leg of the capacitor so the uC is measuring the voltage between the output of the peak detector and ground.

2. Also using the circuit you show the first 200mV or so fo the voltage across the shunt will produce no output because of the forward voltage needed by the diode. To solve that you can use an op-amp peak detector circuit as shown here: https://sound-au.com/appnotes/an014.htm

3. Having the sense resistor in series with the capacitor will raise its ESR and may affect the operation of whatever is inside the box labelled power supply.
I was already planning to use an op amp peak detector to eliminate the diode voltage drop.. but i didn't understood very well the first point, can u please explain it in a simplified way

#### AlbertHall

Joined Jun 4, 2014
11,500
The output of your circuit is across C1. The bottom of C1 is at the power supply voltage and the top is a little bit more than that. Grenerally an ADC measures the voltage between 0V and its input so here you would be using only a small part of the ADC input range and so losing a lot of resolution.

Thread Starter

#### E_enthusiast

Joined Aug 20, 2020
31
The output of your circuit is across C1. The bottom of C1 is at the power supply voltage and the top is a little bit more than that. Grenerally an ADC measures the voltage between 0V and its input so here you would be using only a small part of the ADC input range and so losing a lot of resolution.
So you are saying that the other lead of C1 must be connected to the gnd? Should I also unify the power supply gnd with the uC gnd?

#### AlbertHall

Joined Jun 4, 2014
11,500
The components from your original diagram should be arranged as below.

Thread Starter

#### E_enthusiast

Joined Aug 20, 2020
31

#### BobaMosfet

Joined Jul 1, 2009
1,848
Thanks for the help, I understand now
For your further edification, you should also be aware of 2 other things about your original circuit:

1. The resistor & capacitor in series form a voltage divider.
2. The capacitor at the bottom is between ground and the rest of the circuit, so ground is elevated to the circuit. This is okay so long as nothing is then attached from the circuit to the bottom of the capacitor at ground. If you were to have connections from elsewhere in the circuit on both sides of the bottom capacitor, it would form a ground loop.

Thread Starter

#### E_enthusiast

Joined Aug 20, 2020
31
For your further edification, you should also be aware of 2 other things about your original circuit:

View attachment 215673

1. The resistor & capacitor in series form a voltage divider.
2. The capacitor at the bottom is between ground and the rest of the circuit, so ground is elevated to the circuit. This is okay so long as nothing is then attached from the circuit to the bottom of the capacitor at ground. If you were to have connections from elsewhere in the circuit on both sides of the bottom capacitor, it would form a ground loop.
So to fix that the schematic Albert hall posted is enough?

#### schmitt trigger

Joined Jul 12, 2010
463
Albert's circuit should be good enough, replacing the diode with an opamp based precision rectifier.