Cloud data analysis capability of IoT platform

1. Overall technical scheme

In the IoT scenario, many sensors collect binary data or private protocol format data streams, and the device side does not have the ability to convert to structured JSON. At this time, we can use the IoT Internet of Things platform cloud customized data parsing ability to convert Modbus, power protocol, hex data, and private protocol to structured JSON, and then flow to the business system.

Data flow link

Message changes

2. Development of Internet of Things platform

Message Communication Topic

Hex Conversion Script Configuration

Raw data: 0x035e8192fd0000000d0000001b00000a8c

Data service format:


Script Configuration

Full script content


*Convert the device customized topic data to json format data, and call when the device reports the data to the Internet of Things platform

*Input parameter: topic string, topic of the reported message by the device

*Input parameter: rawData byte [] array cannot be empty

*Output parameter: jsonObj JSON object cannot be empty


function transformPayload(topic, rawData) {

var jsonObj = {}

//Raw hex data: 0x035e8192fd0000000d0000001b00000a8c



"heartbeat": 15,

"id": 1585549855,

"steps": 2700,

"speed": 56



if (topic.endsWith('/user/update')) {

var uint8Array = new Uint8Array(rawData.length);

for (var i = 0; i < rawData.length; i++) {

uint8Array[i] = rawData[i] & 0xff;


var dataView = new DataView(uint8Array.buffer, 0);

var fHead = uint8Array[0]; // command

if (fHead == 0x03) {


jsonObj['id'] = dataView.getInt32(1);


jsonObj['heartbeat'] = dataView.getInt32(5);


jsonObj['speed'] = dataView.getInt32(9);

//Total Steps

jsonObj['steps'] = dataView.getInt32(13);



return jsonObj;


3. Equipment development

Equipment reports hex raw data

//Is the message topic carried_ Sn=default ID

const topic = '/aiDerw9823s/dn308/user/update'+'?_ sn=default';

//Raw data

var payloadArray = [ 3, 94, 129, 169, 59, 0, 0, 0, 23, 0, 0, 0, 79, 0, 0, 30, 220 ];

var payload = new Buffer(payloadArray);

//Publish data to topic

client. publish(topic, payload);

4. Joint commissioning log

The equipment reports the original hex data

Log after script conversion

Business message message log

Message details (topic and payload)

Related Articles

Explore More Special Offers

  1. Short Message Service(SMS) & Mail Service

    50,000 email package starts as low as USD 1.99, 120 short messages start at only USD 1.00

phone Contact Us