3.3.3 Smart Flame Detector Application Demonstration on PIC32CM LE00 Curiosity Pro Evaluation Kit

Download

Description

This application demonstrates detection of flame using Flame Click, and if the flame has been detected, it alerts through the Microchip Bluetooth Data (MDB App) and on the OLED Display.

Further, the flame detection data is also logged with the help of SD Card (Along RTC Timestamp). Additionally, user can reset the RTC timestamp by pressing SW0 switch.

Modules/Technology Used

  • Peripheral Modules

    • ADC
    • SERCOM (USART)
    • SERCOM (SPI)
    • GPIO
    • RTC
    • TC
    • NVMCTRL
    • PM
  • Drivers Modules

    • SD Card (SPI)
    • Wireless RNBD
    • Graphics Interface (LE SPI 4-line)
    • Graphics Driver (LE External Controller)
    • Graphics Middleware (Legato)
  • System Services

    • Time
    • File System

    The MCC Harmony project graph with all the components would look like this:

Hardware Used

Software/Tools Used

This project has been verified to work with the following versions of software/development tools:

  • Refer Project Manifest present in harmony-manifest-success.yml under the project folder firmware/src/config/pic32cm_le00_cpro.

Because Microchip regularly updates tools, occasionally issue(s) could be discovered while using the newer versions of the tools. If the project does not seem to work and version incompatibility is suspected, it is recommended to double-check and use the same versions that the project was tested with. To download original version of MPLAB® Harmony v3 packages, refer to the document How to Use the MPLAB® Harmony v3 Project Manifest Feature (DS90003305).

Hardware Setup

  • Connect the two mikroBUS Xplained Pro boards to the Extension Header EXT1 (J601) and Extension Header EXT3 (J603) of the PIC32CM LE00 Curiosity Pro Evaluation Kit, as shown below:
  • Connect the I/O1 Xplained Pro Extension Kit to the Extension Header EXT2 (J602) of the PIC32CM LE00 Curiosity Pro Evaluation Kit and plug the SD Card into the microSD Card Connector of the I/O1 Xplained Pro Extension Kit, as shown below:
  • Mount the FLAME CLICK on the mikroBUS Xplained Pro which has been connected to the Extension Header EXT3 (J603), and mount the RNBD451 Add On Board on the mikroBUS Xplained Pro which has been connected to the Extension Header EXT1 (J601) of the PIC32CM LE00 Curiosity Pro Evaluation Kit, as shown below:
  • Mount the OLED C CLICK on the mikroBUS Header Connector of the PIC32CM LE00 Curiosity Pro Evaluation Kit, as shown below:
  • The overall hardware set-up of the demo is as shown below:
  • Using a Type-A USB-Micro-B USB cable, connect the Type-A Male to the PC, and Micro-B USB Male to the Micro-B DEBUG USB port (J300) of the PIC32CM LE00 Curiosity Pro Evaluation Kit to power it, and to program and debug the application.

RNBD Setup

Follow these instructions to setup the RNBD before running the demo:

  • Connect the RNBD451 Add On Board as a standalone to the host microcontroller or PC, using a USB Type-C Cable. To power this standalone module, change the Power Supply Selection (J7) jumper.
  • Open a serial terminal application (such as Tera Term) on the PC.
  • Set the baud rate to 115200
  • To enter command mode, send the charaters $$$ as instruction.
  • Change the baud rate to 9600 using SB command and the instruction is SB,03.
  • Enable pin UART Transparent mode and Bluetooth Status LED using SR command and the instruction is SR,0101.
  • Reboot the module to save the changes using R command with the instruction R,1.
  • Reposition the Power Supply Selection (J2) jumper to power from the host board and mount the RNBD451 Add On Board on the hardware setup.

Programming hex file

The pre-built hex file can be programmed by following the below steps:

Steps to program the hex file:
  • Open MPLAB® X IDE
  • Close all existing projects in IDE, if any project is opened.
  • Go to File -> Import -> Hex/ELF File
  • In the Import Image File window,
    1. Create Prebuilt Project,
      • Click the Browse button to select the prebuilt hex file.
      • Select Device as PIC32CM5164LE00100.
      • Ensure the proper tool is selected under Hardware Tool and click on Next button.
    2. Select Project Name and Folder,
      • Select appropriate project name and folder and click on Finish button
  • In MPLAB X IDE, click on Make and Program Device button to program the device.
  • Follow the steps in Running the Demo section below.

Programming/Debugging Application Project

  • Open the project (pic32cm_le00_cpro_smart_smoke_detector/firmware/pic32cm_le00_cpro.X) in MPLAB® X IDE.
  • Ensure PIC32CM LE00 Curiosity Pro is selected as hardware tool to program/debug the application.
  • Build the code and program the device by clicking on the Make and Program button in MPLAB® X IDE tool bar.
  • Once programming is complete and successful, perform a power cycle of the board.
    Note: A power cycle is mandatory because only upon power-on-reset (POR), does the SPI_SCK pin which is shared between OLED and RNBD reinstates as expected. Else, the OLED may not start-up properly.
  • Follow the steps in Running the Demo section below.

Running the Demo

  • Perform Hardware Setup and Programming/Debugging Application Project steps mentioned above, if not done already.
  • For demonstration, the Flame Click is used to detect the flame. Shining a flashlight on the flame click sensor should be good enough to trigger it, for demo purposes.
  • If the flame has been detected, the Flame Labeled LED(Flame Presence LED Indicator) in the Flame Click will glow.
  • The OLED display shows the ADC result values of the Flame sensor periodically as shown here:
  • The SD Card log the flame detection message along with the Timestamp (RTC).
  • To get the fire alarm detection in the mobile app, proceed the following steps:
    • Install the Microchip Bluetooth Data Android App in the Android Smartphone using the MicrochipBluetoothData_Smartsmoke.apk file located in the project folder. Navigate to “utilities” to find the Android_App. Alternatively, click here to download it.
    • Enable and allow Bluetooth and location from Smartphone settings
    • Open the Microchip Bluetooth Data (MBD) android app from the smartphone and tap on BLE UART icon on the dashboard. If prompted, allow the application to turn on Bluetooth, as shown:
    • Click on flame detector option from the list, as shown:
    • Scan for RNBD451 Bluetooth device under the Device window and connect it. The RNBD device should appear as RNBD451_XXXX (deviceId) in the list of Bluetooth devices. After, click on it.
      Note: For the setup, the deviceId may vary.
    • Select the Text Mode option, as shown:
    • Then, the GUI of the mobile app, displays the fire detection data, as shown:

Comments