Compare commits
3 Commits
auribest_d
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
| c611faf475 | |||
| 1ded57c2fa | |||
| 29d22e9c98 |
BIN
Dokumentation_SmartGarden.pdf
Normal file
BIN
Dokumentation_SmartGarden.pdf
Normal file
Binary file not shown.
@ -1 +1,10 @@
|
|||||||
# Smart_Garden
|
# Smart_Garden
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
VisualStudioCode with PlatformIO extension
|
||||||
|
|
||||||
|
## Build
|
||||||
|
Configuration is defined in `platformio.ini` file. If you have PlatformIO extension installed, just use built-in build-command.
|
||||||
|
|
||||||
|
## Flash to µC
|
||||||
|
Connect ESP32 to any desired USB-Port and use PlatformIOs upload-command.
|
||||||
|
|||||||
@ -1,23 +0,0 @@
|
|||||||
version: "3"
|
|
||||||
|
|
||||||
services:
|
|
||||||
smartgarden-meteor:
|
|
||||||
image: tvm/smart_garden:latest
|
|
||||||
build: .
|
|
||||||
restart: always
|
|
||||||
labels:
|
|
||||||
- traefik.enable=true
|
|
||||||
- traefik.http.routers.smartgarden-meteor-http.rule=Host(`smartgarden-meteor.timovolkmann.de`)
|
|
||||||
- traefik.http.routers.smartgarden-meteor-http.entrypoints=web
|
|
||||||
- traefik.http.routers.smartgarden-meteor-http.middlewares=https-redirect@file
|
|
||||||
- traefik.http.routers.smartgarden-meteor-https.rule=Host(`git.timovolkmann.de`)
|
|
||||||
- traefik.http.routers.smartgarden-meteor-https.entrypoints=web-secure
|
|
||||||
- traefik.http.routers.smartgarden-meteor-https.tls.certresolver=le
|
|
||||||
- traefik.http.services.smartgarden-meteor-service.loadbalancer.server.port=3000
|
|
||||||
- traefik.docker.network=traefik_default
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
networks:
|
|
||||||
traefik_default:
|
|
||||||
external: true
|
|
||||||
@ -18,9 +18,7 @@ monitor_speed = 115200
|
|||||||
lib_deps =
|
lib_deps =
|
||||||
439 #ID of Lightsensor library BH1750
|
439 #ID of Lightsensor library BH1750
|
||||||
19 #DHT sensor library
|
19 #DHT sensor library
|
||||||
; 31 #Adafruit Unified Sensor
|
|
||||||
AutoConnect@^1.1.7
|
AutoConnect@^1.1.7
|
||||||
AsyncMqttClient@^0.8.2
|
|
||||||
ArduinoJson@^6.15.2
|
ArduinoJson@^6.15.2
|
||||||
PubSubClient@^2.8
|
PubSubClient@^2.8
|
||||||
ArduinoNvs@^2.5
|
ArduinoNvs@^2.5
|
||||||
|
|||||||
@ -5,19 +5,22 @@
|
|||||||
|
|
||||||
const int numReadings = 20;
|
const int numReadings = 20;
|
||||||
|
|
||||||
|
// reads soil moisture multiple times and calculates average to eliminate noise
|
||||||
int readCapacitiveSoilMoistureSensor() {
|
int readCapacitiveSoilMoistureSensor() {
|
||||||
int total = 0; // the running total
|
int total = 0; // the running total
|
||||||
// read from the sensor:
|
// read from the sensor
|
||||||
for (int readIndex = 0; readIndex < numReadings; readIndex++) {
|
for (int readIndex = 0; readIndex < numReadings; readIndex++) {
|
||||||
total = total + analogRead(PIN_MS);
|
total = total + analogRead(PIN_MS);
|
||||||
delay(2);
|
delay(2);
|
||||||
}
|
}
|
||||||
int measurement = total / numReadings;
|
int measurement = total / numReadings;
|
||||||
|
|
||||||
|
// map measurement to relative soil moisture value in %
|
||||||
int finalRes = map(measurement, VALUE_AIR, VALUE_WATER, 0, 100);
|
int finalRes = map(measurement, VALUE_AIR, VALUE_WATER, 0, 100);
|
||||||
Serial.print("current soil moisture: ");
|
Serial.print("current soil moisture: ");
|
||||||
Serial.println(finalRes);
|
Serial.println(finalRes);
|
||||||
|
|
||||||
|
// clamp mesurement to a value between 0 and 100
|
||||||
if (finalRes < 0) {
|
if (finalRes < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
} else if (finalRes > 100) {
|
} else if (finalRes > 100) {
|
||||||
|
|||||||
@ -120,7 +120,7 @@ void onMqttMessage(char *topic, byte *payload, unsigned int payload_length) {
|
|||||||
Serial.println();
|
Serial.println();
|
||||||
|
|
||||||
if (strcmp(topic, MQTT_LIGHT_PROPERTIES) == 0) {
|
if (strcmp(topic, MQTT_LIGHT_PROPERTIES) == 0) {
|
||||||
Serial.println("receiving light treshold...");
|
Serial.println("receiving light threshold...");
|
||||||
Serial.println(topic);
|
Serial.println(topic);
|
||||||
StaticJsonDocument<1024> doc;
|
StaticJsonDocument<1024> doc;
|
||||||
DeserializationError err = deserializeJson(doc, payload);
|
DeserializationError err = deserializeJson(doc, payload);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user