# Sensor values BME; Dragino LA66 LoRaWAN Module

**URL:** <https://www.thethingsnetwork.org/forum/t/sensor-values-bme-dragino-la66-lorawan-module/60769>\
**Category:** Dragino\
**Tags:** dragino\
**Created:** [January 4, 2023, 6:53pm UTC](https://www.thethingsnetwork.org/forum/t/sensor-values-bme-dragino-la66-lorawan-module/60769 "2023-01-04T18:53:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![pzwaag](https://www.thethingsnetwork.org/forum/letter_avatar_proxy/v4/letter/p/8e7dd6/32.png) [@pzwaag](https://www.thethingsnetwork.org/forum/u/pzwaag)\
**Post date:** [January 4, 2023, 6:53pm UTC](https://www.thethingsnetwork.org/forum/t/sensor-values-bme-dragino-la66-lorawan-module/60769/1 "2023-01-04T18:53:35Z")

</div>

Hello,

I am an absolute beginner in Lora. That’s why I propably already have made several stupid mistakes.

The idea is to transport sensorreadings every half hour (BME280; temperature, humidity, pressure) to the Things Network. Therefore, the sensor is plugged into a Dragino shield (LA66 LoRaWAN Shield). An example sketch provided by Dragino on their website ([Dropbox - Log-Temperature-Sensor-and-send-data-to-TTN - Simplify your life](https://www.dropbox.com/sh/hgtycj0go4tka2r/AADUnSXgmV8nPWCbBEINLAC7a/Log-Temperature-Sensor-and-send-data-to-TTN?dl=0&subfolder_nav_tracking=1)), is modified by including the code for the sensorreadings.

Unfortunately, it is a struggle to include the pressure reading in the payload. I assume, this must be a long integer (temperature and humidity are short integers). Whatever I have done so far, it was not a succes….

Below the code which include sensor readings for temperature and humidity (correct values):

```auto
void loop() {

//digitalWrite(BEE_VCC, HIGH); // keep rn2483 running

// pick up sensor value

float celsius = bme.readTemperature();

float percentage = bme.readHumidity();

char sensor_data_buff[128]="\0";

//translate float value to int 16 bit and long to get rid of the .

int16_t temperature = (int16_t)(celsius * 100);

int16_t humidity = (int16_t)(percentage * 100);

long pressure = bme.readPressure();

//confirm status,Fport,payload length,payload(HEX)

snprintf(sensor_data_buff,128,"AT+SENDB=%d,%d,%d,%02X%02X%02X%02X",0,2,4,(short)(temperature)>>8 & 0xFF,(short)(temperature) & 0xFF,(short)(humidity)>>8 & 0xFF,(short)(humidity) & 0xFF);

ss.println(sensor_data_buff);

```

When pressure included, pressure value is zero….:

```auto
void loop() {

//digitalWrite(BEE_VCC, HIGH); // keep rn2483 running

// pick up sensor value

float celsius = bme.readTemperature();

float percentage = bme.readHumidity();

char sensor_data_buff[128]="\0";

//translate float value to int 16 bit and long to get rid of the .

int16_t temperature = (int16_t)(celsius * 100);

int16_t humidity = (int16_t)(percentage * 100);

long pressure = bme.readPressure();

//confirm status,Fport,payload length,payload(HEX)

snprintf(sensor_data_buff,128,"AT+SENDB=%d,%d,%d,%02X%02X%02X%02X",0,2,4,(short)(temperature)>>8 & 0xFF,(short)(temperature) & 0xFF,(short)(humidity)>>8 & 0xFF,(short)(humidity) & 0xFF,(long)(pressure)>>8 & 0xFF,(long)(pressure) & 0xFF);

ss.println(sensor_data_buff);

```

The following payload formatter (Javascript) is used:

```auto
function decodeUplink(input) {

var temperature = (input.bytes[0] << 8 | input.bytes[1]);

var humidity = (input.bytes[2] << 8 | input.bytes[3]);

var pressure = (input.bytes[4] << 8 | input.bytes[5]);

return {

data: {

Temperature: temperature / 100,

Humidity: humidity / 10,

Pressure: pressure / 100

}

}

}

```

What could possibly be wrong?

Kind regards,  
Pim.

---

<div class="post-metadata">

**Author:** ![Johan\_Scheepers](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/johan_scheepers/32/48536_2.png) [@Johan\_Scheepers](https://www.thethingsnetwork.org/forum/u/Johan_Scheepers)\
**Post date:** [January 4, 2023, 7:20pm UTC](https://www.thethingsnetwork.org/forum/t/sensor-values-bme-dragino-la66-lorawan-module/60769/2 "2023-01-04T19:20:55Z")

</div>

Welcome

Can you please format your post and place all text, code with the post formatting tool \</\> makes it easier for the volunteers to read toy post.

---

<div class="post-metadata">

**Author:** ![Johan\_Scheepers](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/johan_scheepers/32/48536_2.png) [@Johan\_Scheepers](https://www.thethingsnetwork.org/forum/u/Johan_Scheepers)\
**Post date:** [January 4, 2023, 7:49pm UTC](https://www.thethingsnetwork.org/forum/t/sensor-values-bme-dragino-la66-lorawan-module/60769/3 "2023-01-04T19:49:40Z")

</div>

> [@pzwaag](#):
>
> int16\_t temperature = (int16\_t)(celsius \* 100);

Here you are only dealing with positive numbers, what happens if your sensor reads - 25?

> [@pzwaag](#):
>
> long pressure = bme.readPressure();

Barometric pressure is in the region of 1000, so hex FF represents what decimal amount?

[Read here a bit](https://www.thethingsnetwork.org/docs/devices/bytes/)
