The chipKIT family is based on the popular Arduino open-source hardware prototyping platform and adds the performance of the Microchip PIC microcontrollers. The WiFire is significantly faster than its WF32 counterpart, with 200MHz operation speed, 2MB of Flash, 512kB RAM, High Speed USB and a 50MHz SPI. The PIC32MZ core includes the MIPS MicroAptiv CPU, a highly efficient, compact, core that is optimized for cloud-connected applications and solutions.

By the end of this guide you will be able to send data to Ubidots using the chipKIT WiFire.

Requiremets

Step-by-Step

  1. Setting up the Arduino IDE
  2. Sending (POST) Data to Ubidots
  3. Receiving (GET) Data from Ubidots
  4. Summary

1. Setting up the Arduino IDE

1. To be able to work with the chipKIT platform in the Arduino IDE, you will need to install the chipKIT platform using the preconfigured Arduino Board Manager. If you are not familiar with adding a board with the Arduino IDE, simply refer to this article for additional guidance.

The Board Manager URL for the chipKIT is:

https://github.com/chipKIT32/chipKIT-core/raw/master/package_chipkit_index.json

2. With the chipKIT platform installed, select the chipKIT device you are working with. In this tutorial, we are working with a “chipKIT WiFire”. To select your board from the Arduino IDE, select Tools –> Board chipKIT WiFire”.

3. Download the Ubidots WiFire library and install it. For a detailed explanation of how to install libraries using the Arduino IDE, refer to this guide.  
  

2. Sending (POST) Data to Ubidots

Using the below sample code you will be able to post readings taken from ANALOG pin A0 of the chipKIT WiFire to Ubidots IoT Application enablement platfrom.

1. To POST your first value in Ubidots, open the Arduino IDE and paste the sample code below. Once you have pasted the code assign the following parameters:

  • The SSID of the WiFi and the Password of the network
  • Your unique Ubidots TOKEN 
  • The Variable ID of the variables you will be updating in Ubidots. If you do not have the variable IDs, simply create a shell variables and then update your firmware to contain the correct Variable IDs. To locate the variable IDs, simply click here.
// This example is to send one varable to the Ubidots API
#include <MRF24G.h>
#include <UbidotsWiFire.h>

#define ID  "Your_variable_ID_here"  // Put here your Ubidots variable ID
#define TOKEN  "Your_token_here"  // Put here your Ubidots TOKEN
#define SSIDWIFI "Your_WiFi_SSID_here"  // Put here your WiFi SSID
#define PASS "Your_WiFi_PASS_here"  // Put here your WiFi password

Ubidots client(TOKEN);

void setup(){
    Serial.begin(9600);
    client.setWifiConnection(SSIDWIFI, PASS);
}
void loop(){
    float value = analogRead(A0);
    client.add(ID, value);
    client.sendAll();
}

2. Next, Verify your code within the Arduino IDE. To do this, in the top left corner of our Arduino IDE you will see the "Check Mark" icon; press it to verify your code. 

3. Upload the code into your chipKIT UNO WiFire. To do this, choose the "right-arrow" icon beside the "check mark" icon. 

4. To verify the connectivity of the device and the data sent, open the serial monitor by selecting the "magnifying glass" icon in the top right corner of the Arduino IDE to see the connectivity logs. 

NOTE: If no response is seen in the serial monitor, try unplugging the device and then plugging it again. Also, make sure the baud rate of the Serial monitor is set to the same one specified in your code 9600 

At this point, the variables assigned in the code will be updating the analog readings the taken from the board.

3. Receiving (GET) Data from Ubidots

With the following sample code you will be able to get a value from Ubidots to start controlling any asset you desire. 

1. To start GETTING values from Ubidots, open the Arduino IDE and paste the sample code below. Once you have pasted the code, be sure to assign the following parameters:

// This example is to send one varable to the Ubidots API
#include <MRF24G.h>
#include <UbidotsWiFire.h>

#define ID  "Your_variable_ID_here"  // Put here your Ubidots variable ID
#define TOKEN  "Your_token_here"  // Put here your Ubidots TOKEN
#define SSIDWIFI "Your_WiFi_SSID_here"  // Put here your WiFi SSID
#define PASS "Your_WiFi_PASS_here"  // Put here your WiFi password

Ubidots client(TOKEN);

void setup(){
    Serial.begin(9600);
    client.setWifiConnection(SSIDWIFI, PASS);
}
void loop(){
    float value = client.getValue(ID)
}

2. Verify & Upload the code into the board following the same steps provided in the POST step above.

3. To verify the connectivity of the device and the data which is being received, open the serial monitor by selecting the "magnifying glass" icon in the top right corner of the Arduino IDE to see the connectivity logs. 

4. In the serial monitor, you will be able to see the last value received in Ubidots of the variable specified in the firmware.  

4. Summary  

With this simple tutorial we are able to POST & GET data to/from Ubidots with the ease of the Arduino IDE and a ChipKIT WiFire over WiFi. 

Now its time to create Ubidots Dashboards to visualize your data and deploy your IoT solution! 

Other readers have also found useful...

Did this answer your question?