Close
0%
0%

BLE - Battery Client

BLE connections use a server client model.

Public Chat
Similar projects worth following
In this example, a basic battery client is set up on the Ameba Bluetooth stack. The client connects to another Ameba board running the corresponding BLE battery service to read the battery level data.

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 client is set up on the Ameba Bluetooth stack. The client connects to another Ameba board running the corresponding BLE battery service to read the battery level data.

More Resources:

If you need additional technical documents or the source code for this project. Please visit the official websites and join the Facebook group and forum.

  • 1 × RTL8722DM_MINI

  • 1
    Step 1

    On the first Ameba board, upload the BLEBatteryService example code and let it run.

    For the second Ameba board, open the example “Files” -> “Examples” -> “AmebaBLE” -> “BLEBatteryClient”.

    2
  • 2
    Final Result

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

    Open the serial monitor and observe the log messages as the Ameba board with the battery client scans, connects, and reads data from the Ameba board with the battery service.

    3

    Highlighted in yellow, the Ameba board with the battery client first scans for advertising BLE devices with the advertised device name “AMEBA_BLE_DEV” and the advertised service UUID of 0x180F representing the battery service.

    After finding the target device, the Ameba board with the battery client forms a BLE connection and searches for a battery service on the connected device, highlighted in blue.

    With the client connected to the service, the battery client begins to read data using both regular data reads and notifications, highlighted in green.

View all 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