Bluetooth: EnOcean

The Bluetooth EnOcean sample demonstrates the basic usage of the Bluetooth EnOcean library.

Overview

The EnOcean sample sets up a basic Bluetooth observer for both EnOcean switches and sensors.

The observer device forwards incoming advertisements to the EnOcean library for processing. The application receives events from the EnOcean library through callbacks, and prints the outcome to console. The LEDs of the kit also respond to button presses from an EnOcean switch.

Requirements

The sample supports the following development kits:

Hardware platforms

PCA

Board name

Build target

nRF5340 DK

PCA10095

nrf5340dk_nrf5340

nrf5340dk_nrf5340_cpuapp

nrf5340dk_nrf5340_cpuappns

nRF52840 DK

PCA10056

nrf52840dk_nrf52840

nrf52840dk_nrf52840

nRF52840 DK (emulating nRF52811)

PCA10056

nrf52840dk_nrf52811

nrf52840dk_nrf52811

nRF52833 DK

PCA10010

nrf52833dk_nrf52833

nrf52833dk_nrf52833

nRF52833 DK (emulating nRF52820)

PCA10100

nrf52833dk_nrf52820

nrf52833dk_nrf52820

nRF52 DK

PCA10040

nrf52dk_nrf52832

nrf52dk_nrf52832

nRF52 DK (emulating nRF52810)

PCA10040

nrf52dk_nrf52810

nrf52dk_nrf52810

The sample also requires at least one supported EnOcean device.

Note

The sample supports up to four devices at a time that work with one kit.

User interface

The following LEDs are used by this sample:

LED 1 and LED 2:

At the end of commissioning, blink four times to indicate a new EnOcean device has been commissioned.

After commissioning, indicate whether a button is pressed on a commissioned light switch device.

Note

If you are using EnOcean switches with a single rocker, toggling the rocker is indicated on LEDs 2 and 4.

LED 3 and LED 4:

Indicate the On/Off state of each button channel.

Building and running

This sample can be found under samples/bluetooth/enocean in the nRF Connect SDK folder structure.

See Building and programming a sample application for information about how to build and program the application.

Testing

After programming the sample to your development kit, test it by performing the following steps:

  1. Commission one or more EnOcean devices. The LEDs will blink when each of the devices has been successfully commissioned.

  2. Connect the kit to the computer with an USB cable. The kit is assigned a COM port (Windows) or ttyACM device (Linux), which is visible in the Device Manager.

  3. Connect to the kit that runs this sample with a terminal emulator (for example, PuTTY). See How to connect with PuTTY for the required settings.

  4. Depending on the EnOcean devices you commissioned:

    • If you commissioned a light switch, press any of its buttons or toggle the rocker to control the LEDs. The LEDs light on and off as detailed in User interface, and the received values are printed to the console.

    • Sensor devices will automatically start reporting their sensor values to the application. The values are printed to the console.

The following code sample shows the light switch output when Button 4 on the EnOcean device was pressed and released:

Light switch output
EnOcean button RX: ba:15:00:00:15:e2: pressed:  0 0 0 1
EnOcean button RX: ba:15:00:00:15:e2: released: 0 0 0 1

The following code sample shows the sensor device output:

Sensor device output
EnOcean sensor RX: bb:00:00:00:00:e5:
     Occupancy:          true
     Light (sensor):     85 lx
     Energy level:       92 %
     Light (solar cell): 365 lx

Dependencies

This sample uses the following nRF Connect SDK libraries:

In addition, it uses the following Zephyr libraries: