Skip to content

"IoT Made Easy!" - Thermostat Application made with WBZ451 Curiosity Board running Thread networking stack

Notifications You must be signed in to change notification settings

MicrochipTech/PIC32CXBZ2_WBZ45x_THREAD_THERMOSTAT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PIC32CXBZ2_WBZ45x THREAD THERMOSTAT

"IoT Made Easy!"

Devices: | PIC32CXBZ2 | WBZ45x |
Features: | OpenThread |

⚠ Disclaimer

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.

Contents

  1. Introduction
  2. Bill of materials
  3. Software Setup
  4. Harmony MCC Configuration
  5. Board Programming
  6. Run the demo

1. Introduction

This application enables the users to create a Full Thread Device. Thread Thermostat receives the Temperature from the Temperature Sensor device and Setpoint from the Thread co-processor device once it has joined the thread network. This data is used for HVAC control. When the current temperature is higher than the set temperature the air conditioner is switched ON indicated by an LED and vice versa.

Tip Go through the overview for understanding few key Thread protocol concepts

2. Bill of materials

TOOLS QUANTITY
PIC32CX-BZ2 and WBZ451 Curiosity Development Board 1

3. Software Setup

  • MPLAB X IDE

    • Version: 6.20
    • XC32 Compiler v4.35
    • MPLAB® Code Configurator v5.5.0
    • PIC32CX-BZ_DFP v1.2.230
    • MCC Harmony
      • csp version: v3.18.0
      • core version: v3.13.1
      • bsp version: v3.17.0
      • CMSIS-FreeRTOS: v10.4.6
      • dev_packs: v3.18.1
      • wolfssl version: v5.4.0
      • crypto version: v3.8.1
      • wireless_pic32cxbz_wbz: v1.1.0
      • wireless_15_4_phy version: v1.1.0
      • wireless_thread: v1.0.0
      • openthread version : mchp_harmony_wireless_thread_v1.0.0
  • Any Serial Terminal application like TERA TERM terminal application

  • MPLAB X IPE v6.15

4. Harmony MCC Configuration

Getting started with Thermostat application in WBZ451 Curiosity board

Tip New users of MPLAB Code Configurator are recommended to go through the overview

Step 1 - Connect the WBZ451 CURIOSITY BOARD with Temp&Hum 13 click 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 Libraries->Harmony->Board Support Packages and add WBZ451 Curiosity BSP.

  • From Device Resources, go to Libraries->Harmony->Wireless->Drivers->Thread and add Thread Stack. Click "Yes" on all the Pop-ups to add the link the dependencies.

  • Ensure the configuration of Thread Stack is as below.

  • Ensure the configuration of FreeRTOS is as below. Total heap size should be 61440.

  • From Device Resources, go to Libraries->Harmony->System Services and add COMMAND. Ensure the below configuration.

  • Right Click on SYS_CONSOLE of COMMAND and add CONSOLE as below. Ensure the configurations.

  • Right Click on UART of CONSOLE and add SERCOM0 as below. Ensure the configurations.

  • Modify the System Configuration as below.

  • From project graph, go to Plugins->PIN configuration and configure as follows.

Step 4 - Generate the code.

Step 5 - In "app_user_edits.c", make sure the below code line is commented

  • "#error User action required - manually edit files as described here".

Step 6 - 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.
  • Copy the "Thread_demo.c" and "Thread_demo.h" folder, 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 7 - Add the files in MPLAB X IDE to your project by following the steps mentioned below.

  • In Projects section, right click on Source files to add the ".c" file and Header files to add the ".h" file.
  • Select "Add existing item".
  • Select Add and browse the location of the mentioned files(...\firmware\src).
  • Make sure the "Files of type" is "C Source files" while adding ".c" files and "Header files" while adding ".h" files.
  • Select the folder and click "add".

Step 6 - 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.
  • Copy the "app.c" and "app.h" folder, 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 7 - Clean and build the project. To run the project, select "Make and program device" button.

5. Board Programming

Program the precompiled hex file using MPLAB X IPE

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.

Build and program the application using MPLAB X IDE

Follow the steps provided in the link to Build and program the application.

6. Run the demo

  • Once the Thread co-processor device is powered on the Temperature sensor will join the network. The temperature will get reported periodically to the hread co-processor device. Once the Thermostat joins the network the Thread co-processor device sends the HVAC address and now the Temperature sensor will start reporting the sensor values to the HVAC device.

When the current temperature is higher than the set temperature the air conditioner is switched ON and vice versa. In this example we have switched ON the LED.

About

"IoT Made Easy!" - Thermostat Application made with WBZ451 Curiosity Board running Thread networking stack

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published