Compare commits
No commits in common. "develop" and "auribest_dev" have entirely different histories.
develop
...
auribest_d
Binary file not shown.
11
README.md
11
README.md
@ -1,10 +1 @@
|
||||
# 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.
|
||||
# Smart_Garden
|
||||
23
docker-compose.yml
Normal file
23
docker-compose.yml
Normal file
@ -0,0 +1,23 @@
|
||||
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,7 +18,9 @@ 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
|
||||
|
||||
@ -5,22 +5,19 @@
|
||||
|
||||
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) {
|
||||
|
||||
@ -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 threshold...");
|
||||
Serial.println("receiving light treshold...");
|
||||
Serial.println(topic);
|
||||
StaticJsonDocument<1024> doc;
|
||||
DeserializationError err = deserializeJson(doc, payload);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user