nRF5 SDK v12.1.0
Capacitive Sensor Driver Example

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

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 (for example, PuTTY) and connect to the used COM port with the following UART settings:
  1. After reset, basic information about the example is displayed on UART.
  2. The Capacitive Sensor driver now monitors capacitance values of the pads.
  3. 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