Getting Started with Curiosity PIC32MZEF

This guide teaches you how to get started using the Microchip Curiosity PIC32MZEF development board and Atmosphere. This includes creating your first project, programming the project’s firmware into the Curiosity PIC32MZEF, registering the device to Atmosphere, and having its data displayed on a dashboard.

In the guide you’ll build a basic project reads an incrementing integer value (up to 10) every second, sends that value to the cloud, and displays the updated value on the dashboard.

Prerequisite: You should already have an Atmosphere account.

Hardware Requirements

The native Wi-Fi module onboard the Curiosity PIC32MZEF (Microchip MRF24WN0MA module) is deprecated for use and not supported in Atmosphere. To enable compatible Wi-Fi for the board we’ll instead be pairing it with a MikroElektronika WiFi 7 Click board, which features a Microchip WINC15x0 Wi-Fi module.

This guide is specifically for the original Curiosity PIC32MZEF development board (Microchip part number: DM320104). The second generation version of this kit -- Curiosity PIC32MZEF 2.0 (Microchip part number: DM320209) -- is currently not supported in Atmosphere, and won't work with this project type.

Software Requirements

  • Microchip MPLAB X IDE. The Curiosity PIC32MZEF doesn’t contain a built-in programmer, so it’s used alongside an installation of the Microchip MPLAB X IDE to program it. The MPLAB X IDE doesn’t need to be used itself, however it also installs software – specifically the IPECMD – that is needed for programming the firmware binary file into the board.
  • Atmosphere IoT Agent. The Atmosphere IoT Agent is a local application that runs in the system tray and acts as an intermediary between the computer’s connectivity protocol drivers and the browser running Atmosphere, and is used here to assist in programming the device and connecting it to Atmosphere. While the agent is running, a device with Atmosphere firmware installed on it can be registered to Atmosphere directly without the assistance from an additional connection like BLE or Wi-Fi if it’s connected to your computer.

The project in this guide doesn’t use Studio’s Application tab to build an app interface and since the Curiosity PIC32MZEF will be registered to Atmosphere directly via a UART connection with your computer, the Atmosphere IoT app is not required here.

Step 1 of 8: Create a New Project

Navigate to Atmosphere Studio from the side menu. When you visit Studio for the first time in a session, you are brought to the Studio Projects screen.

  1. Click the New Project button. This displays a New Project window.
  2. Select the Curiosity PIC32MZEF project type and give the project a name, then click Create.

This opens a new project in Studio.

This guide walks through the step-by-step process to perform actions in Studio, but doesn't cover the in-depth aspects of Studio itself. To learn more about using Studio, its areas and features, and Studio elements, visit the Atmosphere Studio section.

Step 2 of 8: Create the Project’s Embedded Firmware

The first aspect of building this sample project is adding elements to the Embedded tab to create the project’s embedded firmware. This involves setting an interval to run every second, and when run initiates a counter to increment an integer value.

  1. Add the following elements to the canvas by clicking them in the Element Toolbox:
    • Interval Element Interval element: The interval element sets the project to run at the time set in the element’s properties, which by default is set to once per second (1000 ms).
    • Counter Element Counter element: The counter element allows you to implement a periodic software counter.

    Each of these elements will work as intended by default, so none of their properties need to be changed.

  2. Connect the interval element to the counter element. This creates an event between them, which can be seen in either the interval element’s properties, or by clicking the connector’s Configuration Button button. The event added is within the Interval trigger. In the Ability field within the event, set the ability to Increment Value. This means that when the interval element is triggered (which is every seconds), it will read the increment the integer value. The counter element’s default properties set the Initial Value field to 0, so the increment begins at that number.

That wraps up the first aspect of the project within the Embedded tab. To this point, an interval has been set that will run every second, and when run will read the increment a value starting at 0 from the counter element. When the counter reaches 10, the counter will rollover back to 0.

The Embedded tab canvas should resemble the following image:

Curiosity PIC32MZEF Embedded Tab

Step 3 of 8: Enable the Curiosity PIC32MZEF’s Wi-Fi Connectivity

The next aspect of building this sample project is enabling it for Wi-Fi connectivity. This involves adding a WiFi 7 Click element from the Element Library into the project.

  1. From the Embedded tab, click the New Project Add Element button located in the bottom of the Element Toolbox. This opens the Element Library, which includes numerous elements for sensors and other devices that can be incorporated into a project. Element Library
  2. In the Element Library, locate the WiFi 7 Click element in the table and turn on its enable switch by clicking it to import it into the Element Toolbox. When done, click Save.
  3. Add the WiFi 7 Click element to the canvas from the Element Toolbox. This element is configured to work as intended by default, so none of its properties need to be changed. Likewise, it doesn’t need to be connected to any other element; if it’s included in the project it will work properly so long as the WiFi 7 Click board is connected to the Curiosity PIC32MZEF.

When the WiFi 7 Click element is added to the canvas, notice that cloud elements (cloud event and cloud command) are then populated into the toolbox. By adding a connectivity aspect to the project, these elements are now accessible for use.

Step 4 of 8: Enable the Project’s Cloud Connectivity

The last aspect of building this sample project is enabling it for cloud connectivity. This is done on both the Embedded and Cloud tabs.

  1. While still in the Embedded tab, add a Cloud Event Element cloud event element to the canvas. The cloud event element is a coupled element between the Embedded and Cloud tabs that enables a project’s data to be sent to Atmosphere.
  2. Connect the counter element to the cloud event element. In the connector’s properties between the two elements, select the Value Incremented trigger, then add an event with the ability Send Event. This sends the value to Atmosphere when the integer is incremented.
  3. Click the Cloud tab to move to the cloud area of the project. Notice how the Element Toolbox has changed, and that the coupled cloud event element is displayed on the canvas.
  4. Add a Cloud Storage Element cloud storage element to the canvas, and connect the existing cloud event element to it. By default, this creates an event using the Add Data ability within the cloud event’s Event Received trigger, which allows Atmosphere to add (and store) data sent to it from the cloud event element.
  5. Within the Add Data event, modify the event’s Value field to "{"Integer Count": value}, which will label the incrementing value dataset when displayed in the cloud.

That’s all for creating the project! With the added cloud connectivity, the project will send the integer value from the Embedded tab to the Cloud tab through a cloud event element, where it’s connected to a cloud storage element to store the data on Atmosphere.

The final canvas for each tab should resemble the following images:

Embedded Cloud
Curiosity PIC32MZEF Embedded Tab Curiosity PIC32MZEF Cloud Tab

Step 5 of 8: Compile the Project

Once the project is finished, it needs to be compiled. Compiling readies the entire project’s source code for deployment.

  1. From any tab, click the Compile button in the project options menu on the top-right of the screen. You’ll see a loading message on the screen indicating compiling has started, and will receive a notification when the project is compiled.

Step 6 of 8: Program Firmware into the Device

With the project compiled, your Curiosity PIC32MZEF can be programmed with the project’s embedded firmware.

Prior to programming a device, ensure you have the following configuration:

  • Microchip MPLAB X IDE is installed. Once installed, note the location of the IPECMD’s ipecmd.jar Java package file within this folder. This will be referenced during programming.
  • The Curiosity PIC32MZEF is powered on and connected via both its debug USB connector (J3) and its target USB connector (J12).
  • The Atmosphere IoT Agent is installed on the computer and running. The Atmosphere IoT Agent is a local application that runs in the system tray and acts as an intermediary between the computer’s connectivity protocol drivers and the browser running Atmosphere.
  • (Windows users) A PATH system variable is set that references the MPLAB X IDE version of Java for the Atmosphere IoT Agent.
  • An Internet connection is maintained.
  • The project to be programmed has been compiled.

Setting a PATH System Variable (Windows Only)

The Atmosphere IoT Agent uses Java to locate the necessary tools for programming from the MPLAB X IDE. However, the agent by default uses the version of Java naturally running on the operating system, and MPLAB X IDE comes installed with a separate version. In order for the agent to properly locate and program the Curiosity PIC32MZEF, it must instead reference the MPLAB X IDE version of Java. This is done through setting a PATH system variable.

If you’re unfamiliar with setting a PATH in Windows, see Java: Set or Change PATH System Variable. The instructions to do so may vary based on your version of Windows, and as such the steps below may reflect this.

To set the PATH to reference the MPLAB X IDE Java version:

  1. From the MPLAB X IDE system folder, search for the location of java.exe, and copy its path. This path should resemble C:\Program Files (x86)\Microchip\MPLABX\v5.25\sys\java\jre1.8.0_181\bin.
  2. In the Start menu Search, search for system environment variables to access the System Properties in the Control Panel.
  3. Go to the Advanced tab from your System Properties window and click Environment Variables.
  4. In the System variables area, click New… to add a new variable. In the new variable, enter the following variables:
    • Variable Name: JAVA_HOME
    • Variable Value: paste the path of the MPLAB X IDE java.exe location Then click OK. A new JAVA_HOME variable is created.
  5. Next, locate the Path system varible, and click Edit…. From the Edit environment variable window, click New.
  6. In the new line, add the following path variable: %JAVA_HOME%\bin, then click OK. This adds the new JAVA_HOME variable to the PATH.

With the new JAVA_HOME variable created (pointing to the MPLAB X IDE Java executable) and the PATH system variable referencing JAVA_HOME, the Atmosphere IoT Agent can locate the necessary version of Java to program the Curiosity PIC32MZEF.

Programming the Curiosity PIC32MZEF

With setup complete, you can program your board:

  1. While the Embedded tab is active, click the Program Firmware button from the tab’s toolbar. This displays the Program Firmware window.
  2. In the IPECMD Path field, enter the complete path where the copy of the ipecmd.jar file is located (e.g. C:\Program Files (x86)\Microchip\MPLABX\v5.25\mplab_platform\mplab_ipe\ipecmd.jar) within the MPLAB X IDE installation directory.
    • If working on Linux, note this path would be different based on where the folder is located on your system.
  3. Click Program to start programming. When complete, you’ll receive a notification stating the Curiosity PIC32MZEF is programmed with the project’s embedded firmware.

Programming the Curiosity PIC32MZEF can be inconsistent and may require multiple attempts before successfully installing firmware. If a programming attempt fails, close the Program Firmware window and then try again.

Step 7 of 8: Register the Device

With firmware installed, the device can now be recognized and connected to Atmosphere. Prior to connecting a device, ensure your Atmosphere IoT Agent is running in your system tray. This is needed to check your computer’s communication ports for a device it recognizes, which will find the Curiosity PIC32MZEF.

To register the Curiosity PIC32MZEF:

  1. Navigate to the Devices area, and click the Register Device Add Device button in the top-right to display the Add Device window. When the window opens it automatically starts scanning for available devices within range.
  2. The list of available devices appears. Select the Curiosity PIC32MZEF you just programmed and click Register. This brings you to the Wi-Fi settings screen.
    • Ensure the board is connected via both its debug USB connector (J3) and its target USB connector (J12). Once registered, it can remain connected using only the debug USB connector.
    • If the device doesn’t show up, try restarting the agent in your system tray. If you do so, refresh your browser and try adding a device again.
  3. Configure your Wi-Fi network settings to connect the device. When Wi-Fi settings are entered, the Curiosity PIC32MZEF will connect to Atmosphere over Wi-Fi and remain connected as long as the Wi-Fi connection is maintained.

The device is now registered to Atmosphere and is displayed on your the page.

Step 8 of 8: View Device Data

Now that the device’s data is sent to Atmosphere, let’s view it through one of the many device dashboard widgets available. In this guide we’ll use a data glance to display the numerical value and view it increment. We’ll do this directly on the device’s console page itself, so click on the newly-added Curiosity PIC32MZEF to enter its console.

  1. To add a widget to the device’s dashboard, click the Configuration button on the side of the screen. This displays the menu of available widgets. Select the Data Glance data glance widget to add a data glance to the dashboard.
  2. Once on the dashboard, click the widget’s Menu menu icon to display its menu, then click Settings.
  3. In the data glance’s settings, modify the following properties:
    • Name: Give the widget a name, such as “Curiosity PIC32MZEF Int Counter.”
    • Icon: Select an icon that you think best represents the value.
    • Color: Give the widget a color.
  4. In the Data Source field, click Select, then choose the following configuration options for the widget:
    • Select Cloud Storage: Click the cloud storage that is storing the counter element data.
    • Select Value: Select the Integer Count dataset.
  5. When finished click Save. The data glance is then populated with the integer value, which updates every second.

Curiosity PIC32MZEF Demo Dashboard

Congratulations, you just finished a complete Curiosity PIC32MZEF project with Atmosphere!