nRF5 SDK v14.0.0
Capacitive Sensor Low-level Example

The Capacitive Sensor driver example demonstrates how to use the Capacitive Sensor driver in practice.

Note
Due to anomaly 84 (ISOURCE not functional) the COMP implementation should not be used in real product, until it is fixed. You can choose the implementation of the driver by changing the value of USE_COMP.

The example initializes the Capacitive Sensor driver to constantly monitor the level of the analog input 1 (AIN1) and the analog input 7 (AIN7). If the measured value rises above the threshold level on AIN1, LED 1 lights up. If the measured value rises above the threshold level on AIN7, LED 3 lights up.

To run this example, you will need some kind of capacitive pads. These can be made, for example, of aluminum foil.

You can find the source code and the project file of the example in the following folder: <InstallFolder>\examples\peripheral\csense_drv

Testing

Test the Capacitive Sensor driver example application by performing the following steps:

  1. Compile and program the application.
  2. Connect the prepared pads to analog inputs AIN1 and AIN7.
  3. Start a terminal emulator like PuTTY (recommended) with the following Terminal settings, and establish a UART connection.
  4. After reset, basic information about the example is displayed on UART console.
  5. The Capacitive Sensor driver now monitors capacitance values of the pads.
  6. To light up one of the LEDs, touch the corresponding pad.

If LEDs are not lighting up when the pads are touched, or are lit right after initialization, try changing the THRESHOLD_VALUE_PAD1 value and the THRESHOLD_VALUE_PAD2 value in the main example file. If LEDs are not reacting to touch, you must decrease these values, and if LEDs are already lit up, you need to increase them. You can also try entering configuration mode, where thresholds values will be configured for you.


Documentation feedback | Developer Zone | Subscribe | Updated