Merge branch 'develop' of https://git.it.hs-heilbronn.de/auribest/smart_garden into mseyfrie_dev
This commit is contained in:
commit
a9e3628ad4
@ -14,10 +14,6 @@
|
|||||||
// DHT11
|
// DHT11
|
||||||
#define PIN_DHT11 14
|
#define PIN_DHT11 14
|
||||||
|
|
||||||
// MQ-135
|
|
||||||
#define PIN_MQ135_A 12
|
|
||||||
#define PIN_MQ135_D 13
|
|
||||||
|
|
||||||
// MOISTURE SENSOR // A7
|
// MOISTURE SENSOR // A7
|
||||||
#define PIN_MS 35
|
#define PIN_MS 35
|
||||||
#define VALUE_WATER 1650
|
#define VALUE_WATER 1650
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
#include <common.h>
|
#include <common.h>
|
||||||
#include <store.h>
|
#include <store.h>
|
||||||
#include <valve.h>
|
#include <valve.h>
|
||||||
|
#include <ntpManager.h>
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
@ -205,7 +206,7 @@ void setupConnections() {
|
|||||||
connectMQTT();
|
connectMQTT();
|
||||||
|
|
||||||
mqttClient.setCallback(onMqttMessage);
|
mqttClient.setCallback(onMqttMessage);
|
||||||
|
setupNTP();
|
||||||
}
|
}
|
||||||
|
|
||||||
void publishMessage(const char *topic, const char *msg) {
|
void publishMessage(const char *topic, const char *msg) {
|
||||||
|
|||||||
@ -18,7 +18,6 @@ void setupSensors() {
|
|||||||
setupPWM();
|
setupPWM();
|
||||||
setupTemperatureSensor();
|
setupTemperatureSensor();
|
||||||
setupCapacitiveSoilMoistureSensor();
|
setupCapacitiveSoilMoistureSensor();
|
||||||
setupNTP();
|
|
||||||
|
|
||||||
strcpy(MQTT_SENSOR_DATA_TOPIC, MQTT_TOPIC_BASE_PUB "/");
|
strcpy(MQTT_SENSOR_DATA_TOPIC, MQTT_TOPIC_BASE_PUB "/");
|
||||||
strcat(MQTT_SENSOR_DATA_TOPIC, getDeviceIDcharArr());
|
strcat(MQTT_SENSOR_DATA_TOPIC, getDeviceIDcharArr());
|
||||||
|
|||||||
@ -13,8 +13,8 @@ int soilSaturation = 69;
|
|||||||
// Minimum light value before light turns on
|
// Minimum light value before light turns on
|
||||||
int minimumLightValueLX = 50;
|
int minimumLightValueLX = 50;
|
||||||
// Switches for automatic light and irrigation control
|
// Switches for automatic light and irrigation control
|
||||||
bool automaticLight = true;
|
bool automaticLight = false;
|
||||||
bool automaticIrrigation = true;
|
bool automaticIrrigation = false;
|
||||||
// Make sure device irrigates until fieldcapacity is reached
|
// Make sure device irrigates until fieldcapacity is reached
|
||||||
bool irrigateUntilFC = false;
|
bool irrigateUntilFC = false;
|
||||||
|
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
// Feldkapazität des Bodens in Prozent: Standard ist Humus
|
// Fieldcapacity of the Ground in Percentage: Standard is Humus
|
||||||
extern int fieldCapacity;
|
extern int fieldCapacity;
|
||||||
// PWP des Bodens in Prozent: Standard ist Humus
|
// PWP of the Ground in Percentage: Standard is Humus
|
||||||
extern int permanentWiltingPoint;
|
extern int permanentWiltingPoint;
|
||||||
// Boden vollständig gesättigt bei (Prozent): Standard ist Humus
|
// Ground completely saturated by (Percentage): Standard is Humus
|
||||||
extern int soilSaturation;
|
extern int soilSaturation;
|
||||||
// Helligkeitswert der mindestens vorhanden sein muss
|
// Minimum light value before light turns on
|
||||||
extern int minimumLightValueLX;
|
extern int minimumLightValueLX;
|
||||||
// switches for automatic light and irrigation control
|
// switches for automatic light and irrigation control
|
||||||
extern bool automaticLight;
|
extern bool automaticLight;
|
||||||
|
|||||||
@ -2,25 +2,23 @@
|
|||||||
#include <DHT_U.h>
|
#include <DHT_U.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
|
|
||||||
|
|
||||||
#define DHTPIN PIN_DHT11
|
#define DHTPIN PIN_DHT11
|
||||||
#define DHTTYPE DHT11
|
#define DHTTYPE DHT11
|
||||||
|
|
||||||
|
// set pin and type
|
||||||
DHT_Unified dht(DHTPIN, DHTTYPE);
|
DHT_Unified dht(DHTPIN, DHTTYPE);
|
||||||
|
|
||||||
|
// initialize temperature sensor
|
||||||
void setupTemperatureSensor() {
|
void setupTemperatureSensor() {
|
||||||
// Serial.begin(9600);
|
// Serial.begin(9600);
|
||||||
dht.begin();
|
dht.begin();
|
||||||
Serial.println(F("DHT11 Unified Sensor Ready"));
|
Serial.println(F("DHT11 Unified Sensor Ready"));
|
||||||
sensor_t sensor;
|
sensor_t sensor;
|
||||||
dht.temperature().getSensor(&sensor);
|
dht.temperature().getSensor(&sensor);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get humidity event and its value.
|
// Get humidity event and its value.
|
||||||
float readHumidity(){
|
float readHumidity(){
|
||||||
|
|
||||||
sensors_event_t event;
|
sensors_event_t event;
|
||||||
dht.humidity().getEvent(&event);
|
dht.humidity().getEvent(&event);
|
||||||
return event.relative_humidity;
|
return event.relative_humidity;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user