CAP 328 : A simple and accurate SMD capacitance meter 3.3pF to 1000µF
Identifying an unmarked SMD capacitor is often a real headache: 22 pF or 220 pF? 100 nF or 1 µF? The CAP 328 was designed to address this very practical need by enabling the rapid identification of capacitors salvaged from electronic circuit boards. Rather than competing with a laboratory-grade RLC bridge, this project leverages a little-known feature of the ATmega328P: the analog comparator combined with the Timer1 Input Capture module.
The CAP 328 was designed to address this very practical need by enabling the rapid identification of capacitors salvaged from electronic circuit boards.
Rather than competing with a laboratory-grade RLC bridge, this project leverages a little-known feature of the ATmega328P: the analog comparator paired with Timer1's Input Capture module.
This architecture allows for measuring a capacitor's charging time with virtually zero latency and very simple software.
Breadboard testing yielded performance far exceeding initial expectations, leading to the creation of formal specifications for the project's further development.
Thanks to the hardware coupling between the analog comparator and Timer1's Input Capture module, the measurement is performed almost entirely by the ATmega328P's internal peripherals.
The software no longer needs to constantly monitor voltage changes or use a wait loop for timing.
Charging the capacitor through R
↓
Internal analog comparator (AIN0/AIN1)
↓
Timer1 Automatic Capture (Input Capture)
↓
Time measured
↓
Calculation C = t / (R × K)
↓
Offset compensation
↓
Display (Liquid Crystal LCD 2x16 I2c or/and Serial port)
Since the threshold is set at 3.162 V, if VCC = 5 V, we are very close to 63.2%, so: t ≈ R × C.
Its role is limited to a few simple operations:
Discharge the capacitor being measured.
Reset Timer1 to zero.
Start charging the capacitor through the measurement resistor.
Wait for the automatic Timer1 capture triggered by the analog comparator.
Convert the number of ticks into time, and then into capacitance.
Apply compensation for offsets and parasitic timing delays.
Display the result.
Five ranges allow for measurements from 3.3 pF to 1000 µF.
The CODE: CAP_328_V01.ino
The software essentially acts as an orchestrator: it prepares the measurement, lets the hardware handle the high-precision timing, and then processes and displays the result.
One pushbutton is used to switch ranges, while a second allows for recalibration. Measured values can be stored in EEPROM (via a code definition).
Display is handled by a 2x16 I2C LCD (equipped with a PCF8574).
The CAP 328 README.pdf document details the measurement principle and technical choices;
the schematic and the experimental results that led to the creation of the CAP328 are also available.
So, for your holidays, take the CAP along with this summer circuit :-)
Bruno Clerc
// FR
Reconnaître un condensateur CMS sans marquage est souvent un véritable casse-tête : 22 pF ou 220 pF ? 100 nF ou 1 µF ?
Le CAP 328 a été conçu pour répondre à ce besoin très concret en permettant d'identifier rapidement les condensateurs récupérés sur des cartes électroniques.
Plutôt que de rivaliser avec un pont RLC de laboratoire, ce projet exploite une fonction méconnue de l'ATmega328P : le comparateur analogique associé au module Input Capture du Timer1.
Cette architecture permet de mesurer le temps de charge d'un condensateur avec une latence pratiquement nulle et un logiciel d'une grande simplicité.
Au fil des essais sur breadboard, les performances obtenues ont largement dépassé les attentes initiales et ont conduit à définir un véritable cahier des charges pour faire évoluer le projet.
Grâce au couplage matériel entre le comparateur analogique et le module Input Capture du Timer1,
la mesure est réalisée presque entièrement par les périphériques internes de l'ATmega328P.
Le logiciel n'a plus à surveiller en permanence l'évolution de la tension ni à chronométrer par une boucle d'attente.
Charge du condensateur par R
↓
Comparateur analogique interne (AIN0/AIN1)
↓
Capture automatique Timer1 (Input Capture)
↓
Temps mesuré
↓
Calcul C = t / (R × K)
↓
Compensation de l'offset
↓
Affichage sur le LCD 2x16 I2C ou/et port Série 9600 bauds
Comme le seuil est fixé à 3,162 V, si VCC = 5 V on est très proche de 63,2 %, donc : t≈R×C
Son rôle se limite à quelques opérations simples :
Décharger le condensateur à mesurer.
Remettre le Timer1 à zéro.
Lancer la charge du condensateur au travers de la résistance de mesure.
Attendre la capture automatique de Timer1 déclenchée par le comparateur analogique.
Convertir le nombre de ticks en temps, puis en capacité.
Appliquer la compensation des offsets et des temps parasites.
Afficher le résultat.
5 gammes permettent la mesures de 3.3pF à 1000µF
Le CODE : CAP_328_V01.ino
Le logiciel devient essentiellement un orchestrateur : il prépare la mesure, laisse le matériel effectuer le chronométrage avec une grande précision, puis traite et affiche le résultat.
Un B.P. sert au changement de Gammes, un deuxième B.P. permet de reprendre une calibration. Il est possible de mettre en EEPROM les valeurs mesurées (via definition dans le code)
L'affichage est confié à un LCD 2x16 I2C (équipé PCF8574=
Le document CAP 328 README.pdf détaille le principe de mesure, les choix techniques,
le schéma ainsi que les résultats expérimentaux ayant conduit à la réalisation du CAP328 sont aussi disponibles.
Alors, pour les vacances, prenez le CAP avec ce circuit d'été :-)
Bruno Clerc
Want to build a project?
Bring your design to life with the Elektor PCB Service, powered by Eurocircuits. Upload the project files and order professionally manufactured PCBs or assembled boards through a proven European production platform.
Supporting KiCad, Eagle, Gerber, and ODB++ formats, the service is suitable for everything from prototypes and validation builds to series production and volume manufacturing.
Made in Europe. Fast. Reliable. Professional.

Discussie (0 opmerking(en))