Ideetron / Nexus-Low-Power

Nexus board with low power consumption
9 stars 3 forks source link

About the payload that this sketch sends #1

Open ktsakos opened 6 years ago

ktsakos commented 6 years ago

I receive a payload decrypted as 006700D6016867 for example. How should i read it to understand the values of temperature and humidity?

barthiddink commented 6 years ago

Please download the manual from our E-shop.

ktsakos commented 6 years ago

In my example,I can understand that the byte with value D6 represents the temperature because if i convert it in decimal is the number 214 so the temperature is 21,4 and i can also understand that the byte with value 67(LSB) represents the humidity but it is the number 103 in decimal.From the manual's examples if the humidity byte has the value 76 (hex) the humidity is 59.So my value 67(hex) should be 51,5 the humidity value.The convertion is not clear from the examples in the manual.Is there a specific point on the manual that i don't find? I will not use the TTN but i try to create my own lora server via fiware platform!

AdriVerhoef commented 6 years ago

I've uploaded the correct manual in the folder datasheets, make sure that you have the Nexus Low power manual. In the Nexus sketches we assume you use TTN as network server and Cayenne from MyDevices to create a dashboard. I don't know if the sketch will work without any changes on a different LoRaWAN server without any changes to the RX2 slot for OTAA and session messsages, as TTN uses datarate 3 on receive slot 2.

The Nexus sketches use the LPP format for the LoRaWAN payload. You can find this in the code in Cayenne_LPP.c and Cayenne_LPP.h. For more information about the LPP protocol, read the following link: https://github.com/myDevicesIoT/cayenne-docs/blob/master/docs/LORA.md

For example the Temperature is send in 0.1 Celsius degree resolution with the following function:

void CayenneLPP::addTemperature(uint8_t channel, float celsius) 
{
    uint16_t temp;

    // Check for invalid input pointer.
    if((buffer == 0) || ((buffer->Count + LPP_TEMPERATURE_SIZE) > LORAWAN_MAX_PAYLOAD))
    {
        return;
    }

    temp = (uint16_t) (celsius * 10.0);

    // Add the digital value to the Transmit buffer.
    buffer->Data[(buffer->Count) + 0] = channel;
    buffer->Data[(buffer->Count) + 1] = LPP_TEMPERATURE;
    buffer->Data[(buffer->Count) + 2] = temp >> 8;
    buffer->Data[(buffer->Count) + 3] = temp >> 0;
    buffer->Count += LPP_TEMPERATURE_SIZE;
}

Humidity is send in 0.5% RH resolution according to the LPP protocol with the following function:

void CayenneLPP::addRelativeHumidity(uint8_t channel, float rh) //sLoRa_Message *buffer, 
{
    uint16_t humidity;

    // Check for invalid input pointer.
    if((buffer == 0) || ((buffer->Count + LPP_RELATIVE_HUMIDITY_SIZE) > LORAWAN_MAX_PAYLOAD))
    {
        return;
    }

    humidity = (uint16_t) (rh * 2.0);

    // Add the digital value to the Transmit buffer.
    buffer->Data[(buffer->Count) + 0] = channel;
    buffer->Data[(buffer->Count) + 1] = LPP_RELATIVE_HUMIDITY;
    buffer->Data[(buffer->Count) + 2] = humidity;
    buffer->Count += LPP_RELATIVE_HUMIDITY_SIZE;
}

I would advise to test the sketches with TTN first before attempting to use your own server.

ktsakos commented 6 years ago

I have the Nexus Demoboard which sends some temperature and humidity measures at a specific logic for the Things Network and the Cayenne Dashboard.

If i choose to buy customed temperature/humidity sensors , they will send a payload at a different logic and they cannot be configured.

Do you think that i have to use the same sensors for my app in order to receive the same type of payload at the uplink?

GerbendH commented 6 years ago

I'm not sure what your idea of a sensor is. Is this a complete device or a chip.

For devices that are supported by Cayenne you can check this site: https://mydevices.com/cayenne/marketplace/

And filter by devices.

If you want to use an other chip than the TH06 that is placed on the demoboard, you need to rewrite the code to drive the new chip. This also means conversion of the data to the LPP protocol

ktsakos commented 6 years ago

Yes i mean complete devices which are not programmable. Thanks for your help!