Compare commits

..

3 Commits

Author SHA1 Message Date
c611faf475 added docs 2021-04-21 11:45:33 +02:00
1ded57c2fa added readme, removed accidentally added compose 2020-07-30 17:20:03 +02:00
29d22e9c98 more comments and typos 2020-07-30 15:03:14 +02:00
6 changed files with 15 additions and 28 deletions

Binary file not shown.

View File

@ -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.

View File

@ -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

View File

@ -18,9 +18,7 @@ monitor_speed = 115200
lib_deps =
439 #ID of Lightsensor library BH1750
19 #DHT sensor library
; 31 #Adafruit Unified Sensor
AutoConnect@^1.1.7
AsyncMqttClient@^0.8.2
ArduinoJson@^6.15.2
PubSubClient@^2.8
ArduinoNvs@^2.5

View File

@ -5,19 +5,22 @@
const int numReadings = 20;
// reads soil moisture multiple times and calculates average to eliminate noise
int readCapacitiveSoilMoistureSensor() {
int total = 0; // the running total
// read from the sensor:
// read from the sensor
for (int readIndex = 0; readIndex < numReadings; readIndex++) {
total = total + analogRead(PIN_MS);
delay(2);
}
int measurement = total / numReadings;
// map measurement to relative soil moisture value in %
int finalRes = map(measurement, VALUE_AIR, VALUE_WATER, 0, 100);
Serial.print("current soil moisture: ");
Serial.println(finalRes);
// clamp mesurement to a value between 0 and 100
if (finalRes < 0) {
return 0;
} else if (finalRes > 100) {

View File

@ -120,7 +120,7 @@ void onMqttMessage(char *topic, byte *payload, unsigned int payload_length) {
Serial.println();
if (strcmp(topic, MQTT_LIGHT_PROPERTIES) == 0) {
Serial.println("receiving light treshold...");
Serial.println("receiving light threshold...");
Serial.println(topic);
StaticJsonDocument<1024> doc;
DeserializationError err = deserializeJson(doc, payload);