Closed Vineetha1705 closed 3 months ago
Dear D. Vineetha,
The provided code was written by MIKROE.
The PCap04 sensor provides calculated ratios, where the sensor capacitance is divided by the reference capacitance. You only need to read these ratios. For more details, please refer to our application note, "Interpreting-and-Scaling-Raw-Result", available on our website. The sensor capacitance can be determined by multiplying the ratio by the reference capacitance. The internal reference value, which you may be referring to, is more of a theoretical value and is specified on page 11 of the datasheet.
The displayed formula is merely an approach.
I am working with the PCAP04 sensor. Here, the STM32F7 is configured as an SPI master, and the PCAP04 is configured as an SPI slave. My application involves reading values from the CDC (Capacitive Digital Converter) and calculating capacitance.
I am following the code provided by you (CDC Click https://www.mikroe.com/cdc-click) , but I have some doubts which are mentioned below. Specifically, I am reading the raw values in results.res_0
define CDC_EXT_CAP_C1_C0_PF 0.0f
define CDC_INT_CAP_PF 10.0f
define CDC_REF ( CDC_EXT_CAP_C1_C0_PF + CDC_INT_CAP_PF )
C= results.res_0 * CDC_REF - CDC_INT_CAP_PF //capacitance calculation
In the code CDC_REF is taken as sum of CDC_EXT_CAP_C1_C0_PF and CDC_INT_CAP_PF . How you taken CDC_INT_CAP_PF as 10PF.
But In the datasheet, the internal reference capacitance ranges from 1 pF to 31 pF, and the calculation for Cref is Cref ~ 0.959 pF*C_REF_SEL + 3.23pF
Which method should I follow to calculate Cref?
Please help me in this regard.
Thanks & Regards, D. Vineetha.