# Converting “MPR121 capacitive keyboard” sensor filter data into capacitance values?

The project that I'm working on, the MPR121 capacitive touch sensing keyboard connected with a 8051 microcontroller, my first intention when I started implementing the project was to measure the capacitance on the touched electrode, reading the datasheet I learned that I can get the capacitance value from the filter data later on I figured that the value I'm getting from filter data is reverse proportional with the capacitance

Image below shows the relation between capacitance and the voltage

Image below shows the value range 0-1024 that we can get from the filter data and shows that the value is inverse proportional with the capacitance

I've configured 0x5c and 0x5d register so that charge current I is 16 mikroA and the charge time T is 0.5 mikroS, I'm getting values of filter data in range from 0-600 does this mean that the capacitance is calculated as below..

C=(I*T)/V=(16*0.5)/(0-1024) ?

Thank you!

According with the MPR121 datasheet (from NXP), you forgot to include $$\V_{dd}\$$:

$$C= \frac{I \times T}{ADC \space counts} \times \frac{1}{V_{dd}} \times 1024$$

If $$\I\$$ and $$\T\$$ are given in $$\\mu\$$A and $$\\mu\$$s respectively, then $$\C\$$ is in $$\p\$$F.

EDIT:

ADC counts available on following register:

EDIT 2:

As the valid operating range of the electrode charging source is 0.7 V to ($$\V_{dd}\$$ - 0.7 V), the min and max ADC counts are given by:

$$ADC_{min}=\frac{0.7}{V_{dd}} \times 1024$$ $$ADC_{max}=\frac{V_{dd}-0.7}{V_{dd}} \times 1024$$

with a fixed intermediate (mid) value of

$$ADC_{mid}= \frac{ADC_{max}+ADC_{min}}{2}= 512$$

With $$\V_{dd}=\$$ 3.3 V (for example on MPR121 Adafruit breakout board), I think that:

$$\left\{\begin{matrix} ADC_{min} \approx 217.21 \\ ADC_{max} \approx 806.79 \end{matrix}\right.$$

No conflit with the first formula I've presented in this answer.

• I know this formula, but the values of the ADC and VDD arise a problem since I dont know how to get their values unless ADC is voltage 0-1024 – Çlirim Murati Apr 1 at 22:51
• No problem, you know that formula but wrote it incorrectly. The $V_{dd}$ in the range 1.7V to 3.6V is the voltage powering the MPR121 and ADC count is the 10 bit binary value (2nd stage filtered) available on "Electrode Data Register ", addresses 0x04 to 0x1D - see the figure added with my last edit. – Dirceu Rodrigues Jr Apr 1 at 23:14
• ADC is the proportional ratiometric value of the voltage so for 5v we have 1023-1024 Adc and lower ADC for lower voltage i know that its value can be read from filter data but the Vdd how to get the exact value because i know the range of it, And what about I and T are they constants as I configured 16mikroA and 0.5 mikroS respectively or do they vary – Çlirim Murati Apr 1 at 23:24
• Note: $V_{dd}$ can never be 5 V (as I said, between 1.7 V and 3.6 V). What's your $V_{dd}$ value? – Dirceu Rodrigues Jr Apr 1 at 23:51
• Are you using a 5V shield with built in regulator for powering the MPR121 with lower voltage? For example, the Adafruit breakout board includes a 3.3 V regulator - in this case the referred $V_{dd}$ will be 3.3 V. See my edit 2. – Dirceu Rodrigues Jr Apr 2 at 0:22