Storing Data on the UP CARE Platform
The UP CARE Platform offers a centralized database for efficiently storing and managing data collected from IoT (Internet of Things) devices. This comprehensive guide provides an in-depth overview of the data storage process and step-by-step instructions for seamlessly storing data on the UP CARE Platform.
Introduction to MQTT Protocol
The UP CARE Platform employs the MQTT (Message Queuing Telemetry Transport) protocol for receiving data. MQTT is a lightweight messaging protocol tailored specifically for IoT applications. Designed to be simple and efficient, MQTT is an ideal choice for constrained devices and networks characterized by low bandwidth and high latency. It operates on a publish-subscribe model, where publishers send messages to a central broker, which then distributes these messages to subscribers. This model facilitates one-to-many communication, allowing a single publisher to transmit messages to multiple subscribers.
The UP CARE Platform utilizes an MQTT broker as a receiver for data from IoT devices. This broker acts as an intermediary, ensuring the smooth transmission of data to its intended destination.
Obtaining MQTT Connection Settings and Credentials
To access the MQTT broker on the UP CARE Platform, you must obtain specific connection settings and credentials provided by the UP CARE team. These vital details include:
- Cluster URL: The web address of the MQTT cluster.
- Port Number: The port number through which MQTT communication is established.
- Credentials: Request unique access credentials from the UP CARE team, comprising a username and password for secure access to the MQTT broker.
Determining Your Desired MQTT Topic
Selecting a unique MQTT topic for your data publications is essential. This topic should be exclusive to your team's use. To ensure topic integrity and avoid duplication, UP CARE's approval is required. It is crucial to adhere to the proper naming format.
Database Creation
Request the UP CARE team to establish a dedicated database for your team's use. This database will serve as the repository for your IoT data. By default, the UP CARE Platform creates the following tables:
- payload: Stores MQTT payloads/messages.
- data_type: Contains information about different data types present in your payload, facilitating value extraction.
- data: Stores parsed values from the payload in a wide database format.
- measurement: Stores parsed values from the payload in a long database format.
MQTT Subscribe Service Setup
Request the UP CARE team to create an MQTT subscribe service specifically configured to listen to your team's assigned MQTT topic. This service will be responsible for collecting and storing data in your team's designated database. Initially, only raw payload data will be saved in the database, as the payload data is not yet parsed. This step ensures the MQTT subscribe service can effectively receive messages published to your assigned MQTT topic and store them securely in your dedicated database.
Data Types Information
To parse and store actual measurements accurately, your team must provide information about the data types you intend to use. For each data type, supply the following details:
- Type: The JSON payload header, formatted as
<sensor_measurementType>
(e.g., SI7020_TMP). - Name: A description of the data type (e.g., SI7020 Temperature).
- Unit: The measurement unit (e.g., Celsius).
- Format: The measurement format in the payload (e.g., hex, int).
- Conversion Ratio: The ratio necessary to calculate the actual value (e.g., 0.01).
- Conversion Offset: The offset required to obtain the actual value (e.g., +50).
Compile this information into a CSV (Comma-Separated Values) file and submit it to the UP CARE team. Once these data types are added to your database, UP CARE will update your team's MQTT subscribe service to parse payload values correctly and save them in both long and wide database table formats.
Understanding Payload Format
Your payload must adhere to a specific JSON format, which includes the following fields:
- Type: Denoting the payload type.
- Source: Identifying the device.
- Local_time: Representing the measurement time in ISO string format.
- At least one measurement: Enclosed within quotation marks (i.e., ").
Here is an example of a compliant JSON payload:
{
"BMP280_TMP":"0c7b",
"local_time":"2023-03-19T18:03:34",
"source":"bf9dd9d5",
"type":"data"
}
Payload Transmission
For data transmission, you have two options:
- Encoding Method: For example, multiply the raw reading by 100 and convert it to hexadecimal format. This method ensures uniformity and simplifies value parsing.
- Human-Readable Measurements: Send the data as human-readable measurements directly.
Choose the transmission method that best suits your needs and data format preferences.
Conclusion
By following these comprehensive instructions, you can efficiently store your IoT data on the UP CARE Platform, ensuring the secure and organized management of your valuable information. If you have further questions or require additional assistance, please contact the UP CARE team for prompt support.