Capacitance measurement circuit using STM32 - #2

Thread Starter

AlaSH72

Joined Apr 3, 2022
30
I put the capacitor under test between a GPIO pin and ground. Then I put a resistor R across the capacitor.

1) Set the GPIO pin to output and send high to charge the capacitor.
2) Set the GPIO pin to input and allow the capacitor to discharge.
3) Trigger an interrupt on the falling transition.
4) Repeat the process.
5) Measure the time it takes for N such cycles to take place, using a timer module. Select N to suit the range and resolution required.
6) Convert to capacitance.
can you share the code with us? I have the same issue here too...

Moderator edit: New thread created from this.
 

MrChips

Joined Oct 2, 2009
30,821
Welcome to AAC!

Since this thread is taken out of its original context you have to describe what you are trying to do and what problems you are having. Post your code.
 

RayB

Joined Apr 3, 2011
31
can you share the code with us? I have the same issue here too...

Moderator edit: New thread created from this.
Testing a capacitors value can be done on most microcontrollers. This shows the basics:
DIY Arduino Capacitor Tester - YouTube
DIY Arduino Capacitor Tester
5,717 views Jan 10, 2017 DIY Arduino Capacitor Tester
In this video we make an Arduino capacitor tester.We use two digital pins, one for charging and one for discharging the capacitor. One analog pin as our voltmeter input, and a little add on circuit with a couple of resistors.
This works on the principle of TC=R*C. We know R (in this case 100kOhms) and we measure TC until the cap reaches 63%. When that happens we can calculate C.
 
Top