Bodenfeuchtesensor HB-UNI-Sen-CAP-MOIST(-T)

Entwicklung und Bau von Hardware aller Art, die im HM-Umfeld eingesetzt werden kann

Moderator: Co-Administratoren

jp112sdl
Beiträge: 12085
Registriert: 20.11.2016, 20:01
Hat sich bedankt: 847 Mal
Danksagung erhalten: 2139 Mal
Kontaktdaten:

Re: Bodenfeuchtesensor HB-UNI-Sen-CAP-MOIST(-T)

Beitrag von jp112sdl » 17.03.2020, 21:59

stan23 hat geschrieben:
17.03.2020, 17:32
A6 und A7 sind rein analog und haben keine reinen Ziffern als Namen.
20 und 21

pins_arduino.h:

Code: Alles auswählen

#define PIN_A0   (14)
#define PIN_A1   (15)
#define PIN_A2   (16)
#define PIN_A3   (17)
#define PIN_A4   (18)
#define PIN_A5   (19)
#define PIN_A6   (20)
#define PIN_A7   (21)

static const uint8_t A0 = PIN_A0;
static const uint8_t A1 = PIN_A1;
static const uint8_t A2 = PIN_A2;
static const uint8_t A3 = PIN_A3;
static const uint8_t A4 = PIN_A4;
static const uint8_t A5 = PIN_A5;
static const uint8_t A6 = PIN_A6;
static const uint8_t A7 = PIN_A7;

VG,
Jérôme ☕️

---
Support for my Homebrew-Devices: Download JP-HB-Devices Addon

Garagenloeter
Beiträge: 305
Registriert: 04.07.2018, 21:52
System: Alternative CCU (auf Basis OCCU)
Hat sich bedankt: 45 Mal
Danksagung erhalten: 4 Mal

Re: Bodenfeuchtesensor HB-UNI-Sen-CAP-MOIST(-T)

Beitrag von Garagenloeter » 21.04.2020, 18:26

Ich wollte nun auch mal einen bauen. Teile liegen schon lange hier.
Wie lang dürfen die Leitungen zwischen Sensor und Arduino sein?

Benutzeravatar
stan23
Beiträge: 2030
Registriert: 13.12.2016, 21:14
System: Alternative CCU (auf Basis OCCU)
Wohnort: Altmühltal
Hat sich bedankt: 576 Mal
Danksagung erhalten: 335 Mal
Kontaktdaten:

Re: Bodenfeuchtesensor HB-UNI-Sen-CAP-MOIST(-T)

Beitrag von stan23 » 22.04.2020, 08:05

stan23 hat geschrieben:
27.01.2020, 11:15
Technikkram schreibt:
Daher solltet Ihr die Länge von 20-25m nicht überschreiten.
Probiert habe ich das selber nicht.
:wink:
Viele Grüße
Marco

RaspberryMatic als VM auf einem NUC mit Proxmox und USB-Funkmodul
~80 Geräte (HM, HmIP, HMW, HBW, AskSin)

MathiasZ

Re: Bodenfeuchtesensor HB-UNI-Sen-CAP-MOIST(-T)

Beitrag von MathiasZ » 22.04.2020, 09:19

25 m je Sensor oder gesamt 25m?
Das ist hier die Frage......

jp112sdl
Beiträge: 12085
Registriert: 20.11.2016, 20:01
Hat sich bedankt: 847 Mal
Danksagung erhalten: 2139 Mal
Kontaktdaten:

Re: Bodenfeuchtesensor HB-UNI-Sen-CAP-MOIST(-T)

Beitrag von jp112sdl » 22.04.2020, 09:36

MathiasZ hat geschrieben:
22.04.2020, 09:19
25 m je Sensor oder gesamt 25m?
Das ist hier die Frage......
stan23 hat geschrieben:
22.04.2020, 08:05
stan23 hat geschrieben:
27.01.2020, 11:15
Technikkram schreibt:
Daher solltet Ihr die Länge von 20-25m nicht überschreiten.
Probiert habe ich das selber nicht.
Einfach den verlinkten Artikel auf Technikkram lesen, da steht es drin

VG,
Jérôme ☕️

---
Support for my Homebrew-Devices: Download JP-HB-Devices Addon

Garagenloeter
Beiträge: 305
Registriert: 04.07.2018, 21:52
System: Alternative CCU (auf Basis OCCU)
Hat sich bedankt: 45 Mal
Danksagung erhalten: 4 Mal

Re: Bodenfeuchtesensor HB-UNI-Sen-CAP-MOIST(-T)

Beitrag von Garagenloeter » 22.04.2020, 16:43

Danke für die Info und den Hinweis.
Die angegebene Länge ist für mich mehr als ausreichend.

Bengel00
Beiträge: 34
Registriert: 04.03.2015, 12:56
Hat sich bedankt: 1 Mal

Re: Bodenfeuchtesensor HB-UNI-Sen-CAP-MOIST(-T)

Beitrag von Bengel00 » 10.07.2020, 10:44

Hallo Leute,

ich habe nach einem Wasserschaden an meinem alten Bodenfeuchtesensors mal einen neuen zusammengebaut.
Nun habe ich das Problem das der angezeigte Spannungewert bei Zustandsänderung (z.B. Sensor trocken und wird in Wasserglas gestellt) nicht koreckt angezeigt wird, weil der wert langsamm mit jeder Messung in dem falle kleiner wird. Der Prozentuale Bodenfeuchtewert spinnt dabei total. Er steigt erst einmal und fällt dann auf einmal extrem ab und steigt dann von Messung zu Messung wieder an. Siehe Logs vom Seriellen Monitor.

Aufbau:
Genau wie von Jerome in Github beschrieben mit 3 Feuchtesensoren, bei den Logs unten war nur einer auf Kanal3 angschlossen. Ohne Tempsensor. Spannung von einem 6v Akku, aber auch mit 3xAAA in reihe getestet, selbes Problem.Feuchtesensoren sind die beschrieben Moisture Sensor v1.2.
Hardware haben ich komplett nacheinander alles durch getauscht, eigene Verdratung auf einer Lochplatine komplett neu aufgebaut, verschiedene Feuchtesensoren probiert.
Nach 3 Tagen Fehlersuche ohne Erfolg hoffe ich das jemand ein Tip für mich hat.

Log mit 6v Akku:

Code: Alles auswählen

Feuchtesensor ist an Kanal3 angeschlossen, die anderen beiden sind nich angschlossen bei dem Test.
Feuchtesensor trocken und  gegen 14:56:30 Uhr in ein Glass Wasser gestellt

14:55:16.344 -> AskSin++ V4.1.6 (Jul  9 2020 14:50:13)
14:55:16.344 -> Address Space: 32 - 166
14:55:16.344 -> CC init1
14:55:16.344 -> CC Version: 14
14:55:16.378 ->  - ready
14:55:16.615 -> iVcc: 3342
14:55:16.615 -> eVcc: 6138
14:55:16.615 -> ID: F31102  Serial: JPCAPM0002
14:55:16.615 -> *LOW BAT Limit: 22
14:55:16.649 -> *Sendeintervall: 1
14:55:16.649 -> Config changed List1 (CH 1)
14:55:16.649 -> Config changed List1 (CH 2)
14:55:16.649 -> *HIGHValue : 1000
14:55:16.649 -> *LOWValue  : 1
14:55:16.649 -> Config changed List1 (CH 3)
14:55:16.649 -> *HIGHValue : 1000
14:55:16.649 -> *LOWValue  : 1
14:55:16.649 -> Config changed List1 (CH 4)
14:55:16.683 -> *HIGHValue : 1000
14:55:16.683 -> *LOWValue  : 1
14:55:22.836 -> +Analog     (#1): 303
14:55:22.938 -> +Analog     (#2): 307
14:55:23.005 -> +Analog     (#3): 906
14:55:23.005 -> +Battery      V : 61
14:55:23.005 -> +Humidity (#1) %: 70
14:55:23.005 -> +Humidity (#2) %: 70
14:55:23.039 -> +Humidity (#3) %: 76
14:55:23.039 -> <- 12 01 A2 53 F31102 31AF6E 00 41 3D 42 46 43 46 44 4C  - 1138
14:55:23.650 -> waitAck: 00
14:55:23.684 -> <- 12 01 A2 53 F31102 31AF6E 00 41 3D 42 46 43 46 44 4C  - 1781
14:55:24.296 -> waitAck: 00
14:55:24.330 -> <- 12 01 A2 53 F31102 31AF6E 00 41 3D 42 46 43 46 44 4C  - 2422
14:55:24.466 -> -> 0A 01 80 02 31AF6E F31102 00  - 2547
14:55:24.466 -> waitAck: 01
14:56:23.360 -> +Analog     (#1): 617
14:56:23.428 -> +Analog     (#2): 506
14:56:23.496 -> +Analog     (#3): 909
14:56:23.530 -> +Battery      V : 61
14:56:23.530 -> +Humidity (#1) %: 39
14:56:23.530 -> +Humidity (#2) %: 50
14:56:23.530 -> +Humidity (#3) %: 75
14:56:23.564 -> <- 12 02 84 53 F31102 31AF6E 00 41 3D 42 27 43 32 44 4B  - 3850
14:57:22.514 -> +Analog     (#1): 564
14:57:22.582 -> +Analog     (#2): 460
14:57:22.684 -> +Analog     (#3): 810
14:57:22.684 -> +Battery      V : 61
14:57:22.684 -> +Humidity (#1) %: 44
14:57:22.684 -> +Humidity (#2) %: 55
14:57:22.684 -> +Humidity (#3) %: 85
14:57:22.718 -> <- 12 03 84 53 F31102 31AF6E 00 41 3D 42 2C 43 37 44 55  - 4659
14:58:21.677 -> +Analog     (#1): 517
14:58:21.778 -> +Analog     (#2): 432
14:58:21.845 -> +Analog     (#3): 730
14:58:21.845 -> +Battery      V : 61
14:58:21.845 -> +Humidity (#1) %: 49
14:58:21.845 -> +Humidity (#2) %: 57
14:58:21.845 -> +Humidity (#3) %: 93
14:58:21.879 -> <- 12 04 84 53 F31102 31AF6E 00 41 3D 42 31 43 39 44 5D  - 5468
14:59:20.837 -> +Analog     (#1): 474
14:59:20.939 -> +Analog     (#2): 397
14:59:21.007 -> +Analog     (#3): 654
14:59:21.007 -> +Battery      V : 61
14:59:21.007 -> +Humidity (#1) %: 53
14:59:21.007 -> +Humidity (#2) %: 61
14:59:21.007 -> +Humidity (#3) %: 35
14:59:21.041 -> <- 12 05 84 53 F31102 31AF6E 00 41 3D 42 35 43 3D 44 23  - 6277
15:00:19.991 -> +Analog     (#1): 432
15:00:20.093 -> +Analog     (#2): 365
15:00:20.161 -> +Analog     (#3): 582
15:00:20.161 -> +Battery      V : 61
15:00:20.161 -> +Humidity (#1) %: 57
15:00:20.195 -> +Humidity (#2) %: 64
15:00:20.195 -> +Humidity (#3) %: 42
15:00:20.195 -> <- 12 06 84 53 F31102 31AF6E 00 41 3D 42 39 43 40 44 2A  - 7088
15:01:19.154 -> +Analog     (#1): 392
15:01:19.256 -> +Analog     (#2): 340
15:01:19.324 -> +Analog     (#3): 514
15:01:19.324 -> +Battery      V : 61
15:01:19.324 -> +Humidity (#1) %: 61
15:01:19.324 -> +Humidity (#2) %: 67
15:01:19.324 -> +Humidity (#3) %: 49
15:01:19.358 -> <- 12 07 84 53 F31102 31AF6E 00 41 3D 42 3D 43 43 44 31  - 7897
15:02:18.303 -> +Analog     (#1): 357
15:02:18.405 -> +Analog     (#2): 316
15:02:18.472 -> +Analog     (#3): 457
15:02:18.472 -> +Battery      V : 61
15:02:18.472 -> +Humidity (#1) %: 65
15:02:18.506 -> +Humidity (#2) %: 69
15:02:18.506 -> +Humidity (#3) %: 55
15:02:18.506 -> <- 12 08 84 53 F31102 31AF6E 00 41 3D 42 41 43 45 44 37  - 8706
15:03:17.457 -> +Analog     (#1): 352
15:03:17.559 -> +Analog     (#2): 311
15:03:17.627 -> +Analog     (#3): 443
15:03:17.627 -> +Battery      V : 61
15:03:17.627 -> +Humidity (#1) %: 65
15:03:17.627 -> +Humidity (#2) %: 69
15:03:17.661 -> +Humidity (#3) %: 56
15:03:17.661 -> <- 12 09 84 53 F31102 31AF6E 00 41 3D 42 41 43 45 44 38  - 9515
15:04:16.602 -> +Analog     (#1): 345
15:04:16.704 -> +Analog     (#2): 309
15:04:16.772 -> +Analog     (#3): 442
15:04:16.772 -> +Battery      V : 61
15:04:16.772 -> +Humidity (#1) %: 66
15:04:16.806 -> +Humidity (#2) %: 70
15:04:16.806 -> +Humidity (#3) %: 56
15:04:16.806 -> <- 12 0A 84 53 F31102 31AF6E 00 41 3D 42 42 43 46 44 38  - 10323



Log mit 3xAAA

Code: Alles auswählen

Feuchtesensor ist an Kanal3 angeschlossen, die anderen beiden sind nich angschlossen bei dem Test.
Feuchtesensor trocken und  gegen 09:44:30 Uhr in ein Glass Wasser gestellt

09:42:16.610 -> AskSin++ V4.1.6 (Jul  9 2020 14:50:13)
09:42:16.610 -> Address Space: 32 - 166
09:42:16.610 -> CC init1
09:42:16.610 -> CC Version: 14
09:42:16.610 ->  - ready
09:42:16.882 -> iVcc: 3342
09:42:16.882 -> eVcc: 4222
09:42:16.882 -> ID: F31102  Serial: JPCAPM0002
09:42:16.882 -> *LOW BAT Limit: 22
09:42:16.882 -> *Sendeintervall: 1
09:42:16.882 -> Config changed List1 (CH 1)
09:42:16.916 -> Config changed List1 (CH 2)
09:42:16.916 -> *HIGHValue : 1000
09:42:16.916 -> *LOWValue  : 1
09:42:16.916 -> Config changed List1 (CH 3)
09:42:16.916 -> *HIGHValue : 1000
09:42:16.916 -> *LOWValue  : 1
09:42:16.916 -> Config changed List1 (CH 4)
09:42:16.916 -> *HIGHValue : 1000
09:42:16.916 -> *LOWValue  : 1
09:42:23.101 -> +Analog     (#1): 339
09:42:23.169 -> +Analog     (#2): 352
09:42:23.271 -> +Analog     (#3): 912
09:42:23.271 -> +Battery      V : 42
09:42:23.271 -> +Humidity (#1) %: 67
09:42:23.271 -> +Humidity (#2) %: 65
09:42:23.271 -> +Humidity (#3) %: 75
09:42:23.305 -> <- 12 01 A2 53 F31102 31AF6E 00 41 2A 42 43 43 41 44 4B  - 1138
09:42:23.916 -> waitAck: 00
09:42:23.950 -> <- 12 01 A2 53 F31102 31AF6E 00 41 2A 42 43 43 41 44 4B  - 1781
09:42:24.561 -> waitAck: 00
09:42:24.595 -> <- 12 01 A2 53 F31102 31AF6E 00 41 2A 42 43 43 41 44 4B  - 2422
09:42:24.731 -> -> 0A 01 80 02 31AF6E F31102 00  - 2547
09:42:24.731 -> waitAck: 01
09:43:23.527 -> +Analog     (#1): 645
09:43:23.595 -> +Analog     (#2): 546
09:43:23.697 -> +Analog     (#3): 910
09:43:23.697 -> +Battery      V : 42
09:43:23.697 -> +Humidity (#1) %: 36
09:43:23.697 -> +Humidity (#2) %: 46
09:43:23.697 -> +Humidity (#3) %: 75
09:43:23.731 -> <- 12 02 84 53 F31102 31AF6E 00 41 2A 42 24 43 2E 44 4B  - 3850
09:44:22.644 -> +Analog     (#1): 646
09:44:22.712 -> +Analog     (#2): 548
09:44:22.814 -> +Analog     (#3): 911
09:44:22.814 -> +Battery      V : 42
09:44:22.814 -> +Humidity (#1) %: 36
09:44:22.814 -> +Humidity (#2) %: 46
09:44:22.814 -> +Humidity (#3) %: 75
09:44:22.848 -> <- 12 03 84 53 F31102 31AF6E 00 41 2A 42 24 43 2E 44 4B  - 4659
09:45:21.755 -> +Analog     (#1): 577
09:45:21.824 -> +Analog     (#2): 493
09:45:21.937 -> +Analog     (#3): 786
09:45:21.937 -> +Battery      V : 42
09:45:21.937 -> +Humidity (#1) %: 43
09:45:21.937 -> +Humidity (#2) %: 51
09:45:21.937 -> +Humidity (#3) %: 88
09:45:21.966 -> <- 12 04 84 53 F31102 31AF6E 00 41 2A 42 2B 43 33 44 58  - 5468
09:46:20.852 -> +Analog     (#1): 513
09:46:20.954 -> +Analog     (#2): 447
09:46:21.022 -> +Analog     (#3): 682
09:46:21.022 -> +Battery      V : 42
09:46:21.022 -> +Humidity (#1) %: 49
09:46:21.022 -> +Humidity (#2) %: 56
09:46:21.056 -> +Humidity (#3) %: 98
09:46:21.056 -> <- 12 05 84 53 F31102 31AF6E 00 41 2A 42 31 43 38 44 62  - 6277
09:47:19.962 -> +Analog     (#1): 455
09:47:20.064 -> +Analog     (#2): 398
09:47:20.132 -> +Analog     (#3): 589
09:47:20.132 -> +Battery      V : 42
09:47:20.132 -> +Humidity (#1) %: 55
09:47:20.166 -> +Humidity (#2) %: 61
09:47:20.166 -> +Humidity (#3) %: 42
09:47:20.166 -> <- 12 06 84 53 F31102 31AF6E 00 41 2A 42 37 43 3D 44 2A  - 7088
09:48:19.087 -> +Analog     (#1): 403
09:48:19.155 -> +Analog     (#2): 365
09:48:19.257 -> +Analog     (#3): 503
09:48:19.257 -> +Battery      V : 42
09:48:19.257 -> +Humidity (#1) %: 60
09:48:19.257 -> +Humidity (#2) %: 64
09:48:19.257 -> +Humidity (#3) %: 50
09:48:19.291 -> <- 12 07 84 53 F31102 31AF6E 00 41 2A 42 3C 43 40 44 32  - 7897
09:49:18.208 -> +Analog     (#1): 369
09:49:18.276 -> +Analog     (#2): 335
09:49:18.378 -> +Analog     (#3): 450
09:49:18.378 -> +Battery      V : 42
09:49:18.378 -> +Humidity (#1) %: 64
09:49:18.378 -> +Humidity (#2) %: 67
09:49:18.378 -> +Humidity (#3) %: 56
09:49:18.412 -> <- 12 08 84 53 F31102 31AF6E 00 41 2A 42 40 43 43 44 38  - 8706
09:50:17.306 -> +Analog     (#1): 374
09:50:17.408 -> +Analog     (#2): 347
09:50:17.476 -> +Analog     (#3): 446
09:50:17.476 -> +Battery      V : 42
09:50:17.476 -> +Humidity (#1) %: 63
09:50:17.476 -> +Humidity (#2) %: 66
09:50:17.510 -> +Humidity (#3) %: 56
09:50:17.510 -> <- 12 09 84 53 F31102 31AF6E 00 41 2A 42 3F 43 42 44 38  - 9515
09:51:16.439 -> +Analog     (#1): 365
09:51:16.507 -> +Analog     (#2): 337
09:51:16.609 -> +Analog     (#3): 446
09:51:16.609 -> +Battery      V : 42
09:51:16.609 -> +Humidity (#1) %: 64
09:51:16.609 -> +Humidity (#2) %: 67
09:51:16.609 -> +Humidity (#3) %: 56
09:51:16.643 -> <- 12 0A 84 53 F31102 31AF6E 00 41 2A 42 40 43 43 44 38  - 10323
09:52:15.533 -> +Analog     (#1): 369
09:52:15.635 -> +Analog     (#2): 339
09:52:15.704 -> +Analog     (#3): 445
09:52:15.704 -> +Battery      V : 42
09:52:15.704 -> +Humidity (#1) %: 64
09:52:15.704 -> +Humidity (#2) %: 67
09:52:15.738 -> +Humidity (#3) %: 56
09:52:15.738 -> <- 12 0B 84 53 F31102 31AF6E 00 41 2A 42 40 43 43 44 38  - 11134
09:53:14.644 -> +Analog     (#1): 365
09:53:14.745 -> +Analog     (#2): 337
09:53:14.814 -> +Analog     (#3): 446
09:53:14.814 -> +Battery      V : 42
09:53:14.847 -> +Humidity (#1) %: 64
09:53:14.847 -> +Humidity (#2) %: 67
09:53:14.847 -> +Humidity (#3) %: 56
09:53:14.881 -> <- 12 0C 84 53 F31102 31AF6E 00 41 2A 42 40 43 43 44 38  - 11943
09:54:13.766 -> +Analog     (#1): 365
09:54:13.868 -> +Analog     (#2): 332
09:54:13.936 -> +Analog     (#3): 446
09:54:13.936 -> +Battery      V : 42
09:54:13.936 -> +Humidity (#1) %: 64
09:54:13.936 -> +Humidity (#2) %: 67
09:54:13.936 -> +Humidity (#3) %: 56
09:54:13.970 -> <- 12 0D 84 53 F31102 31AF6E 00 41 2A 42 40 43 43 44 38  - 12752
09:55:12.901 -> +Analog     (#1): 365
09:55:12.969 -> +Analog     (#2): 334
09:55:13.037 -> +Analog     (#3): 446
09:55:13.071 -> +Battery      V : 42
09:55:13.071 -> +Humidity (#1) %: 64
09:55:13.071 -> +Humidity (#2) %: 67
09:55:13.071 -> +Humidity (#3) %: 56
09:55:13.105 -> <- 12 0E 84 53 F31102 31AF6E 00 41 2A 42 40 43 43 44 38  - 13561
09:56:12.005 -> +Analog     (#1): 364
09:56:12.073 -> +Analog     (#2): 333
09:56:12.175 -> +Analog     (#3): 446
09:56:12.175 -> +Battery      V : 42
09:56:12.175 -> +Humidity (#1) %: 64
09:56:12.175 -> +Humidity (#2) %: 67
09:56:12.175 -> +Humidity (#3) %: 56
09:56:12.209 -> <- 12 0F 84 53 F31102 31AF6E 00 41 2A 42 40 43 43 44 38  - 14372
09:57:11.112 -> +Analog     (#1): 365
09:57:11.213 -> +Analog     (#2): 337
09:57:11.281 -> +Analog     (#3): 446
09:57:11.281 -> +Battery      V : 42
09:57:11.281 -> +Humidity (#1) %: 64
09:57:11.281 -> +Humidity (#2) %: 67
09:57:11.281 -> +Humidity (#3) %: 56
09:57:11.315 -> <- 12 10 84 53 F31102 31AF6E 00 41 2A 42 40 43 43 44 38  - 15181
09:58:10.246 -> +Analog     (#1): 366
09:58:10.314 -> +Analog     (#2): 333
09:58:10.382 -> +Analog     (#3): 446
09:58:10.416 -> +Battery      V : 42
09:58:10.416 -> +Humidity (#1) %: 64
09:58:10.416 -> +Humidity (#2) %: 67
09:58:10.416 -> +Humidity (#3) %: 56
09:58:10.450 -> <- 12 11 84 53 F31102 31AF6E 00 41 2A 42 40 43 43 44 38  - 15990
09:59:09.352 -> +Analog     (#1): 364
09:59:09.420 -> +Analog     (#2): 336
09:59:09.522 -> +Analog     (#3): 445
09:59:09.522 -> +Battery      V : 42
09:59:09.522 -> +Humidity (#1) %: 64
09:59:09.522 -> +Humidity (#2) %: 67
09:59:09.522 -> +Humidity (#3) %: 56
09:59:09.556 -> <- 12 12 84 53 F31102 31AF6E 00 41 2A 42 40 43 43 44 38  - 16799
10:00:08.449 -> +Analog     (#1): 364
10:00:08.551 -> +Analog     (#2): 337
10:00:08.619 -> +Analog     (#3): 446
10:00:08.619 -> +Battery      V : 42
10:00:08.619 -> +Humidity (#1) %: 64
10:00:08.653 -> +Humidity (#2) %: 67
10:00:08.653 -> +Humidity (#3) %: 56
10:00:08.653 -> <- 12 13 84 53 F31102 31AF6E 00 41 2A 42 40 43 43 44 38  - 17610
10:01:07.570 -> +Analog     (#1): 366
10:01:07.672 -> +Analog     (#2): 331
10:01:07.740 -> +Analog     (#3): 446
10:01:07.740 -> +Battery      V : 42
10:01:07.740 -> +Humidity (#1) %: 64
10:01:07.740 -> +Humidity (#2) %: 67
10:01:07.774 -> +Humidity (#3) %: 56
10:01:07.774 -> <- 12 14 84 53 F31102 31AF6E 00 41 2A 42 40 43 43 44 38  - 18419
10:02:06.709 -> +Analog     (#1): 365
10:02:06.776 -> +Analog     (#2): 334
10:02:06.879 -> +Analog     (#3): 446
10:02:06.879 -> +Battery      V : 42
10:02:06.879 -> +Humidity (#1) %: 64
10:02:06.879 -> +Humidity (#2) %: 67
10:02:06.879 -> +Humidity (#3) %: 56
Code:

Code: Alles auswählen

//- -----------------------------------------------------------------------------------------------------------------------
// AskSin++
// 2016-10-31 papa Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/
// 2019-05-03 jp112sdl Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/
// 2019-05-04 stan23 Creative Commons - http://creativecommons.org/licenses/by-nc-sa/3.0/de/
//- -----------------------------------------------------------------------------------------------------------------------

//Sensor:
//https://www.dfrobot.com/wiki/index.php/Capacitive_Soil_Moisture_Sensor_SKU:SEN0193

// define this to read the device id, serial and device type from bootloader section
// #define USE_OTA_BOOTLOADER

#define NO_DS18B20 //use model without temperature sensor

#define EI_NOTEXTERNAL
#include <EnableInterrupt.h>
#define SENSOR_ONLY

// Arduino Pro mini 8 Mhz
// Arduino pin for the config button
#define CONFIG_BUTTON_PIN      8
#define LED_PIN                4
#define BATT_EN_PIN            5
#define BATT_SENS_PIN          14  // A0

#define CC1101_GDO0_PIN        2
#define CC1101_CS_PIN          10
#define CC1101_MOSI_PIN        11
#define CC1101_MISO_PIN        12
#define CC1101_SCK_PIN         13
const uint8_t SENSOR_PINS[]    {15, 16, 17}; //AOut Pins der Sensoren (hier A1, A2 und A3)
//bei Verwendung von > 3 Sensoren sollten die Vcc der Sensoren auf 2 Enable Pins verteilt werden (max. Last pro AVR-Pin beachten!)
const uint8_t SENSOR_EN_PINS[] {6};

#define DS18B20_PIN            3


#define DEVICE_CHANNEL_COUNT sizeof(SENSOR_PINS)
#include <AskSinPP.h>
#include <LowPower.h>

#include <Register.h>
#include <MultiChannelDevice.h>

#ifndef NO_DS18B20
#include <OneWire.h>
#include <sensors/Ds18b20.h>
OneWire oneWire(DS18B20_PIN);
#endif

// number of available peers per channel
#define PEERS_PER_CHANNEL 4

// all library classes are placed in the namespace 'as'
using namespace as;

//Korrekturfaktor der Clock-Ungenauigkeit, wenn keine RTC verwendet wird
#define SYSCLOCK_FACTOR    0.88

#ifdef NO_DS18B20
#define DEVICE_MODEL  0x11
#else
#define DEVICE_MODEL  0x12
#endif

// define all device properties
const struct DeviceInfo PROGMEM devinfo = {
  {0xF3, DEVICE_MODEL, 0x02},  // Device ID
  "JPCAPM0002",                // Device Serial
  {0xF3, DEVICE_MODEL},        // Device Model
  0x10,                        // Firmware Version
  as::DeviceType::THSensor,    // Device Type
  {0x01, 0x01}                 // Info Bytes
};

/**
   Configure the used hardware
*/
typedef AvrSPI<CC1101_CS_PIN, CC1101_MOSI_PIN, CC1101_MISO_PIN, CC1101_SCK_PIN> SPIType;
typedef Radio<SPIType, CC1101_GDO0_PIN> RadioType;
typedef StatusLed<LED_PIN> LedType;
typedef AskSin<LedType, BatterySensorUni<BATT_SENS_PIN, BATT_EN_PIN, 0>, RadioType> BaseHal;
class Hal : public BaseHal {
  public:
    void init (const HMID& id) {
      BaseHal::init(id);
      battery.init(seconds2ticks(60UL * 60) * SYSCLOCK_FACTOR, sysclock); //battery measure once an hour
      battery.low(22);
      battery.critical(19);
    }

    bool runready () {
      return sysclock.runready() || BaseHal::runready();
    }
} hal;


DEFREGISTER(UReg0, MASTERID_REGS, DREG_LOWBATLIMIT, 0x21, 0x22)
class UList0 : public RegList0<UReg0> {
  public:
    UList0 (uint16_t addr) : RegList0<UReg0>(addr) {}

    bool Sendeintervall (uint16_t value) const {
      return this->writeRegister(0x21, (value >> 8) & 0xff) && this->writeRegister(0x22, value & 0xff);
    }
    uint16_t Sendeintervall () const {
      return (this->readRegister(0x21, 0) << 8) + this->readRegister(0x22, 0);
    }

    void defaults () {
      clear();
      lowBatLimit(22);
      Sendeintervall(30);
    }
};

DEFREGISTER(UReg1, 0x01, 0x02, 0x03, 0x04, 0x23, 0x24, 0x25, 0x26)
class UList1 : public RegList1<UReg1> {
  public:
    UList1 (uint16_t addr) : RegList1<UReg1>(addr) {}
    bool HIGHValue (uint16_t value) const {
      return this->writeRegister(0x23, (value >> 8) & 0xff) && this->writeRegister(0x24, value & 0xff);
    }
    uint16_t HIGHValue () const {
      return (this->readRegister(0x23, 0) << 8) + this->readRegister(0x24, 0);
    }

    bool LOWValue (uint16_t value) const {
      return this->writeRegister(0x25, (value >> 8) & 0xff) && this->writeRegister(0x26, value & 0xff);
    }
    uint16_t LOWValue () const {
      return (this->readRegister(0x25, 0) << 8) + this->readRegister(0x26, 0);
    }

#ifndef NO_DS18B20
    bool Offset (int32_t value) const {
      return
          this->writeRegister(0x01, (value >> 24) & 0xff) &&
          this->writeRegister(0x02, (value >> 16) & 0xff) &&
          this->writeRegister(0x03, (value >> 8)  & 0xff) &&
          this->writeRegister(0x04, (value)       & 0xff)
          ;
    }

    int32_t Offset () const {
      return
          ((int32_t)(this->readRegister(0x01, 0)) << 24) +
          ((int32_t)(this->readRegister(0x02, 0)) << 16) +
          ((int32_t)(this->readRegister(0x03, 0)) << 8 ) +
          ((int32_t)(this->readRegister(0x04, 0))      )
          ;
    }
#endif

    void defaults () {
      clear();
      HIGHValue(830);
      LOWValue(420);
#ifndef NO_DS18B20
      Offset(0);
#endif
    }
};

class WeatherEventMsg : public Message {
  public:
  void init(uint8_t msgcnt, uint8_t *h, bool batlow, uint8_t volt, __attribute__ ((unused))  int16_t temperature, __attribute__ ((unused))  int8_t offset) {

#ifndef NO_DS18B20
    int16_t t = temperature + offset;
    DPRINT(F("+Temp         C : ")); DDECLN(t);
#endif
    DPRINT(F("+Battery      V : ")); DDECLN(volt);
#ifdef NO_DS18B20
#define PAYLOAD_OFFSET 0
#else
#define PAYLOAD_OFFSET 2
#endif

    Message::init(0xc + PAYLOAD_OFFSET + (DEVICE_CHANNEL_COUNT * 2), msgcnt, 0x53, (msgcnt % 20 == 1) ? (BIDI | WKMEUP) : BCAST, batlow ? 0x80 : 0x00, 0x41);

#ifndef NO_DS18B20
    pload[0] = (t >> 8) & 0xff;
    pload[1] = (t)      & 0xff;
#endif

    pload[PAYLOAD_OFFSET] = (volt)   & 0xff;
    for (uint8_t s = 0; s < DEVICE_CHANNEL_COUNT; s++) {
      DPRINT(F("+Humidity (#")); DDEC(s + 1); DPRINT(F(") %: ")); DDECLN(h[s]);
      pload[1+PAYLOAD_OFFSET+(s * 2)] = 0x42 + s;
      pload[2+PAYLOAD_OFFSET+(s * 2)] = h[s] & 0xff;
    }
  }
  void init(uint8_t msgcnt, uint8_t *h, bool batlow, uint8_t volt) {
    init(msgcnt, h, batlow, volt, 0, 0);
  }
};

class WeatherChannel : public Channel<Hal, UList1, EmptyList, List4, PEERS_PER_CHANNEL, UList0> {
  public:
    WeatherChannel () : Channel() {}
    virtual ~WeatherChannel () {}

    void configChanged() {
      DPRINT(F("Config changed List1 (CH "));DDEC(number());DPRINTLN(F(")"));
#ifndef NO_DS18B20
      if (number() == 1) { DPRINT(F("*Offset    : ")); DDECLN(this->getList1().Offset()); }
#endif
      if (number() > 1)  { DPRINT(F("*HIGHValue : ")); DDECLN(this->getList1().HIGHValue()); }
      if (number() > 1)  { DPRINT(F("*LOWValue  : ")); DDECLN(this->getList1().LOWValue()); }
    }

    uint8_t status () const {
      return 0;
    }

    uint8_t flags () const {
      return 0;
    }
};

class UType : public MultiChannelDevice<Hal, WeatherChannel, DEVICE_CHANNEL_COUNT + 1, UList0> {
public:
#ifndef NO_DS18B20
  Ds18b20      sensor[1];
#endif
  class SensorArray : public Alarm {
       UType& dev;

       public:
         uint8_t       humidity[DEVICE_CHANNEL_COUNT];
         SensorArray (UType& d) : Alarm(0), dev(d) {}
         virtual ~SensorArray () {}

         void measure() {
           //enable all moisture sensors
           for (uint8_t s = 0; s < sizeof(SENSOR_EN_PINS); s++) {
             digitalWrite(SENSOR_EN_PINS[s], HIGH);
             _delay_ms(5);
           }

           //wait a moment to settle
           _delay_ms(500);
           //now measure all sensors
           for (uint8_t s = 0; s < DEVICE_CHANNEL_COUNT; s++) {
             uint16_t sens_val = 0;

             //measure 8 times and calculate average
             for (uint8_t i = 0; i < 8; i++) {
               sens_val += analogRead(SENSOR_PINS[s]);
               _delay_ms(10);
             }
             sens_val /= 8;

             DPRINT(F("+Analog     (#")); DDEC(s + 1); DPRINT(F("): ")); DDEC(sens_val);
             uint16_t upper_limit = dev.channel(s + 2).getList1().HIGHValue();
             uint16_t lower_limit = dev.channel(s + 2).getList1().LOWValue();
             if (sens_val > upper_limit) {
               humidity[s] = 0;
               DPRINTLN(F(" higher than limit!"));
             }
             else if (sens_val < lower_limit) {
               humidity[s] = 100;
               DPRINTLN(F(" lower than limit!"));
             }
             else {
               uint16_t range = upper_limit - lower_limit;
               uint16_t base = sens_val - lower_limit;
               uint8_t pct_inv = (base * 100) / range;
               humidity[s] = 100 - pct_inv;
               DPRINTLN("");
             }

             //humidity[s] = random(0,100);

           }
           //disable all moisture sensors
           for (uint8_t s = 0; s < sizeof(SENSOR_EN_PINS); s++)
             digitalWrite(SENSOR_EN_PINS[s], LOW);

#ifndef NO_DS18B20
           Ds18b20::measure(dev.sensor, 1);
#endif
         }

         virtual void trigger (__attribute__ ((unused)) AlarmClock& clock) {
           measure();
           tick = delay();
           WeatherEventMsg& msg = (WeatherEventMsg&)dev.message();
#ifndef NO_DS18B20
           msg.init(dev.nextcount(), humidity, dev.battery().low(), dev.battery().current(), dev.sensor[0].temperature(), dev.channel(1).getList1().Offset());
#else
           msg.init(dev.nextcount(), humidity, dev.battery().low(), dev.battery().current());
#endif
           dev.send(msg, dev.getMasterID());
           sysclock.add(*this);
         }

         uint32_t delay () {
           //Sendeintervall festlegen
           uint16_t _txDelay = max(dev.getList0().Sendeintervall(), 1);
           return seconds2ticks(_txDelay * 60 * SYSCLOCK_FACTOR);
         }

      } sensarray;


    typedef MultiChannelDevice<Hal, WeatherChannel, DEVICE_CHANNEL_COUNT + 1, UList0> TSDevice;
    UType(const DeviceInfo& info, uint16_t addr) : TSDevice(info, addr), sensarray(*this) {}
    virtual ~UType () {}

    void init (Hal& hal) {
      TSDevice::init(hal);
      for (uint8_t s = 0; s < DEVICE_CHANNEL_COUNT; s++)
        pinMode(SENSOR_PINS[ s ], INPUT);

      for (uint8_t s = 0; s < sizeof(SENSOR_EN_PINS); s++)
      pinMode(SENSOR_EN_PINS[s], OUTPUT);

#ifndef NO_DS18B20
      uint8_t sensorcount = Ds18b20::init(oneWire, sensor, 1);
      DPRINT(F("DS18B20 Sensor "));DPRINTLN((sensorcount > 0) ? F("OK"):F("ERROR"));
#endif
      sensarray.set(seconds2ticks(5));
      sysclock.add(sensarray);
    }

    virtual void configChanged () {
      TSDevice::configChanged();
      DPRINT(F("*LOW BAT Limit: "));
      DDECLN(this->getList0().lowBatLimit());
      this->battery().low(this->getList0().lowBatLimit());
      DPRINT(F("*Sendeintervall: ")); DDECLN(this->getList0().Sendeintervall());

    }
};

UType sdev(devinfo, 0x20);
ConfigButton<UType> cfgBtn(sdev);

void setup () {
  DINIT(57600, ASKSIN_PLUS_PLUS_IDENTIFIER);
  sdev.init(hal);
  DDEVINFO(sdev);
  buttonISR(cfgBtn, CONFIG_BUTTON_PIN);
  sdev.initDone();
}

void loop() {
  bool worked = hal.runready();
  bool poll = sdev.pollRadio();

  if ( worked == false && poll == false ) {
    if ( hal.battery.critical() ) {
      DPRINT(F("Battery critical! "));DDECLN(hal.battery.current());
      Serial.flush();
      hal.activity.sleepForever(hal);
    }
    hal.activity.savePower<Sleep<>>(hal);
  }
}
Dateianhänge
3.jpeg
2.jpeg
1.jpeg
Testreihe2 mit 3xAAA.txt
(8.3 KiB) 41-mal heruntergeladen
Testreihe1 mit 6v Akku.txt
(4.62 KiB) 42-mal heruntergeladen

jp112sdl
Beiträge: 12085
Registriert: 20.11.2016, 20:01
Hat sich bedankt: 847 Mal
Danksagung erhalten: 2139 Mal
Kontaktdaten:

Re: Bodenfeuchtesensor HB-UNI-Sen-CAP-MOIST(-T)

Beitrag von jp112sdl » 10.07.2020, 10:53

Liegt es vielleicht am NE555 ?

viewtopic.php?f=76&t=46658&p=588842#p588842

VG,
Jérôme ☕️

---
Support for my Homebrew-Devices: Download JP-HB-Devices Addon

Bengel00
Beiträge: 34
Registriert: 04.03.2015, 12:56
Hat sich bedankt: 1 Mal

Re: Bodenfeuchtesensor HB-UNI-Sen-CAP-MOIST(-T)

Beitrag von Bengel00 » 10.07.2020, 11:24

Meine Sensoren haben ein TCL5551 verbaut, sie haben ja vorher bei dem alten Feuchtesensor auch schon funktioniert. :-(
Dateianhänge
4.jpeg

FrankenKai
Beiträge: 179
Registriert: 04.05.2020, 21:31
System: CCU
Hat sich bedankt: 16 Mal
Danksagung erhalten: 8 Mal

Re: Bodenfeuchtesensor HB-UNI-Sen-CAP-MOIST(-T)

Beitrag von FrankenKai » 10.07.2020, 11:27

Mit welcher Spannung (VCC) werden die betrieben?

Antworten

Zurück zu „Hardwareentwicklung und Selbstbau von Aktoren und Sensoren“