Skip to content

This example will demonstrate how to interface with the individually addressable WS2812 LEDs on the Curiosity Explorer Development board using Core Independent Peripherals and MCC.

License

Notifications You must be signed in to change notification settings

microchip-pic-avr-examples/pic18f56q24-curiosity-nano-explorer-ws2812

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Microchip Technologies Inc.

Interfacing WS2812 RGB LEDs on the Curiosity Explorer board using the PIC18F56Q24

This example demonstrates how to interface the WS2812B RGB LEDs on the Curiosity Nano Explorer Board using the PIC18F56Q24 Curiosity Nano. The WS2812B is an RGB LED that integrates both a control circuit and an RGB chip into a single package. It allows for easy control of multiple LEDs with a single data line, making it ideal for creating colorful lighting effects and displays.

In this project, the PIC18F56Q24 is configured to communicate with the WS2812B LEDs and generate various lighting patterns. The setup includes initializing the necessary peripherals, configuring the data output pin, and writing code to send the precise timing signals required to control the LEDs.

Related Documentation

Software Used

Hardware Used

Curiosity Nano Explorer

Setup

The block diagram below shows how to connect the PIC18F56Q24 Curiosity Nano to the WS2812B LEDs on the Curiosity Explorer Board.

Block Diagram

Follow the steps below to set up and run the example:

  1. Connect the PIC18F56Q24 MCU to the Curiosity Nano Explorer Board.
  2. Connect the PIC18F56Q24 MCU to your computer using a USB cable.
  3. Ensure that the WS2812B-RGB pin is connected to the data line of the WS2812B on the Curiosity Nano Explorer Board.
  4. Create a new project in MPLAB® X IDE and open MCC. If this is your first time using MCC, refer to Getting Started with MCU Projects Using MPLAB® Code Configurator (MCC) Melody - Developer Help
  5. Configure the output pin for the WS2812B LEDs, as shown in Figure 7.
  6. Write the code to generate the correct timing signals for the WS2812B LEDs.
  7. Compile and program the code into the PIC18F56Q24 MCU.
  8. Observe the lighting patterns and effects produced by the LEDs.

Pin Configuration

The userguide for the Curiosity Explorer Nano board provides detailed information about the pin mapping between the Curiosity Explorer board and the PIC18F56Q24 Curiosity Nano board being used in this example.

As shown in Figure 4 of the user guide above, pin IO27 on the Curiosity Nano Explorer Board is connected to the data line of the WS2812B LEDs.

Curiosity Explorer Board Pin Mapping

The pin mapping for the PIC18F56Q24 Curiosity Nano Board can be found in the PIC18F56Q24 User Guide. Based on Figure 5 and Figure 6, pin IO27 on the Curiosity Nano Explorer Board is connected to the data line of the WS2812B LEDs. Ensure that the jumper is in place to connect the WS2812B-RGB pins on the Curiosity Nano Explorer Board. In this example project, the data line is connected to pin RE0 of the PIC18F56Q24 MCU. This pin must be configured as an output in MCC.

WS2812 RGP Jumper

Curiosity Nano Connections to Explorer

The pinout for the Curiosity Nano Socket located on the Curiosity Nano Explorer Board that is shown below can also be found in the userguide.

Curiosity Nano Pinout

MCC Configuration for Pin Setup

In MCC, select RE0 as the output pin, as shown in Figure 7 below. In the Pin Configuration window, RE0 is renamed to RGB, as illustrated below. All other MCC configurations remain at their default settings, as only one output pin needs to be added in this example. The next step after configuring the pin settings in MCC is to write the firmware to send the timing signals required to drive the WS2812B LEDs.

MCC Pin Grid View

MCC Pin Renaming

Code setup

For the complete application code and a comprehensive description of the implementation, please refer to main.c.

Operation

After programming the device, the lighting patterns and effects created by the WS2812B LEDs should be observed. If the LEDs do not function as expected, ensure that:

  • The output pin is correctly configured and connected to the data line of the WS2812B LEDs.
  • The code is correctly generating the timing signals required by the WS2812B LEDs.

Summary

This document provides a guide for setting up and running an example project that demonstrates how to control WS2812B RGB LEDs using the PIC18F56Q24 MCU on the Curiosity Nano Explorer Board. It covers hardware setup, software configuration, and code implementation. The document includes links to related documentation, lists the required software and hardware, and outlines the features and prerequisites for the project. Step-by-step instructions are provided for configuring the output pin and writing the code to control the LEDs. Additionally, the document offers guidelines for verifying correct operation and troubleshooting any issues that may arise.

About

This example will demonstrate how to interface with the individually addressable WS2812 LEDs on the Curiosity Explorer Development board using Core Independent Peripherals and MCC.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published