Newbie Question about Digital and Analog values


#1

the below cayenne properties.

#define LPP_DIGITAL_INPUT       0       // 1 byte
#define LPP_DIGITAL_OUTPUT      1       // 1 byte
#define LPP_ANALOG_INPUT        2       // 2 bytes, 0.01 signed
#define LPP_ANALOG_OUTPUT       3       // 2 bytes, 0.01 signed

Does this mean for digital( I/O) the only possible values are 0 and 1.

but for Analog what is the range of possible values?


#2

that is the data type value in cayenne LPP. read more about it here http://mydevices.com/cayenne/docs/lora/#lora-cayenne-low-power-payload


#3

Thanks for the link…in the doc…this piece of code for example:

"if ((cursor + LPP_ANALOG_INPUT_SIZE) > maxsize) {
return 0;
}
"

What would be the set maxsize value for analog I/O? …Sorry for basic question I’m just getting requirements for a IoT project.


#4

you dont have to add anything for this class. you can use TTN cayenne LPP example code which simplifies the coding and can be used with much ease. https://github.com/TheThingsNetwork/arduino-device-lib/blob/master/examples/CayenneLPP/CayenneLPP.ino and add an analog input just by using:
lpp.addAnalogInput(uint8_t channel, float value); where you to add the channel and the analog value reading.


#5

@jeryl.cook From the github repository I see #define LPP_ANALOG_INPUT_SIZE 4 // 2 bytes, 0.01 signed and #define LPP_ANALOG_OUTPUT_SIZE 4 // 2 bytes, 0.01 signed Since it’s signed 0.01 that would make the min/max -327.68 to 327.67. If you need larger ranges you can try Energy and Concentration data types. Let me know if that answers your question.


#6

yes that answers my question!..:grinning:

I did do a bit of research on why last night it is 2 bytes long, that’s 16 bits. The range of a 16 bit two’s complement number is from -32768 to 32767.

0.01 units to represent a single bit that gives you a range of -327.68 to 327.67. which is your answer! Thanks again.


#7

I don’t see “Energy and Concentration” data type in the specification?

Type IPSO LPP Hex Data Size Data Resolution per bit
Digital Input 3200 0 0 1 1
Digital Output 3201 1 1 1 1
Analog Input 3202 2 2 2 0.01 Signed
Analog Output 3203 3 3 2 0.01 Signed
Illuminance Sensor 3301 101 65 2 1 Lux Unsigned MSB
Presence Sensor 3302 102 66 1 1
Temperature Sensor 3303 103 67 2 0.1 °C Signed MSB
Humidity Sensor 3304 104 68 1 0.5 % Unsigned
Accelerometer 3313 113 71 6 0.001 G Signed MSB per axis
Barometer 3315 115 73 2 0.1 hPa Unsigned MSB
Gyrometer 3334 134 86 6 0.01 °/s Signed MSB per axis
GPS Location 3336 136 88 9 Latitude : 0.0001 ° Signed MSB
Longitude : 0.0001 ° Signed MSB
Altitude : 0.01 meter Signed MSB

#8

Looks like it’s not in the github repository yet but it is supported now.

Concentration (ppm) - hex value 0x7D, 3 bytes unsigned
Energy (Wh) - hex value 0x83, 4 bytes unsigned

I can’t promise anything but I’ll take a look at it when I have time and try to make a pull request to add it in.


#9

Understood. Thank you @adam.
I assume these are the only two new additions to the spec?


#10

Yes, just those two. I was talking to one of the cayenne devs and that what they said. You can also manually send that payload if you want, but it’s just not in a convenient package yet.


#11

one more question lol.
https://mydevices.com/cayenne/docs/lora/#lora-cayenne-low-power-payload-ipso-smart-objects-reference-expansion-pack-data-types

There are quite a few extended datatypes…are there plans to support all of the 'extended IPSO data types" in the dashboard?


#12

@eptak Are there any plans to add these extended data types?