Sensor Hub RK520-02 Payload Format

I have the RK520-02 Soil Moisture, Temperature and EC probe on a sensor hub.

I have this talking through a gateway to the Things Network and cyclically sending data.

I have searched for but can not find how to interoperate the payload.

The payload is 16 bytes long but I have no idea what each byte or grouping of bytes represents. Could someone please assist or point me in the correct direction?

Thanks

Welcome to the forum @jplozza

Please have a look at the RAK Standardized Payload Decoder.

The RAK520-02 is not listed (yet), but the payload format is Cayenne LPP format and the decoder should work.

Thanks beegee

I have tried both the built in Cayenne LPP formatter and the code you linked to but have still not gotten it to work.

The built in Cayenne LPP formatter gives an output error when i paste a payload packet into the test function of the TTN payload formatter. So I gave up on that.

I tried pasting the whole code from the RAKwireless_Standardized_Payload.js
into the java script window Deleting all other code first. But but i also get an error.

I have no Java script experience so I was hoping for some more help from someone.

Thanks in advance

Can you give me an example of the payload.
I don’t have that sensor, so it is difficult to test.

This is coppied from the Live data of the device at the TTN console

000C0E016700DE0268000003C00000

Thanks for the payload. I see the error now.

There are is one sensor value missing that I have to ask R&D where it is coming from. That’s why the decoder throws an error. In the changed decoder part I share below, I call it alien_number for now.

In the decoder javascript, there is a var sensor_types defined. Can you replace it with this code:


	var sensor_types = {
		0: { 'size': 1, 'name': 'digital_in', 'signed': false, 'divisor': 1 },
		1: { 'size': 1, 'name': 'digital_out', 'signed': false, 'divisor': 1 },
		2: { 'size': 2, 'name': 'analog_in', 'signed': true, 'divisor': 100 },
		3: { 'size': 2, 'name': 'analog_out', 'signed': true, 'divisor': 100 },
		12: { 'size': 1, 'name': 'alien_number', 'signed': true, 'divisor': 1 },
		100: { 'size': 4, 'name': 'generic', 'signed': false, 'divisor': 1 },
		101: { 'size': 2, 'name': 'illuminance', 'signed': false, 'divisor': 1 },
		102: { 'size': 1, 'name': 'presence', 'signed': false, 'divisor': 1 },
		103: { 'size': 2, 'name': 'temperature', 'signed': true, 'divisor': 10 },
		104: { 'size': 2, 'name': 'humidity', 'signed': false, 'divisor': 20 },
		113: { 'size': 6, 'name': 'accelerometer', 'signed': true, 'divisor': 1000 },
		115: { 'size': 2, 'name': 'barometer', 'signed': false, 'divisor': 10 },
		116: { 'size': 2, 'name': 'voltage', 'signed': false, 'divisor': 100 },
		117: { 'size': 2, 'name': 'current', 'signed': false, 'divisor': 1000 },
		118: { 'size': 4, 'name': 'frequency', 'signed': false, 'divisor': 1 },
		120: { 'size': 1, 'name': 'percentage', 'signed': false, 'divisor': 1 },
		121: { 'size': 2, 'name': 'altitude', 'signed': true, 'divisor': 1 },
		125: { 'size': 2, 'name': 'concentration', 'signed': false, 'divisor': 1 },
		128: { 'size': 2, 'name': 'power', 'signed': false, 'divisor': 1 },
		130: { 'size': 4, 'name': 'distance', 'signed': false, 'divisor': 1000 },
		131: { 'size': 4, 'name': 'energy', 'signed': false, 'divisor': 1000 },
		132: { 'size': 2, 'name': 'direction', 'signed': false, 'divisor': 1 },
		133: { 'size': 4, 'name': 'time', 'signed': false, 'divisor': 1 },
		134: { 'size': 6, 'name': 'gyrometer', 'signed': true, 'divisor': 100 },
		135: { 'size': 3, 'name': 'colour', 'signed': false, 'divisor': 1 },
		136: { 'size': 9, 'name': 'gps', 'signed': true, 'divisor': [10000, 10000, 100] },
		137: { 'size': 11, 'name': 'gps', 'signed': true, 'divisor': [1000000, 1000000, 100] },
		138: { 'size': 2, 'name': 'voc', 'signed': false, 'divisor': 1 },
		142: { 'size': 1, 'name': 'switch', 'signed': false, 'divisor': 1000 },
		192: { 'size': 2, 'name': 'ec', 'signed': false, 'divisor': 1 },
	};

Then the decoder output will look like:

{
    "alien_number_0": 14,
    "ec_3": 0,
    "humidity_2": 0,
    "temperature_1": 22.2
}

Hi @jplozza

Miracle solved. The first three bytes of the payload are not in Cayenne LPP format. This is very unfortunate, but the reason I got from R&D is:
SensorHub can have multiple SensorProbes with the same sensors attached. To distinguish, to which SensorProbe the data belongs, the first three bytes are the serial number of the sensor probe.

Unfortunately that brakes “standard” Cayenne LPP decoders.

As a workaround, I created a “special” parser for the SensorHub. You can download the SensorHub.js from our decoder repository.

This decodes the data correct and adds an additional field that contains the SensorProbe serial number as field PROBE_SN_0

For my SensorHub weather station the output looks now like:
image