I am trying to measure capacitances using an Arduino UNO.
The C pin charges the capactitor through a 10K resistor (I have also tried 100K and 220), and the G pin discharges it.
V_A and V_B are measurement points across the 10K resistor.
The program does the following:
discharge_capacitor()
while v_b < 4.0V:
t1 = get_time()
pin C = HIGH
dv_1 = v_b - v_a
wait_a_bit()
dv_2 = v_b - v_a
pin C = LOW
t2 = get_time()
t = t2 - t1
calc. q (q = I*t; I = V/R; V is the avg. of dv1 and dv2)
total_charge += q
capacitance = total_charge / last_measured__v_b
print(capacitance)
I.e. it calculates the charge that goes into the capacitor.
It can measure capacitances of 1 and 3 uF with pretty high accuracy (for my purposes), but it outputs 0 nF when I'm trying to measure 470 uF caps. What could be the problem? Am I doing everything completely wrong?