{"id":13343845,"url":"https://github.com/CharlesDias/BLE-Watch","last_synced_at":"2025-03-12T06:30:43.031Z","repository":{"id":65506180,"uuid":"591678697","full_name":"CharlesDias/BLE-Watch","owner":"CharlesDias","description":"Project using the Zephyr RTOS and Nordic nRF52840 DK board. ","archived":false,"fork":false,"pushed_at":"2023-12-08T17:59:35.000Z","size":57933,"stargazers_count":42,"open_issues_count":2,"forks_count":8,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-24T16:49:44.702Z","etag":null,"topics":["ble","docker-image","github-actions","nordic","nrf52840","zephyr-rtos"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CharlesDias.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-21T14:13:43.000Z","updated_at":"2024-10-21T10:28:09.000Z","dependencies_parsed_at":"2024-10-24T07:03:51.398Z","dependency_job_id":"d4a283d7-91ab-4ca6-ad85-4bcc023855aa","html_url":"https://github.com/CharlesDias/BLE-Watch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CharlesDias%2FBLE-Watch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CharlesDias%2FBLE-Watch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CharlesDias%2FBLE-Watch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CharlesDias%2FBLE-Watch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CharlesDias","download_url":"https://codeload.github.com/CharlesDias/BLE-Watch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243171413,"owners_count":20247876,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ble","docker-image","github-actions","nordic","nrf52840","zephyr-rtos"],"created_at":"2024-07-29T19:32:01.564Z","updated_at":"2025-03-12T06:30:43.008Z","avatar_url":"https://github.com/CharlesDias.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bluetooth LE Watch\n\n[![Language](https://img.shields.io/badge/made%20with-C-blue.svg)](https://shields.io/)\n![License](https://camo.githubusercontent.com/890acbdcb87868b382af9a4b1fac507b9659d9bf/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)\n\u003cimg src=\"https://img.shields.io/badge/CMake-064F8C?style=for-the-badge\u0026logo=cmake\u0026logoColor=white\" height='20px'/\u003e\n[![build](https://github.com/CharlesDias/BLE-Watch/actions/workflows/build.yml/badge.svg)](https://github.com/CharlesDias/BLE-Watch/actions/workflows/build.yml)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=CharlesDias_BLE-Watch\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=CharlesDias_BLE-Watch)\n\n\nThis is a sample project using the Zephyr RTOS and Nordic nRF Connect to create a BLE watch. This device is composed with:\n\n* [nRF52840 DK](https://www.nordicsemi.com/Products/Development-hardware/nRF5340-DK) Nordic board.\n* OLED monochrome displays SSD1306 128x64 pixels.\n* and the DS3231 real-time clock (RTC).\n\nBoth display and RTC communicates with the nRF52840 MCU via I2C bus.\n\nSome topics covered:\n\n* Tested on [nRF52840 DK](https://www.nordicsemi.com/Products/Development-hardware/nRF5340-DK) board.\n* Embedded system with [Zephyr RTOS](https://zephyrproject.org/) and [nRF Connect SDK](https://www.nordicsemi.com/Products/Development-software/nrf-connect-sdk).\n* Bluetooth Low Energy (LE) technology.\n* The device works as GAP Peripheral and GATT server.\n* Implemented BLE services officially adopted by Bluetooth SIG and custom services too.\n* Continuous integration (CI) with GitHub Actions, as SonarCloud integration.\n* Use of Docker container.\n\n\u003cimg src=\"docs/images/project.gif\" alt=\"drawing\" width=\"600\"/\u003e\n\n## Bluetooth Services\n\n### Device information service (dis)\n\nExposes the device information.\n\n* Device Information Service: \u003cUUID: 0x180A\u003e\n  * Characteristic: Model number string \u003cUUID: 0x2A24\u003e\n    * Data format: \u003c string \u003e\n    * Properties: Read.\n  * Characteristic: Manufacturer name string \u003cUUID: 0x2A29\u003e\n    * Data format: \u003c string \u003e\n    * Properties: Read.\n  * Characteristic: Serial number string \u003cUUID: 0x2A25\u003e\n    * Data format: \u003c string \u003e\n    * Properties: Read.\n  * Characteristic: Firmware revision string \u003cUUID: 0x2A26\u003e\n    * Data format: \u003c string \u003e\n    * Properties: Read.\n  * Characteristic: Hardware revision string \u003cUUID: 0x2A27\u003e\n    * Data format: \u003c string \u003e\n    * Properties: Read.\n  * Characteristic: Software revision string \u003cUUID: 0x2A28\u003e\n    * Data format: \u003c string \u003e\n    * Properties: Read.\n\n### Battery service (bas)\n\nSimulates the battery level voltage.\n\n* Battery Service: \u003cUUID: 0x180F\u003e\n  * Characteristic: Battery level \u003cUUID: 0x2A19\u003e\n    * Data format: \u003c UINT8[1 byte]\u003e percentage battery level\n    * Properties: Notify, Read.\n\n### Custom service\n\nReceives messages to be shown on the display screen.\n\n* Unknown Service: \u003cUUID: 3C134D60-E275-406D-B6B4-BF0CC712CB7C\u003e\n  * Characteristic: Unknown \u003cUUID: 3C134D61-E275-406D-B6B4-BF0CC712CB7C\u003e\n    * Data format: \u003c TEXT (UTF-8) \u003e limit up to 31 characters\n    * Properties: Read, Write.\n\n## Project Structure\n\n```text\n.\n├── CMakeLists.txt\n├── docs\n│   ├── Assigned Numbers.pdf\n│   ├── DS3231.pdf\n│   ├── DTS_v1.0.pdf\n│   └── images\n├── Kconfig\n├── Makefile\n├── nrf52840dk_nrf52840.overlay\n├── prj.conf\n├── README.md\n├── sample.yaml\n├── sonar-project.properties\n├── src\n│   ├── app\n│   │   ├── inc\n│   │   │   ├── device_information_service.h\n│   │   │   ├── display_ssd1306.h\n│   │   │   ├── gatt_central.h\n│   │   │   └── rtc_ds3231.h\n│   │   └── src\n│   │       ├── device_information_service.c\n│   │       ├── display_ssd1306.c\n│   │       ├── gatt_central.c\n│   │       └── rtc_ds3231.c\n│   └── main.c\n```\n\n## Building and Running\n\n### Building with Docker image in interactive mode\n\nNavigate to the project folder.\n\n```console\n$ cd BLE-Watch\n```\n\nThen, run the Docker image. Replace the `--device=/dev/bus/usb/001/xxx` with the correct value.\n\n```console\n$ docker run --rm -it --device=/dev/bus/usb/001/xxx --device=/dev/ttyACM0 --device=/dev/ttyACM1 -v ${PWD}:/workdir/project -w /workdir/project charlesdias/nrfconnect-sdk /bin/bash\n```\n\nAfterwards, execute the command below to build the firmware.\n\n```console\n$ make build\n```\n\nYou should expect an output similar to the following:\n\n```console\n.\n.\n. \n\n[390/400] Linking C executable zephyr/zephyr_pre0.elf\n[394/400] Linking C executable zephyr/zephyr_pre1.elf\n\n[400/400] Linking C executable zephyr/zephyr.elf\nMemory region         Used Size  Region Size  %age Used\n           FLASH:      353588 B         1 MB     33.72%\n             RAM:       55624 B       256 KB     21.22%\n        IDT_LIST:          0 GB         2 KB      0.00%\n```\n\n### Flashing the firmware\n\nAfter the build is complete, run the following command to flash the firmware:\n\n```console\n$ make flash\n```\n\nThe expected output should be similar to:\n\n```console\n.\n.\n.\n[ ######               ]   0.000s | Verifying image - block 1 of 2\n[ #################### ]   0.000s | Verifying image - Verify successful\n[ #################### ]   2.377s | Verify file - Done verifying\n\nApplying system reset.\nRun.\n-- runners.nrfjprog: Board with serial number \u003cserial-number-value\u003e flashed successfully.\n```\n\n### Running\n\nTest the BLE Watch application with the nRF Connect app, which is available for iOS (App Store) and Android (Google Play).\n\n![BLE Watch](docs/images/ble_watch.gif)\n\n\n## Unit Testing with Ztest\n\nZtest is a simple testing framework for Zephyr applications. It provides basic structures for writing test cases and test suites.\n\nTo run the unit tests for this project, follow these steps:\n\n1. Navigate to the project's directory.\n\n```console\n$ cd BLE-Watch\n```\n\n2. Open the `/dev/ttyACM0` using your preferable serial communication program.\n\n3. Build the tests with the following command:\n\n```console\n$ make tests\n```\n\n4. After building, flash the tests firmware into the board with:\n\n```console\n$ make flash\n```\n\nThe output will show the results of the tests on `/dev/ttyACM0`, indicating which tests passed and which failed.\n\n\n## Next improvements\n\n* Create dedicate task to update the display.\n* Implement Bluetooth service to set the date and time.\n* Flash the application project running west on Docker container.\n* Add Doxygen configuration.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCharlesDias%2FBLE-Watch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FCharlesDias%2FBLE-Watch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FCharlesDias%2FBLE-Watch/lists"}