Skip to content

"IoT Made Easy!" - This application demonstrates the integration of the Servo Motor and BLE stack on the PIC32CXBZ6 device.

Notifications You must be signed in to change notification settings

MicrochipTech/PIC32BZ6_Bluetooth_LE_Servo_Motor_Control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PIC32BZ6 Bluetooth LE Servo Motor Control

"IOT Made Easy!"

Devices: | PIC32CXBZ6 | PIC32BZ6 |
Features: | BLE | SERVO |

⚠ 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. Hardware Setup
  5. Harmony MCC Configuration
  6. Board Programming
  7. Run the demo

1. Introduction

This project demonstrates a BLE-controlled 360° servo motor system built using the Microchip PIC32CXBZ6/PIC32BZ6 wireless MCU. It combines the PIC32CXBZ6 BLE stack with TCC-based PWM generation to control an MG996R servo motor through simple wireless commands such as start, stop, and reverse.

2. Bill of Materials

Tools Quantity
​​PIC32-BZ6 Curiosity Board 1
TowerPro MG996R 360° High Torque Servo Motor 1

3. Hardware Setup

  • The PWM pin from the MikroBUS™ header 1 of the PIC32-BZ6 Curiosity Board is connected to the servo motor’s PWM control pin, while the 5V and GND pins from the same header are used to power the servo motor. Refer to the image below.

4. Software Setup

  • MPLAB X IDE

    • Version: 6.25
    • XC32 Compiler v4.60
    • MPLAB® Code Configurator v5.6.2
    • PIC32CX-BZ6_DFP v1.2.17
    • MCC Harmony
      • wireless_pic32cxbz_wbz: v1.5.0
      • csp version: v3.21.0
      • core version: v3.14.2
      • wireless_ble: v1.4.0
      • wireless_system_pic32cxbz_wbz: v1.7.0
      • CMSIS_5: v5.9.0
      • FreeRTOS-Kernel: v11.1.0
  • Any Serial Terminal application like TERA TERM terminal application

  • MPLAB X IPE v6.25

5. Harmony MCC Configuration

Getting Started with Servo Motor application with the PIC32BZ6 Curiosity Board

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

Step 1 - Connect the PIC32BZ6 Curiosity board to the device/system using a Type-C USB cable.

Step 2 - This application is built by using Peripheral Transparent UART as the building block. The changes made to the peripheral_trp_uart application is mentioned below.

Note The peripheral_trp_uart application repository can be cloned/downloaded from this link.
File path wireless_apps_pic32_bz6/apps/ble/building_blocks/peripheral/profiles_services/peripheral_trp_uart/firmware/peripheral_trp_uart.X

  • From project resources, go to Harmony->Peripherals and select TCC0 and configure as follows.

  • In the project graph, go to plugins and select pin configuration.

Step 3 - Generate the code.

Step 4 - Once generation is complete, the merge window will appear. Merge all the changes shown.

Step 5 - Copy the mentioned files from this repository by navigating to the location mentioned below and replace the generated files.

Note This application repository should be cloned/downloaded to perform the following steps.
Path The application folder can be found in the following link
  • Copy the following files from the cloned repo(...\firmware\src).

    • "app.c" and "app.h"
  • In "app_user_edits.c", make sure the below code line is commented

    • "#error User action required - manually edit files as described here".
  • Replace these entire files in your project folder location(...\firmware\src\app_ble).

Step 6 - Clean and build the project. To run the project, select "Make and program device" button.

6. Board Programming

Programming hex file:

Program the precompiled hex file using MPLAB X IPE

  • The Precompiled hex file is given 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

The application folder can be found by navigating to the following path:

  • "firmware\peripheral_trp_uart.X"

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

7. Run the demo

  • After programming the board, the expected application behavior is shown in the below video.

Alt Text

About

"IoT Made Easy!" - This application demonstrates the integration of the Servo Motor and BLE stack on the PIC32CXBZ6 device.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published