nRF Connect SDK Hands-On: Rapid Prototyping with Bluetooth LE and LED Button Service
Nordic Semiconductor
Summary:
This video, part of a series, introduces the nRF Connect SDK and guides users through rapidly prototyping a Bluetooth LE application.
- The nRF Connect SDK is a comprehensive, modular, and scalable SDK for IoT applications.
- A typical Bluetooth LE application involves a wireless System-on-Chip (SoC) connecting to sensors, storing data, establishing wireless connections (e.g., with a smartphone), optimizing for low power, and supporting over-the-air updates.
- The SDK offers robust Bluetooth LE support, including a qualified stack, rich libraries, numerous samples, full applications, and essential development tools like the Power Profiler and nRF Connect for Mobile.
- The tutorial demonstrates setting up the development environment using nRF Command Line Tools, nRF Connect for Desktop, and the Quick Start application.
- It walks through flashing the pre-compiled Peripheral LED Button Service (LBS) sample onto an nRF52840 Development Kit and verifying its functionality using the nRF Connect for Mobile app to control LEDs and monitor buttons.
- Finally, the video covers setting up the Visual Studio Code environment, installing the nRF Connect for VS Code extension, installing the toolchain and SDK, copying the LBS sample as a new application, and building and flashing it from source.
Introduction to nRF Connect SDK and Bluetooth LE Applications [00:00:00]
The nRF Connect SDK is a comprehensive, modular, and scalable software development kit designed for building Internet of Things (IoT) applications. It provides essential building blocks and offers high levels of modularity, scalability, and portability.
- The video series will focus on building a typical Bluetooth Low Energy (LE) application.
- A typical Bluetooth LE application architecture [00:00:50]
- Wireless System-on-Chip (SoC): The core component, connecting to onboard elements like LEDs, buttons, and various sensors (environmental or motion-based).
- Data Handling: The SoC gathers, processes, and stores data in non-volatile memory.
- Wireless Connectivity: Establishes a connection with an external Bluetooth LE device, such as a smartphone, to access real-time and historical data, and control the system.
- Power Efficiency: Applications are typically designed for low power consumption, enabling extended battery operation.
- Over-the-Air Updates (FOTA): Includes mechanisms for over-the-air updates to deliver bug fixes and security patches.
- The initial focus will be on integrating Bluetooth LE connection functionality to wirelessly control LEDs and monitor button status.
nRF Connect SDK Bluetooth LE Support [00:02:19]
The nRF Connect SDK provides excellent support for Bluetooth LE features.
- Qualified Bluetooth LE Stack: Known for stability, reliability, and excellent mobile phone interoperability.
- Rich Set of Bluetooth LE Libraries and Services:
- Includes standard GATT profiles and services (e.g., Battery Service, Continuous Glucose Monitoring Service).
- Features Nordic's custom profiles and services (e.g., LED Button Service, Nordic UART Service, Nordic Status Message Service).
- Large Selection of Samples: Over 100 samples available, often used as starting points, with some including custom mobile applications for testing.
- Full-Fledged Bluetooth LE Applications:
- nRF Desktop: For HID keyboard and mouse.
- nRF5340 Audio: For audio over Bluetooth LE using synchronous channels and the LC3 codec.
- Powerful Tools: Includes the Power Profiler and nRF Connect for Mobile app, essential for development, debugging, and testing.
- Educational Resources: Extensive training and educational materials available through the Nordic Developer Academy.
Quick Start: Setting Up the Development Environment and Flashing a Sample [00:04:20]
The Quick Start application simplifies the onboarding process for new users.
- Required Tools Installation:
- Install nRF Command Line Tools (includes J-Link software).
- Install nRF Connect for Desktop.
- Launch the Quick Start application within nRF Connect for Desktop.
- Development Kit (DK): The demonstration uses an nRF52840 Development Kit, but the demo can be followed with any Bluetooth LE capable Nordic DK (nRF52, nRF53, nRF54 series).
- Flashing a Pre-compiled Sample [00:07:20]:
- The Quick Start app detects the connected DK and offers a list of pre-compiled samples.
- Select the Peripheral LED Button Service (LBS) sample.
- This sample handles Bluetooth LE stack initialization and configures the device as a Bluetooth LE peripheral.
- It advertises its presence and awaits a connection from a central device (e.g., a mobile phone).
- The LBS sample demonstrates controlling LEDs and monitoring buttons on the board.
- Flash the selected sample to the DK.
- Verifying the LBS Sample Functionality [00:09:05]:
- The DK will start advertising (LED 1 blinking).
- Use the nRF Connect for Mobile app (Android/iOS) or the nRF Blinky app to connect to the peripheral device.
- Upon connection, LED 2 on the DK should turn on.
- Enable notifications for the button characteristic in the mobile app.
- Pressing Button 1 on the DK will update the button status in the mobile app.
- Control LED 3 by writing "ON" or "OFF" values to its characteristic via the mobile app.
Setting Up Visual Studio Code for Application Development [00:12:26]
To work with the source code and develop custom applications.
- Open VS Code: The nRF Connect SDK is IDE agnostic, but VS Code is the recommended environment due to excellent extension support.
- Install nRF Connect for Visual Studio Code Extension: This extension streamlines the development process.
- Install Toolchain [00:13:46]:
- From the nRF Connect extension, select "Install Toolchain".
- Choose the latest tagged version (e.g., 2.7.0).
- Install nRF Connect SDK [00:14:43]:
- From the nRF Connect extension, select "Manage SDK" and then "Install SDK".
- Select the SDK version that matches the installed toolchain (e.g., 2.7.0).
- Create a New Application [00:15:43]:
- From the Welcome view, click "Create a new application".
- Choose "Copy a sample" and select the "LED Button Service" example as the base.
- Specify a path for the new application.
- Add Build Configuration [00:16:53]:
- In the nRF Connect extension, add a build configuration.
- Select the target hardware, e.g., "nRF52840 Development Kit" and the "nRF52840 SoC".
- Build and Flash the Application [00:17:30]:
- Build the application to generate binaries.
- Flash the compiled application to the development kit.
- Verify Functionality: Open the serial terminal in VS Code and reset the board to see the output, confirming the application is running from the newly built source code.