Close
0%
0%

Ameba Arduino: BLE – BLE Battery Service

In this example, a basic battery service is set up on the Ameba Bluetooth stack.

Similar projects worth following
54 views
0 followers
BLE connections use a server client model. The server contains the data of interest, while the client connects to the server to read the data. Commonly, a Bluetooth peripheral device acts as a server, while a Bluetooth central device acts as a client. Servers can contain many services, with each service containing a some set of data. Clients can send requests to read or write some data and can also subscribe to notifications so that the server can send data updates to a client.

In this example, a basic battery service is set up on the Ameba Bluetooth stack. A mobile phone is used to connect to the Ameba peripheral device and read the battery data.

For more information: 

  • 1 × RTL8722DM_MINI

  • 1
    Install Apps

    Ensure that the following Bluetooth apps are installed on your mobile phone. These apps will show you the raw data sent by Ameba and allow you to interact with the data.

    The recommended application is nRF connect, and is available at the links below:

    LightBlue is an alternative application that can also be used, but has less features:

  • 2
    Code Edition

    Open the example, “Files” -> “Examples” -> “AmebaBLE” -> “BLEBatteryService”

    2

    Upload the code and press the reset button on Ameba once the upload is finished.

  • 3
    Connect Mobile Phone

    On your mobile phone, open the Bluetooth app and scan for the Bluetooth signal broadcast by Ameba, it should appear as a device named “AMEBA_BLE_DEV”.

    3

    Connect to the Ameba Bluetooth device, and a list of available services should appear. Click on the battery service to expand it, and you can see the battery level data value. The arrows highlighted in the box on the right are used to read data and subscribe to notifications. Click on the single arrow to read the battery level value, and a 90% value will appear.

    3

    Click on the triple arrow to subscribe to updates on the battery level value, and the battery value will start updating by itself.

    4

    The serial monitor will show the sketch increasing the battery level every second. When you click on either of the arrows, the sketch running on the Ameba will be notified, and will print out the action taken.

    4

View all 4 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates