"IoT Made Easy!"
Devices: | RNBD451 | SAMD21 |
Features: | BLE |
THE SOFTWARE ARE PROVIDED "AS IS" AND GIVE A PATH FOR SELF-SUPPORT AND SELF-MAINTENANCE. This repository contains example code intended to help accelerate client product development.
For additional Microchip repos, see: https://github.com/Microchip-MPLAB-Harmony
Checkout the Technical support portal to access our knowledge base, community forums or submit support ticket requests.
- Introduction
- Bill of materials
- Software Setup
- Hardware Setup
- Harmony MCC Configuration
- Board Programming
- Run the demo
This application demonstrates the RNBD451 remote command feature. This feature allows the control of an RNBD451 module without the use of a host microcontroller remotely from either another RNBD451 module or a mobile application. The remote command feature works by using a special BLE GATT service that emulates a wireless serial connection called transparent UART mode. This combined with a unique command set allows remote functionality of the module. Two RNBD451 modules will be used for implementing the Remote command feature. One will be called the controller device and the other will be Remote/Host-less Module. The controller Module is connected to a host MCU device and is in control of the Remote Module. The Remote Module is host-less configured to connect to the controller module.
This example demonstrates on how to configure RNBD451 in Host-less mode and create a wireless alarm application. This application uses SAMD21 Curiosity Nano board as the host for the controller Device. On initialization the controller will establish a connection with the remote module and will be in Remote Command mode of the RNBD451 Remote/host-less Module. Once there is Motion detected on Host MCU the LED connected to the remote module will be toggled.
TOOLS | QUANTITY |
---|---|
RNBD451 Add On Board | 2 |
CURIOSITY NANO BASE FOR CLICK BOARDS | 1 |
MOTION 4 Click Board | 1 |
SAM D21 CURIOSITY NANO EVALUATION KIT | 1 |
RGB LED | 1 |
-
- Version: 6.10
- XC32 Compiler v4.10
- MPLAB® Code Configurator v5.3.7
- SAMD21_DFP v3.6.144
- MCC Harmony
- csp version: v3.18.0
- dev_packs: v3.18.0
- wireless_rnbd: v2.0.0
-
Any Serial Terminal application like TERA TERM terminal application
-
Any Android terminal application like Serial USB Terminal
- Connect the SAMD21 Curiosity Nano board to the Curiosity nano base board. In the Mikro bus click 1 Socket connect the RNBD451 Add on board. Make sure the Power select jumper is placed for Mikro bus.
- In the RNBD451 Add on Board, the gpio pins are not brought out. For this application, the GPIO pin PA0 in the Remote module is connected to an NC pin on the Mikro Bus header.
Tip | New users of MPLAB Code Configurator are recommended to go through the overview |
---|
Step 1 - Connect the SAMD21 Curiosity Nano board setup to the device/system using a micro-USB cable.
Step 2 - Create a new MCC Harmony project.
Step 3 - The "MCC - Harmony Project Graph" below depicts the harmony components utilized in this project.
- From Device resources, go to Wireless->Drivers->BLE and select RNBD. Accept Dependencies or satisfiers, select "Yes". Right click on the "⬦" and add SERCOM5. The configuration is depicted as follows.
- Select SERCOM5 and configure as depicted below.
- From Device resources, go to Library->Harmony->Peripherals->SERCOM and selct SERCOM0. Right click on the "⬦" on UART and select STDIO. The configuration is depicted as follows.
- From Device resources, go to Library->Harmony->Peripherals->EIC and selct EIC. The configuration is depicted as follows.
- From project graph, go to Plugins->PIN configuration and configure as follows.
Step 4 - Generate the code.
Step 5 - Copy the mentioned files from this repository by navigating to the location mentioned below and paste it your project folder.
Note | This application repository should be cloned/downloaded to perform the following steps. |
---|---|
Path | firmware/src |
- Copy the "rnbd" folder, and "main.c" which can be found by navigating to the following path: "...\firmware\src"
- Paste the folder under source files in your project folder (...\firmware\src).
Step 6 - Clean and build the project. To run the project, select "Make and program device" button.
-
The application hex file can be found in the hex folder.
-
Follow the steps provided in the link to program the precompiled hex file using MPLABX IPE to program the pre-compiled hex image.
Follow the steps provided in the link to Build and program the application.
- Power the RNBD451 Add-on board via external supply and place the Power select Jumper accordingly.
- Connect RNBD Add-on board to your Mobile phone using a C type cable.
- Follow the below steps to configure the remote module
Step 1 – Enter command mode
-
Input Command: $$$
-
Expected response:CMD>
Step 2 – Set to Factory defaults
-
Input Command:SF,1
-
Expected response: Reboot after Factory Reset
-
%REBOOT%
Step 3 – Enter command mode
-
Input Command: $$$
-
Expected response: CMD>
Step 4 – Set name of module to "Remote"
-
Input Command:SN,Remote
-
Expected response : AOK
-
CMD>
Step 5 – Enable device information and transparent and UART operation
-
Input Command: SS,C0
-
Expected response : AOK
-
CMD>
Step 6 – Enable authentication/security
-
Input Command:SA,2,
-
Expected response: AOK
-
CMD>
Step 7 – Set 4 digit PIN code
-
Input Command:SP,1234
-
Expected response: AOK
-
CMD>
Step 8 – Save and reboot
-
Input Command:R,1
-
Expected response: Rebooting
-
%REBOOT%
- Once the Remote module is configured, Connect the SAMD21 Curiosity Nano setup.
- Enter "D" command on the remote module to get the MAC ID of the Remote command.
- Enter this Mac ID in "main.c" in line42 and program the SAMD21 Curiosity Nano setup. After it initialises and enters into RMT mode(Remote command Mode) and a motion is detected the LED connected to the Remote module is toggled.