# Quickly Start with Ubidots **Ubidots** is a systems integrators, IoT Entrepreneurs and OEMs effortlessly self-construct Internet of Things (IoT) applications and connected services with Ubidots’ data collection, analysis, and visualization tools. In the planning of the kit, we choose Ubidots platform as an alternative without LoRaWAN®, you can use the WiFi function that comes with Wio Terminal to get the data presentation in Ubidots dashboard with the sensor data you need through MQTT protocol.
## Preliminary Preparation ### Connection The sensors inside the SeseCAP - K1100 Kit can all be connected to the Grove connector under the Wio Terminal via the Grove cable. The following table describes the location of the Grove connector to which each sensor is connected.
Sensor Type Communication Protocol Connected Grove Interface
Grove Temp&Humi Sensor (SHT40) I2C Wio Terminal left Grove interface
Grove VOC and eCO2 Gas Sensor (SGP30) I2C Wio Terminal left Grove interface
Grove Vision AI Module I2C Wio Terminal left Grove interface
Grove Soil Moisture Sensor ADC Wio Terminal right Grove interface
### Software preparation **Step 1.** You need to Install an Arduino Software.

**Step 2.** Launch the Arduino application.
**Step 3.** Add Wio Terminal to the Arduino IDE. Open your Arduino IDE, click on `File > Preferences`, and copy below url to Additional Boards Manager URLs: ``` https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json ```
Click on `Tools > Board > Board Manager` and Search **Wio Terminal** in the Boards Manager.
**Step 4.** Select your board and port You'll need to select the entry in the `Tools > Board` menu that corresponds to your Arduino. Selecting the **Wio Terminal**.
Select the serial device of the Wio Terminal board from the `Tools -> Port` menu. This is likely to be COM3 or higher (COM1 and COM2 are usually reserved for hardware serial ports). To find out, you can disconnect your Wio Terminal board and re-open the menu; the entry that disappears should be the Arduino board. Reconnect the board and select that serial port. !!!Tip For Mac User, it will be something like `/dev/cu.usbmodem141401`. If you are not able to upload the sketch, mostly it's because Arduino IDE was not able to put Wio Terminal to bootloader mode. (Because MCU was halted or your program handling USB) Workaround is putting your Wio Terminal to bootloader mode manually.
**Step 5.** Install the library required for the sensor of your choice
Sensor Type Link 1 Link 2
Wio Terminal IMU Sensor Download -
Grove Temp&Humi Sensor (SHT40) Download Download
Grove VOC and eCO2 Gas Sensor (SGP30) Download -
Grove Vision AI Module Download -
!!!Note Sensors not listed in the table above indicate that a separate library download is not required. **Step 6.** Needed Libraries for Wi-Fi We need the following libraries to get started with Wi-Fi on the Wio Terminal. You can search for these libraries by typing the library name in the search box of Arduino Library Manager.
- [**Seeed_Arduino_rpcWiFi**](https://github.com/Seeed-Studio/Seeed_Arduino_rpcWiFi) - search for `seeed rpcwifi`
- [**Seeed_Arduino_rpcUnified**](https://github.com/Seeed-Studio/Seeed_Arduino_rpcUnified) - search for `seeed rpcunified`
- [**Seeed_Arduino_mbedtls**](https://github.com/Seeed-Studio/Seeed_Arduino_mbedtls) - search for `seeed mbedtls`
- [**Seeed_Arduino_FS**](https://github.com/Seeed-Studio/Seeed_Arduino_FS) - search for `seeed fs`
- [**Seeed_Arduino_SFUD**](https://github.com/Seeed-Studio/Seeed_Arduino_SFUD) - search for `seeed sfud`
- [**PubSubClinet**](https://github.com/knolleary/pubsubclient) - search for `PubSubClient`
## Operation Steps **Step 1.** Register and login to Ubidots If this is your first time using Ubidots, please go to the [Ubidots website](https://ubidots.com/) and register an account of your own.
Once you have registered, please login to Ubidots using your registered account. **Step 2.** Assign your unique **Ubidots TOKEN** Every request to Ubidots requires a TOKEN. The easiest way to get yours is clicking on “API Credentials” from the user dropdown. Go to you user dropdown and click on API credentials:
**Tokens**: Temporary and revocable keys to be used in your API requests. Please save the TOKEN for now, we will use it later.
!!!Attention All API calls only accept your **TOKEN**. Don’t try to use your API Key, it won’t work! You can also access all of your Ubidots API Keys section of the My Profile settings in your User Dropdown. Select **My Profile** –> **API Credentials** to review the list of API TOKENS relating to your specific Ubidots Account.
**Step 3.** Be prepared with the necessary information To establish an MQTT connection, we will need to prepare the following information in advance. - **WiFi SSID** - Fill in the WiFi SSID to which Wio Terminal can connect. Wio Terminal will search for WiFi within its surroundings and try to connect to it. - **Password for WiFi SSID** - Fill in the password for the WiFi SSID to which Wio Terminal can connect. - **Ubidots TOKEN** - This is the TOKEN generated in **step 2**. - **Variable label** - This is the name of the sensor value provided by the user to Ubidots. Ubidots are matched to different data based on this name provided by the user. If the Variable label don’t exist before the first dot is sent, Ubidots will create them automatically. - **Device label** - This is the name of the device and the name of the device provided by the user will be used by Ubidots to identify the device. If the Device label don’t exist before the first dot is sent, Ubidots will create them automatically. - **MQTT client name** - This is special because it is the ID with which your device will be identified by the broker so it **MUST** be unique. If your device tries to connect with the same ID that has already been taken by another device, the connection will be refused. Please create your own all alphanumeric 8-12+ character MQTT client name and input into the code accordingly. Need some help creating a unique MQTT client name, check out this [random ascii builder](https://www.random.org/strings/), or simply use the MAC address of your device as every MAC address is globally unique.
At the beginning of the program below, we will define for these requirements at the top of the code, please fill in your own information as appropriate. ```c++ //examples #define WIFISSID "" // Put your WifiSSID here #define PASSWORD "" // Put your Ubidots' TOKEN #define VARIABLE_LABEL "light" // Assign the variable label #define DEVICE_LABEL "wio-terminal" // Assign the device label #define MQTT_CLIENT_NAME "r6y1ax7mq8" // MQTT client Name ``` ### Send built-in sensors Data to Ubidots If you want to send detection data from the Wio Terminal's built-in sensors to Ubidots, paste the complete code below into the Arduino and upload it to the Wio Terminal. ```c++ #include #include #include #include"LIS3DHTR.h" LIS3DHTR lis; //Required Information #define WIFISSID "" // Put your WifiSSID here #define PASSWORD "" // Put your Ubidots' TOKEN #define VARIABLE_LABEL1 "light" // Assign the variable label #define VARIABLE_LABEL2 "IMUx" #define VARIABLE_LABEL3 "IMUy" #define VARIABLE_LABEL4 "IMUz" #define VARIABLE_LABEL5 "sound" #define DEVICE_LABEL "wio-terminal" // Assign the device label #define MQTT_CLIENT_NAME "r6y1ax7mq8" // MQTT client Name const long interval = 100; unsigned long previousMillis = 0; TFT_eSPI tft; char mqttBroker[] = "industrial.api.ubidots.com"; WiFiClient wifiClient; PubSubClient client(wifiClient); //sensor values static int lightValue = 0; static float imuxValue = 0; static float imuyValue = 0; static float imuzValue = 0; static int soundValue = 0; // Space to store values to send static char str_light[6]; static char str_imux[6]; static char str_imuy[6]; static char str_imuz[6]; static char str_sound[6]; char payload[700]; char topic[150]; void callback(char* topic, byte* payload, unsigned int length){ Serial.print("Message arrived ["); Serial.print(topic); Serial.print("] "); for (int i=0;i #include #include //Required Information #define WIFISSID "" // Put your WifiSSID here #define PASSWORD "" // Put your Ubidots' TOKEN #define VARIABLE_LABEL "light" // Assign the variable label #define DEVICE_LABEL "wio-terminal" // Assign the device label #define MQTT_CLIENT_NAME "r6y1ax7mq8" // MQTT client Name const long interval = 100; unsigned long previousMillis = 0; TFT_eSPI tft; char mqttBroker[] = "industrial.api.ubidots.com"; WiFiClient wifiClient; PubSubClient client(wifiClient); //Soil moisture pins and sensor values int sensorPin = A0; static int soilValue = 0; // Space to store values to send char str_soil[6]; char payload[700]; char topic[150]; void callback(char* topic, byte* payload, unsigned int length){ Serial.print("Message arrived ["); Serial.print(topic); Serial.print("] "); for (int i=0;i #include #include #include "sensirion_common.h" #include "sgp30.h" #define WIFISSID "" // Put your WifiSSID here #define PASSWORD "" // Put your Ubidots' TOKEN #define VARIABLE_LABEL1 "voc" // Assign the variable label #define VARIABLE_LABEL2 "co2" #define DEVICE_LABEL "wio-terminal" // Assign the device label #define MQTT_CLIENT_NAME "r6y1ax7mq8" // MQTT client Name const long interval = 100; unsigned long previousMillis = 0; char mqttBroker[] = "industrial.api.ubidots.com"; WiFiClient wifiClient; PubSubClient client(wifiClient); TFT_eSPI tft = TFT_eSPI(); static unsigned short int VOC = 0; static unsigned short int CO2 = 0; // Space to store values to send char str_voc[6]; char str_co2[6]; char payload[700]; char topic[150]; void callback(char* topic, byte* payload, unsigned int length){ Serial.print("Message arrived ["); Serial.print(topic); Serial.print("] "); for (int i=0;i #include #include #include #include #define WIFISSID "" // Put your WifiSSID here #define PASSWORD "" // Put your Ubidots' TOKEN #define VARIABLE_LABEL1 "temperature" // Assign the variable label #define VARIABLE_LABEL2 "humidity" #define DEVICE_LABEL "wio-terminal" // Assign the device label #define MQTT_CLIENT_NAME "r6y1ax7mq8" // MQTT client Name const long interval = 100; unsigned long previousMillis = 0; char mqttBroker[] = "industrial.api.ubidots.com"; WiFiClient wifiClient; PubSubClient client(wifiClient); TFT_eSPI tft = TFT_eSPI(); SensirionI2CSht4x sht4x; static float temp = 0; static float humi = 0; // Space to store values to send char str_temp[6]; char str_humi[6]; char payload[700]; char topic[150]; void callback(char* topic, byte* payload, unsigned int length){ Serial.print("Message arrived ["); Serial.print(topic); Serial.print("] "); for (int i=0;i #include #include #include"LIS3DHTR.h" #include "Seeed_Arduino_GroveAI.h" //Required Information #define WIFISSID "" // Put your WifiSSID here #define PASSWORD "" // Put your Ubidots' TOKEN #define VARIABLE_LABEL1 "num" // Assign the variable label #define VARIABLE_LABEL2 "confidence" #define DEVICE_LABEL "wio-terminal" // Assign the device label #define MQTT_CLIENT_NAME "r6y1ax7mq8" // MQTT client Name const long interval = 100; unsigned long previousMillis = 0; char mqttBroker[] = "industrial.api.ubidots.com"; WiFiClient wifiClient; PubSubClient client(wifiClient); GroveAI ai(Wire); uint8_t state = 0; TFT_eSPI tft = TFT_eSPI(); static int num = 0; static int conf = 0; // Space to store values to send char str_num[6]; char str_conf[6]; char payload[700]; char topic[150]; void callback(char* topic, byte* payload, unsigned int length){ Serial.print("Message arrived ["); Serial.print(topic); Serial.print("] "); for (int i=0;i
Click on your device name here to be able to see all the history tabs. This is determined by the **VARIABLE_LABEL** in the code.
!!!Note The free version of Ubidots only supports the creation of **one TOKEN** and **ten labels**. Once you have more than ten labels, the labels you have uploaded as well as the data will be discarded. If you want to see the data information of your device, you can select **Data**.
You can also select a different dashboard screen in the top left corner of the main page. By default to start with, Ubidots will automatically create a dashboard for you called **Demo Dashboard**. Once the Wio Terminal is networked and sending data, you will be able to see a dashboard called **wio terminal dashboard**. This is defined in the code under **DEVICE_LABEL**.
You can add different panels under the current dashboard, which requires you to click on the **+** sign in the top right corner.
Below is a list of the panels supported by Ubidots.
Let's take the example of creating a line chart table. If you want to draw a line chart of IMU sensor values, then you need to create three labels and the **names of the labels need to match the VARIABLE_LABEL in your code**, then just leave everything to Ubidots and it will be generated automatically for you.
Ubidots also has very powerful customisation features, such as whether to display values, the name of the Y-axis and how much data to display, all of which you can play with freely. ## Resources For all the codes used in this tutorial please click on the icon to access them.

## Tech Support Please do not hesitate to submit the issue into our [forum](https://forum.seeedstudio.com/).

## Statement - The LoRa® Mark is a trademark of Semtech Corporation or its subsidiaries. - LoRaWAN® is a mark used under license from the LoRa Alliance®.