1.. zephyr:code-sample:: fdc2x1x 2 :name: FDC2X1X Capacitance-to-Digital Converter 3 :relevant-api: sensor_interface 4 5 Get capacitance and frequency data from a FDC2X1X sensor (polling & trigger). 6 7Overview 8******** 9 10This sample application periodically reads frequency and capacitance data from the 11FDC2X1X sensor in polling mode or optionally with data ready trigger. It is able 12to read the 12-Bit and 28-Bit, as well as the 2-Channel and 4-Channel versions 13(FDC2112, FDC2114, FDC2212, FDC2214). The 4-channel versions are chosen through 14devicetree properties. The default in this sample is the 2-channel version. 15 16Capacitive sensing is a low-power, low-cost, high-resolution contactless sensing 17technique that can be applied to a variety of applications ranging from proximity 18detection and gesture recognition to remote liquid level sensing. The sensor in 19a capacitive sensing system is any metal or conductor, allowing for low cost and 20highly flexible system design. 21The main challenge limiting sensitivity in capacitive sensing applications is 22noise susceptibility of the sensors. With the FDC2x1x innovative EMI resistant 23architecture, performance can be maintained even in presence of high-noise environments. 24 25 26Wiring 27******* 28 29This sample uses the FDC2X1X sensor controlled using the I2C interface. 30Connect supply **VDD** and **GND**. The supply voltage can be in 31the 2.7V to 3.6V range. 32 33Connect **SD** to a GPIO to control the Shutdown Mode. 34 35Connect Interface: **SDA**, **SCL** and optionally connect **INTB** to a 36interrupt capable GPIO. 37 38For detailed description refer to the `FDC2X1X datasheet`_ 39at pages 4-5. 40 41 42Building and Running 43******************** 44 45This sample outputs sensor data to the console and can be read by any serial 46console program. It should work with any platform featuring a I2C interface. 47The platform in use requires a custom devicetree overlay. 48In this example the :ref:`nrf9160dk_nrf9160` board is used. The devicetree 49overlay of this board provides example settings for evaluation, which 50you can use as a reference for other platforms. 51 52.. zephyr-app-commands:: 53 :zephyr-app: samples/sensor/fdc2x1x 54 :board: nrf9160dk/nrf9160 55 :goals: build flash 56 :compact: 57 58Sample Output: 2-Channel, 28-Bit (FDC2212) 59========================================== 60 61.. code-block:: console 62 63 ch0: 5.318888 MHz ch1: 5.150293 MHz 64 ch0: 49.742308 pF ch1: 53.052260 pF 65 66 ch0: 5.318819 MHz ch1: 5.150307 MHz 67 ch0: 49.743612 pF ch1: 53.051964 pF 68 69 ch0: 5.318822 MHz ch1: 5.150200 MHz 70 ch0: 49.743548 pF ch1: 53.054176 pF 71 72 ch0: 5.318752 MHz ch1: 5.150265 MHz 73 ch0: 49.744860 pF ch1: 53.052828 pF 74 75 <repeats endlessly> 76 77 78Sample Output: 4-Channel, 12-Bit (FDC2114) 79========================================== 80 81.. code-block:: console 82 83 ch0: 4.966171 MHz ch1: 4.946465 MHz ch2: 4.985879 MHz ch3: 4.907051 MHz 84 ch0: 57.059016 pF ch1: 57.514568 pF ch2: 56.608844 pF ch3: 58.442204 pF 85 86 ch0: 4.966171 MHz ch1: 4.946465 MHz ch2: 4.985879 MHz ch3: 4.907051 MHz 87 ch0: 57.059016 pF ch1: 57.514568 pF ch2: 56.608844 pF ch3: 58.442204 pF 88 89 ch0: 4.966171 MHz ch1: 4.946465 MHz ch2: 4.985879 MHz ch3: 4.907051 MHz 90 ch0: 57.059016 pF ch1: 57.514568 pF ch2: 56.608844 pF ch3: 58.442204 pF 91 92 ch0: 4.966171 MHz ch1: 4.946465 MHz ch2: 4.985879 MHz ch3: 4.907051 MHz 93 ch0: 57.059016 pF ch1: 57.514568 pF ch2: 56.608844 pF ch3: 58.442204 pF 94 95 <repeats endlessly> 96 97 98References 99********** 100 101FDC2X1X Datasheet and Product Info: 102 https://www.ti.com/product/FDC2114 103 104.. _FDC2X1X datasheet: https://www.ti.com/lit/gpn/fdc2114 105