Post by acekrystal on Aug 26, 2016 11:21:18 GMT
Hello all,
I'm having a problem that some of my data send in the payload turns out as -0.000000 on the piGateway side.
My setup:
I'm using a Arduino -> RFM69 --> RFM69 -> piGateway structure.
I'm using a SHT31-D to read Humidity and Temperature.
Arduino code for SHT31-D:
output on Arduino Serial:
output on piGateway:
Somehow it reads a lot of data as -0.000000. This only happens with var3, it aso happens when i swap temperature and humidity, again with var3.
It does not happen when I enable the round numbers:
I get the idea that the payload might be getting to big to propperly read some var3 value's.
My 2 questions:
1. Does someone know why this happens and how to solve it?
2. Why is my output on the Arduino serial numbers with 2 decimal(24.95), while after 433Mhz transfer it gets 6 decimals (24.948583), that also seem to have a valid value? Shouldn't DEBUGLN1(t); also show 6 decimals on Arduino Serial if SHT31D returned this? It feels like someone adds more decimals.
I'm having a problem that some of my data send in the payload turns out as -0.000000 on the piGateway side.
My setup:
I'm using a Arduino -> RFM69 --> RFM69 -> piGateway structure.
I'm using a SHT31-D to read Humidity and Temperature.
Arduino code for SHT31-D:
// SHT31-D Temp/Hum. Sensor ==========================
#include <Arduino.h>
#include <Wire.h>
#include "Adafruit_SHT31.h"
Adafruit_SHT31 sht31 = Adafruit_SHT31();
double h = 0;
double t = 0;
// === end SHT31-D Temp/Hum. Sensor ======================
...
sht31.begin(0x44);
h = sht31.readHumidity(); // read Humidity
t = sht31.readTemperature(); // read Temperature
// t = round(t*10)/10.0; // Optional round at 1 decimal
DEBUG1("Humidity=");
DEBUG1(h);
DEBUG1(" Temp=");
DEBUGLN1(t);
// DEBUGLN1("°C");
temperature_time = millis();
//send data
theData.deviceID = 6;
theData.var1_usl = millis();
theData.var2_float = t;
theData.var3_float = h;
frameSent++;
if (radio.sendWithRetry(GATEWAYID, (const void*)(&theData), sizeof(theData))) {
ackReceived++;
DEBUGLN1(" ACK received");
} else {
ackMissed++;
}
delay(1000);
output on Arduino Serial:
Humidity=57.61 Temp=24.95
ACK received
Humidity=57.57 Temp=24.92
ACK received
Humidity=57.56 Temp=24.95
ACK received
output on piGateway:
Pinging node 13 - ACK - nothing![13] to [1] Received Node ID = 13 Device ID = 6 Time = 6619768 RSSI = -63 var2 = 24.922562 var3 = 57.489891
[13] to [1] Received Node ID = 13 Device ID = 6 Time = 6621302 RSSI = -66 var2 = 24.922562 var3 = 57.456322
[13] to [1] Received Node ID = 13 Device ID = 6 Time = 6622832 RSSI = -66 var2 = 24.938583 var3 = -0.000000
Pinging node 13 - ACK - nothing![13] to [1] Received Node ID = 13 Device ID = 6 Time = 6624368 RSSI = -67 var2 = 24.922562 var3 = 57.502098
[13] to [1] Received Node ID = 13 Device ID = 6 Time = 6625902 RSSI = -67 var2 = 24.938583 var3 = -0.000000
Somehow it reads a lot of data as -0.000000. This only happens with var3, it aso happens when i swap temperature and humidity, again with var3.
It does not happen when I enable the round numbers:
// t = round(t*10)/10.0; // Optional round at 1 decimal
I get the idea that the payload might be getting to big to propperly read some var3 value's.
My 2 questions:
1. Does someone know why this happens and how to solve it?
2. Why is my output on the Arduino serial numbers with 2 decimal(24.95), while after 433Mhz transfer it gets 6 decimals (24.948583), that also seem to have a valid value? Shouldn't DEBUGLN1(t); also show 6 decimals on Arduino Serial if SHT31D returned this? It feels like someone adds more decimals.