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

In this guide we’re using the Microchip Curiosity PIC32MZEF 2.0, but the original Microchip Curiosity PIC32MZEF can work just as well.

The Microchip Curiosity PIC32MZEF 2.0 doesn’t have built-in connectivity, and the original Microchip Curiosity PIC32MZEF’s native Wi-Fi module (Microchip MRF24WN0MA module) is deprecated for use and not supported in Atmosphere. To enable Wi-Fi for either board we’ll be pairing it with a MikroElektronika WiFi 7 Click board – which features a Microchip WINC15x0 Wi-Fi module – inserted into the board’s second mikroBUS slot.

Software Requirements

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.

If running on Linux, ensure your copy of the Microchip MPLAB X IDE is v5.30 or greater. Versions beneath this may not enable the Curiosity PIC32MZEF 2.0 to program properly with Atmosphere.

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.

Step 1 of 8: Create a New Project

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

  1. Click the New Project button. This displays a New Project window.
  2. Select the Curiosity PIC32MZEF 2.0 project type (or Curiosity PIC32MZEF project type if using that board) and give the project a name, then click Create.

This opens a new project in IoT Studio.

This guide walks through the step-by-step process to perform actions in IoT Studio, but doesn't cover the in-depth aspects of IoT Studio itself. To learn more about using IoT 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 second), it will 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 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 Add Element 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.
    • The WiFi 7 Click element’s SPI driver instance is set to SPI2 (Click 2) by default, which correlates with the second mikroBUS slot on the Curiosity PIC32MZEF 2.0. As mentioned in this guide’s hardware requirements, ensure your WiFi 7 Click board is inserted into the second mikroBUS slot so the element works properly.

When the WiFi 7 Click element is added to the canvas, notice that cloud elements (Device Event and Cloud Event) 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 Device Event Element Device Event element to the canvas. The Device 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 Device 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 Device Event element is displayed on the canvas.
  4. Add a Cloud Storage Element cloud storage element to the canvas, and connect the existing Device Event element to it. By default, this creates an event using the Add Data ability within the Device Event’s Event Received trigger, which allows Atmosphere to add (and store) data sent to it from the Device 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 as “Integer Count” 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 Device 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 be notified 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.
  • The Curiosity PIC32MZEF is powered on and connected via both its debug USB connector and its target USB connector.
  • The Atmosphere IoT Agent is installed and running.
  • An Internet connection is maintained.

Programming the Curiosity PIC32MZEF

With setup complete, you can program your board:

  1. From the Embedded tab, click the Program Firmware button from the tab’s toolbar. This displays the Program Firmware window.
  2. In the IPECMD Path field, an autocompleted path of the MPLAB X IDE’s IPECMD software is entered. This is based on the Atmosphere IoT Agent locating the software file from an expected installation path on your operating system.
    • In the event your installation path of the MPLAB X IDE differs from what the agent provided, enter in the field the complete path where the MPLAB X IDE’s 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 its installation directory.
  3. Click Program to start programming. When complete, you’ll receive a notification stating the Curiosity PIC32MZEF 2.0 is programmed with the project’s embedded firmware.

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 Scan button in the top-right to display the Scan 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 and its target USB connector. Once registered, it can remain connected using either 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 Integer 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 Dashboard

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