Step 9: Build and Run the Application
1
2
Note: It is not required to adjust the Baud rate as you are using a USB connection.
4
Upload the Web pages (HTML files) inside the SD card.
- Remove the SD card from the IO1 Xplained Pro board and insert the media to a host machine.
- Go to the folder <your unzipped folder path>\getting_started_pic32_wfi32e\Lab4\web_pages and copy all the files and folders.
- Paste the files into the root of the SD card mounted as SDHC.
- Safely remove the SD card media from the Host machine.
- Insert the SD card into the microSD slot of the IO1 Xplained Pro board.
5
Reset the PIC32 WFI32E Curiosity Board using the MLCR button.
7
If the WFI32E device operates in AP mode:
- Connect a client device (Computer, Tablet, Smartphone, …) to WFI32E_AP in Wi-Fi.
- Observe the serial console that indicates a station is connected to the WFI32 device acting as an access point.
- Open a web browser (Firefox, Google Chrome, etc..) on the client device.
- Enter the IP address of the WFI32E's AP in the search bar of the browser.
If the WFI32E device operates in STA mode:
- Make sure the station is correctly connected to your own Wi-Fi Network.
- Open a web browser (Firefox, Google Chrome, etc..) on a device connected to the same network.
- Enter the IP address of the WFI32E's STA obtained from the network in the search bar of the browser.
9
From the main page index.htm:
- Select Log View to visualize the data log in the operation mode of the WFI32E device.
- Press Show log to display the log in the browser.
- Press the switch SW1 (upper one) to trigger the log of the temperature.
- Reload the web page and press the Show Log button again.
- Observe the new log displayed at the end of the list on the left and the end of the graph.
Note: If you have selected STA mode whereas you configured your Wi-Fi in AP mode, it will not work because an internet connection is required to load the jQuery library. No internet connection is available while the computer is connected to the WFI32E AP.
Note: You can find the Lab 4 solution in the folder: <your unzipped folder path>\getting_started_pic32_wfi32e\Lab4\solution.
Results
You should be able to visualize the temperature logs on hosted Web Page.
Analysis
In this lab, you have successfully developed an IoT application on the PIC32 WFI32E.
4 RTOS Threads were created:
- I2C Sensor Application reads the temperature value, notifies the SD card thread using the SD card message queue, and goes to sleep for 1 second.
- SD card application is waiting to receive data in the SD card queue. Once the queue is filled, the application logs the temperature value to a file.
- USB application handles the messages to print on the USB console with the help of another message queue.
- WIFI application is waiting for the TCP IP stack to be ready and start the HTTP modules that allow to process the HTTP events (dynamic variables, Post, Get, etc.).
Conclusions
In this lab, you have successfully developed a full-fledged MPLAB Harmony application. This gives you a fair idea of how MPLAB Harmony helps application development. If you need HTTP web support for any of your existing applications, this lab can be used as a reference. This can also be a starting point for your IoT applications.