DA14585/DA14586 Reading out an I2C accelerometer and sending notification data


Example description

This SDK6 DA14585 example shows how to communicate with an I2C accelerometer sensor. The sensor data gets sent over BLE with a notification.

An I2C sensor is not necessary to run this example. Defining NO_SENSOR in ADXL345.h disables reading of the sensor. The application will send an incrementing number over BLE in this case.

HW and SW configuration

Hardware configuration

  • This example runs on The DA14585/DA14586 Bluetooth Smart SoC devices.
  • The Basic or pro Development kit is needed for this example.
  • Connect the SCL pin of the ADXL345 to pin 1-0 of the development board.
  • Connect the SDA pin of the ADXL345 to pin 1-2 of the development board.
    • These pins are defined in theADXL345.hfile

Hardware setup Fritzing

  • Make sure the CS pin of the ADXL345 is tied high, this enables I2C mode.
  • The SDO pin is used to select the I2C address, the standard setting inADXL345.his for SDO high.
  • Connect the USB Development kit to the host computer.

Software configuration

  • This example requires:
    • SDK6.0.10
    • A smartphone with a BLE scanning app (for example BLE scanner on Android or Lightblue on IOS)
    • SEGGER’s J-Linktools should be downloaded and installed.

How to run the example

For initial setup of the example please refer tothis section of the dialog support portal.

Compile and run

  • Open the project in Keil µVision 5
    • Optionally, change the parameters in ADXL345.h
  • Compile and run the project
  • Open the BLE scanner app and look for DLG-ACCL
  • Connect to the device
  • 订阅的通知

You should now be able to see the live X, Y and Z acceleration(in milli g). This is shown on the screenshot below:

Notification screenshot

Evothings

This example also comes with an Evothings demo application. The application can connect to the DA14585, and read out the acceleration data. There is also a 3d visualization of pitch and roll. The app is shown below.

App screenshot

Installing the Evothings viewer

At the time of writing, the Evothings viewer app is temporarily unavailable on IOS, step 3 of theEvothings download sitewill get updated once it becomes available again.The Android version of the app is available in theGoogle Play store.

Running the example app

When the Evothings viewer app is started, you are able to connect to the demo project.The project is hosted atINSERT LINK, simply input this URL in the app and tap connect. The app will now load.When the app is loaded you can start scanning for the DA1458x device. If the device is found, the accelerometer data is shown without the device being connected. This is possible because the accelerometer data is included in the manufacturer part of the advertisement data. This is handled in theadv_data_update_timer_cbfunction.After a connection is established, the smartphone subscribes to a notification on the DA1458x device. After this has happened, the device will start sending data to the smartphone. This notification is handled by the following functions:user_catch_rest_hndl,user_svc2_g_wr_ntf_handler,user_svc2_g_timer_cb_handler.

Known Limitations

  • There are No known limitations for this example. But you can check and refer to the following application note forknown hardware limitations.
  • Dialog SoftwareForum link.
  • you can Refer also for the Troubleshooting section in the DA1585x Getting Started with the Development Kit UM-B-049.