arduino external temperature sensors and pressure removed
This commit is contained in:
@@ -1,18 +1,10 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
Davis logger with Wifi esp8266 as bridge.
|
Davis logger
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// připojení potřebných knihoven
|
// připojení potřebných knihoven
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
#include <Adafruit_Sensor.h>
|
|
||||||
#include <Adafruit_BMP280.h>
|
|
||||||
#include <SparkFunHTU21D.h>
|
|
||||||
HTU21D sensorHTU;
|
|
||||||
|
|
||||||
#define BMP280_ADDRESS (0x76)
|
|
||||||
Adafruit_BMP280 bmp;
|
|
||||||
int height = 450;
|
|
||||||
|
|
||||||
#include "Davis.h"
|
#include "Davis.h"
|
||||||
#include "SPI.h"
|
#include "SPI.h"
|
||||||
@@ -28,11 +20,7 @@ void setup()
|
|||||||
delay(100);
|
delay(100);
|
||||||
Radio.begin();
|
Radio.begin();
|
||||||
Radio.rx();
|
Radio.rx();
|
||||||
if (!bmp.begin(BMP280_ADDRESS)) {
|
|
||||||
Serial.println("BMP280 sensor not found, check wires!");
|
|
||||||
while (1);
|
|
||||||
}
|
|
||||||
sensorHTU.begin();
|
|
||||||
Serial.println("Done Setup");
|
Serial.println("Done Setup");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,15 +53,7 @@ void printPacket(void)
|
|||||||
package[13] = freqError;
|
package[13] = freqError;
|
||||||
package[14] = next;
|
package[14] = next;
|
||||||
package[15] = pktCount;
|
package[15] = pktCount;
|
||||||
float tempBMP = bmp.readTemperature();
|
|
||||||
float pressBMP = (bmp.readPressure()/100.00);
|
|
||||||
float sea_level = pressBMP * pow((1 - (0.0065 * height) / (tempBMP + 0.0065 * height + 273.15)), -5.257);
|
|
||||||
delay(100);
|
|
||||||
float htu_tmp = sensorHTU.readTemperature();
|
|
||||||
float htu_humi = sensorHTU.readHumidity();
|
|
||||||
if (htu_tmp > 125 | htu_humi > 100) {
|
|
||||||
Serial.println("Sensor HTU21D communication error!");
|
|
||||||
}
|
|
||||||
String data = "{'hop':" + String(package[0]) + "," +
|
String data = "{'hop':" + String(package[0]) + "," +
|
||||||
"'h':" + String(package[1]) + "," +
|
"'h':" + String(package[1]) + "," +
|
||||||
"'b0':" + String(package[2]) + "," +
|
"'b0':" + String(package[2]) + "," +
|
||||||
@@ -86,11 +66,6 @@ void printPacket(void)
|
|||||||
"'b7':" + String(package[9]) + "," +
|
"'b7':" + String(package[9]) + "," +
|
||||||
"'b8':" + String(package[10]) + "," +
|
"'b8':" + String(package[10]) + "," +
|
||||||
"'b9':" + String(package[11]) + "," +
|
"'b9':" + String(package[11]) + "," +
|
||||||
"'Ti':" + String(tempBMP) + "," +
|
|
||||||
"'P':" + String(pressBMP) + "," +
|
|
||||||
"'P0':" + String(sea_level) + "," +
|
|
||||||
"'Thtu':" + String(htu_tmp) + "," +
|
|
||||||
"'Hhtu':" + String(htu_humi) + "," +
|
|
||||||
"'rssi':" + String(package[12]) + "," +
|
"'rssi':" + String(package[12]) + "," +
|
||||||
"'lqi':" + String(package[13]) + "," +
|
"'lqi':" + String(package[13]) + "," +
|
||||||
"'nxt':" + String(package[14]) + "," +
|
"'nxt':" + String(package[14]) + "," +
|
||||||
|
|||||||
@@ -311,7 +311,6 @@ if '__main__':
|
|||||||
raw_winddir = davis_data['b1']
|
raw_winddir = davis_data['b1']
|
||||||
wind = davis_decoder.decode_wind({"windspeed": raw_windspeed,
|
wind = davis_decoder.decode_wind({"windspeed": raw_windspeed,
|
||||||
"winddir": raw_winddir})
|
"winddir": raw_winddir})
|
||||||
|
|
||||||
influx_weather_write = davis_writer.base_construct(
|
influx_weather_write = davis_writer.base_construct(
|
||||||
{ "speed": float(wind['speed']),
|
{ "speed": float(wind['speed']),
|
||||||
"direction": float(wind['direction'])}
|
"direction": float(wind['direction'])}
|
||||||
|
|||||||
Reference in New Issue
Block a user