I'm a BLE beginner. Never developed anything for bluetooth®, let alone the low energy variant.

I received a Bluetooth Low Energy Pioneer Kit ( cy8ckit-042-BLE ) a few weeks ago.


I'm testing the CapSense proximity sensor and the BLE payload.


related posts:

First Steps with the Cypress BLE Pioneer KIT - Unboxing and BLE Sniffing


Photo 05-05-15 16 32 50.jpg




The Cypress PSoC and PRoC have fabric on them that's specialized in capacitive sensing.

This module delivers the  functionality behind the capacitive slider on the base board. It is also configurable as a proximity sensor.

The base board has a header where you can plug in one side of a wire ring..

The wire acts as the sensor. It will react on your hand moving close to it.

You don't have to touch it. It will react from some distance.

The spec says that the diameter of your sense wire has impact. I'll test that in this post.


The Proximity Sensor header is directly connected to P2.0 of the BLE modules.

On our PSoC or PRoC chip, that's pin 37. We'll find that back later when we define the routing.

In the PSoC Creator IDE we'll take care that this signal P2.0 is implemented as a CapSence Proximity Sensor.


Configuring the Proximity Sensor


In today's exercise I'll use the Programmable Radio on Chip module. I have no particular reason to choose this module. But I've used the PSoC the previous time.

We'll have to select a CapSense component in the PScO Creator, and configure it as a Proximity Sensor.


I'm using the CapSense Proximity example from my kit's Kit Guide.

The annotated board picture and schematic snippets also come from this guide.


A nice touch of the IDE is that you have direct access to the datasheet of that component.

The pdf explains how to configure and use the CapSense component.

It also defines some specific requirements in the source code of the on-board ARM microcontroller to enable the sensor.


In the IDE, you also define the routing to the pin 37 of the BLE PRoC/PSoC


There are a number of other configurations happening (the BLE module, wake up button, led, ...). I'm not covering them in this article except a little part of BLE.

The special initialization requirement to enable the Proximity Sensor is handled in main.c.


Configuring BLE


The constants related to the BLE payload (attributes) are defined in BLE_gatt.c.

{ 0x000Eu, 0xCAA1u /* CapSense Proximity                  */, 0x00001000u /* ntf    */, 0x0010u, {{0x0001u, (void *)&cyBle_attValues[32]}}   },


All the handling of BLE notifications for sensor value changes are handled in BLEApplication.c.

We'll have to enable the notification from the BLE client (in our case this is the USB dongle that comes with the kit) or the BLE module won't send info.

But once that's done, the functions in BLEApplication.c will send notifications with sensor data over BLE.


Listen to Proximity Sensor Data


Just like in the previous exercise, we're using the USB dongle and CySmart to enable notifications and snoop data.

To make this a bit more interesting - and because the datasheet mentions it - I'm going to test with three different wire loops.

I'm going to make a big shortcut here and jump directly to the notification part.

The Kit Guide has an excellent step-by-step guide on how to get there.


Photo 05-05-15 19 33 51.jpg



My loops have a diameter if 2.5, 4 and 10 cm. I'll measure when the sensor starts sensing, and how close I have to reach to get a full reading (0xFF).

The first step is to enable the notification.

Once we write 01:00 to this attribute, our BLE module gets informed that it has to enable the notification for our proximity sensor.

From than on, the data is streaming. The BLE module will send a notification when it detects a change in sensor data.


And here are the measurements with the 3 wire sensors:

2.5 cm4 cm10 cm
Photo 05-05-15 19 42 38.jpgPhoto 05-05-15 19 42 09.jpgPhoto 05-05-15 19 43 00.jpg
start detecting3 cm3.5 cm9 cm
full scale1 cm2.5 cm2.5 cm


Fun little exercise.