Rapid Prototyping with 32-bit MCU-based Curiosity Nano Evaluation Kit Using MPLAB Harmony v3 Software Framework: Step 8
Build and Program the Application
Clean and Build
Clean and build your application by clicking on the Clean and Build button.
Program the Device
Program your application to the device by clicking on the Make and Program button.
Install Android App
Before proceeding, install the Microchip Bluetooth Data Android app on an Android smartphone.
Enable Location Services
Enable Bluetooth and location services from your smartphone settings.
Reset the Device
Perform a reset by unplugging and re-plugging the PIC32CM MC00 Curiosity Nano Evaluation Kit power cable.
Turn on Bluetooth
Open the Microchip Bluetooth Data (MBD) Android app from your smartphone and tap on the BLE UART icon on the dashboard. If prompted, allow the application to turn on Bluetooth.
Scan for Devices
Now, scan for Bluetooth devices by tapping BM70 > SCAN > SCAN options on the MBD APP.
List Bluetooth Devices
The BM71 device will appear as TransparentUARTDemo in the list of Bluetooth devices.
Once you see the TransparentUARTDemo device, click on the CANCEL button to cancel the device scanning.
Transfer Data
Once the device is connected, tap on Transfer data to device to build the communication interface between the demo application and MBD App.
Configuration
Enable Write with Response by clicking on the OFF button at the bottom of the MBD APP screen.
Send Commands
Send the commands mentioned in the demo description to control the fan. The commands mentioned in the demo description are not case-sensitive.
Fan Control
The fan will be controlled based on the command received from the MBD application.
When the user chooses temperature based Fan Control mode, the application reads the temperature values from a weather sensor, displays them on the EInk display, and controls a DC fan
Results
You successfully created a smart appliance control application and observed that the application enabled control of a smart appliance through a BLE-based Android smartphone. In the first method, a 5 V DC fan is controlled based on the room temperature value. The room temperature and the fan's speed are also displayed on a low-power consuming display. In the second method, based on the command exercised by the user on the Android smartphone app, the fan operation was controlled.
Analysis
In this lab, you quickly and successfully extended an application built using MPLAB® Harmony v3 on a PIC32CM MC00 microcontroller. Your application used all the fundamental elements that go into making a real-time application. In this application, you used MPLAB® Harmony Configurator (MHC) to configure a PIC32CM MC00 device and used the MPLAB Harmony v3 Framework. You used the clock configurator to set up the CPU clock. You configured SERCOM0 (I2C), SERCOM1(USART), SERCOM3(SPI), and PORT peripheral libraries. You also configured and used the BM71 driver, Timer System Service. Lastly, you used the pin configurator to set up the pins for the peripheral functions.
Conclusions
This lab provided you training for configuring and using all the fundamental components needed to build a real-time application on a PIC32CM MC00 microcontroller with the MPLAB Harmony v3 Framework. As a next step, you may customize this application and reconfigure some of the components used in this tutorial.