Merge branch 'master' of github.com:0110/PlantCtrl

This commit is contained in:
Ollo 2021-06-09 19:52:23 +02:00
commit c400200e23
5 changed files with 2427 additions and 4195 deletions

File diff suppressed because it is too large Load Diff

View File

@ -297,25 +297,8 @@ F 4 "C205442" H 10650 14600 50 0001 C CNN "LCSC_PART_NUMBER"
1 10650 14600 1 10650 14600
0 -1 -1 0 0 -1 -1 0
$EndComp $EndComp
$Comp
L Device:R R31
U 1 1 5F8539E2
P 10450 14400
F 0 "R31" H 10520 14446 50 0000 L CNN
F 1 "4,7K" H 10520 14355 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 10380 14400 50 0001 C CNN
F 3 "~" H 10450 14400 50 0001 C CNN
F 4 "C17590" H 10450 14400 50 0001 C CNN "LCSC_PART_NUMBER"
1 10450 14400
0 1 1 0
$EndComp
Wire Wire Line
10650 14800 10650 14750
Wire Wire Line Wire Wire Line
10650 14400 10650 14450 10650 14400 10650 14450
Connection ~ 10300 14400
Wire Wire Line
10300 14400 10300 14550
Wire Wire Line Wire Wire Line
10600 14400 10650 14400 10600 14400 10650 14400
$Comp $Comp
@ -357,8 +340,6 @@ F 3 "~" H 9700 1750 50 0001 C CNN
$EndComp $EndComp
Text GLabel 9500 1650 1 50 Input ~ 0 Text GLabel 9500 1650 1 50 Input ~ 0
VCC VCC
Wire Wire Line
10650 15100 10650 15150
$Comp $Comp
L Device:LED Pumps1 L Device:LED Pumps1
U 1 1 5F834AFA U 1 1 5F834AFA
@ -458,17 +439,6 @@ VCC_BATT
Text GLabel 20050 6150 0 50 Input ~ 0 Text GLabel 20050 6150 0 50 Input ~ 0
VCC_BATT VCC_BATT
$Comp $Comp
L Jumper:SolderJumper_2_Bridged LED_SENS1
U 1 1 6017FFC5
P 10650 14950
F 0 "LED_SENS1" V 10604 15018 50 0000 L CNN
F 1 "NC" V 10695 15018 50 0000 L CNN
F 2 "Jumper:SolderJumper-2_P1.3mm_Bridged_Pad1.0x1.5mm" H 10650 14950 50 0001 C CNN
F 3 "~" H 10650 14950 50 0001 C CNN
1 10650 14950
0 1 1 0
$EndComp
$Comp
L Device:C_Small C13 L Device:C_Small C13
U 1 1 603684C2 U 1 1 603684C2
P 6400 2500 P 6400 2500
@ -538,8 +508,6 @@ Wire Wire Line
Connection ~ 16800 5750 Connection ~ 16800 5750
Wire Wire Line Wire Wire Line
16800 6150 16800 5750 16800 6150 16800 5750
Wire Wire Line
16500 5750 16800 5750
$Comp $Comp
L Device:C C12 L Device:C C12
U 1 1 6007356D U 1 1 6007356D
@ -552,11 +520,6 @@ F 4 "C45783" H 16800 6300 50 0001 C CNN "LCSC_PART_NUMBER"
1 16800 6300 1 16800 6300
1 0 0 -1 1 0 0 -1
$EndComp $EndComp
Connection ~ 16500 5750
Wire Wire Line
16500 5750 16450 5750
Wire Wire Line
16500 6150 16500 5750
Connection ~ 16500 6700 Connection ~ 16500 6700
Wire Wire Line Wire Wire Line
16500 6450 16500 6700 16500 6450 16500 6700
@ -574,18 +537,6 @@ F 4 "C95781" H 16500 6850 50 0001 C CNN "LCSC_PART_NUMBER"
1 16500 6850 1 16500 6850
1 0 0 -1 1 0 0 -1
$EndComp $EndComp
$Comp
L Device:R R21
U 1 1 60006701
P 16500 6300
F 0 "R21" H 16570 6346 50 0000 L CNN
F 1 "19k-19.5K" H 16570 6255 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 16430 6300 50 0001 C CNN
F 3 "~" H 16500 6300 50 0001 C CNN
F 4 "C17506" H 16500 6300 50 0001 C CNN "LCSC_PART_NUMBER"
1 16500 6300
1 0 0 -1
$EndComp
Text GLabel 17700 5750 2 50 Input ~ 0 Text GLabel 17700 5750 2 50 Input ~ 0
PUMP_PWR PUMP_PWR
Connection ~ 16150 5750 Connection ~ 16150 5750
@ -660,8 +611,6 @@ Wire Wire Line
15050 6500 15050 6100 15050 6500 15050 6100
Text Notes 5050 750 0 105 ~ 0 Text Notes 5050 750 0 105 ~ 0
One Wire One Wire
Wire Wire Line
4150 900 4150 1050
Wire Wire Line Wire Wire Line
3700 900 3700 1050 3700 900 3700 1050
Wire Wire Line Wire Wire Line
@ -685,23 +634,6 @@ Text GLabel 15800 7500 0 50 Input ~ 0
GND GND
Text GLabel 15800 7400 0 50 Input ~ 0 Text GLabel 15800 7400 0 50 Input ~ 0
GND GND
Connection ~ 4150 1350
Wire Wire Line
4150 1350 4250 1350
Wire Wire Line
4000 1350 4150 1350
$Comp
L Device:R R26
U 1 1 5EE03137
P 4150 1200
F 0 "R26" H 4220 1246 50 0000 L CNN
F 1 "2.2k" H 4220 1155 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 4080 1200 50 0001 C CNN
F 3 "~" H 4150 1200 50 0001 C CNN
F 4 "C17673" H 4150 1200 50 0001 C CNN "LCSC_PART_NUMBER"
1 4150 1200
-1 0 0 1
$EndComp
Text Notes 3200 750 0 105 ~ 0 Text Notes 3200 750 0 105 ~ 0
Temp Sensor Temp Sensor
Text GLabel 4250 1350 2 50 Input ~ 0 Text GLabel 4250 1350 2 50 Input ~ 0
@ -744,8 +676,6 @@ Wire Wire Line
6050 14500 6050 14850 6050 14500 6050 14850
Wire Wire Line Wire Wire Line
6850 14500 6850 14850 6850 14500 6850 14850
Wire Wire Line
7050 14150 7050 14200
Wire Wire Line Wire Wire Line
7050 14800 7050 14850 7050 14800 7050 14850
$Comp $Comp
@ -764,8 +694,6 @@ Text GLabel 7050 14150 2 50 Input ~ 0
GND GND
Text GLabel 7050 14850 2 50 Input ~ 0 Text GLabel 7050 14850 2 50 Input ~ 0
3_3V 3_3V
Wire Wire Line
6250 14150 6250 14200
Wire Wire Line Wire Wire Line
6250 14800 6250 14850 6250 14800 6250 14850
$Comp $Comp
@ -784,8 +712,6 @@ Text GLabel 6250 14150 2 50 Input ~ 0
GND GND
Text GLabel 6250 14850 2 50 Input ~ 0 Text GLabel 6250 14850 2 50 Input ~ 0
3_3V 3_3V
Wire Wire Line
5450 14150 5450 14200
Wire Wire Line Wire Wire Line
5450 14800 5450 14850 5450 14800 5450 14850
$Comp $Comp
@ -804,8 +730,6 @@ Text GLabel 5450 14150 2 50 Input ~ 0
GND GND
Text GLabel 5450 14850 2 50 Input ~ 0 Text GLabel 5450 14850 2 50 Input ~ 0
3_3V 3_3V
Wire Wire Line
4700 14150 4700 14200
Wire Wire Line Wire Wire Line
4700 14800 4700 14850 4700 14800 4700 14850
$Comp $Comp
@ -842,8 +766,6 @@ Text GLabel 3900 14150 2 50 Input ~ 0
GND GND
Text GLabel 3900 14850 2 50 Input ~ 0 Text GLabel 3900 14850 2 50 Input ~ 0
3_3V 3_3V
Wire Wire Line
3100 14150 3100 14200
Wire Wire Line Wire Wire Line
3100 14800 3100 14850 3100 14800 3100 14850
$Comp $Comp
@ -862,8 +784,6 @@ Text GLabel 3100 14150 2 50 Input ~ 0
GND GND
Text GLabel 3100 14850 2 50 Input ~ 0 Text GLabel 3100 14850 2 50 Input ~ 0
3_3V 3_3V
Wire Wire Line
2350 14150 2350 14200
Wire Wire Line Wire Wire Line
2350 14800 2350 14850 2350 14800 2350 14850
$Comp $Comp
@ -896,19 +816,19 @@ Text GLabel 3000 15150 3 50 Input ~ 0
GND GND
Text GLabel 2250 15150 3 50 Input ~ 0 Text GLabel 2250 15150 3 50 Input ~ 0
GND GND
Text GLabel 6950 13800 3 50 Input ~ 0 Text GLabel 6650 14500 3 50 Input ~ 0
GND GND
Text GLabel 6150 13800 3 50 Input ~ 0 Text GLabel 5850 14500 3 50 Input ~ 0
GND GND
Text GLabel 5350 13800 3 50 Input ~ 0 Text GLabel 5050 14500 3 50 Input ~ 0
GND GND
Text GLabel 4600 13800 3 50 Input ~ 0 Text GLabel 4300 14500 3 50 Input ~ 0
GND GND
Text GLabel 3800 13800 3 50 Input ~ 0 Text GLabel 3500 14500 3 50 Input ~ 0
GND GND
Text GLabel 3000 13800 3 50 Input ~ 0 Text GLabel 2700 14500 3 50 Input ~ 0
GND GND
Text GLabel 2300 13750 3 50 Input ~ 0 Text GLabel 2000 14500 3 50 Input ~ 0
GND GND
Text GLabel 9250 12100 3 50 Input ~ 0 Text GLabel 9250 12100 3 50 Input ~ 0
GND GND
@ -1034,49 +954,49 @@ $EndComp
$Comp $Comp
L Device:R R41 L Device:R R41
U 1 1 5F99C5A6 U 1 1 5F99C5A6
P 4400 13900 P 4400 14350
F 0 "R41" H 4470 13946 50 0000 L CNN F 0 "R41" H 4470 14396 50 0000 L CNN
F 1 "1k" H 4470 13855 50 0000 L CNN F 1 "1k" H 4470 14305 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 4330 13900 50 0001 C CNN F 2 "Resistor_SMD:R_0805_2012Metric" V 4330 14350 50 0001 C CNN
F 3 "~" H 4400 13900 50 0001 C CNN F 3 "~" H 4400 14350 50 0001 C CNN
F 4 "C95781" H 4400 13900 50 0001 C CNN "LCSC_PART_NUMBER" F 4 "C95781" H 4400 14350 50 0001 C CNN "LCSC_PART_NUMBER"
1 4400 13900 1 4400 14350
1 0 0 -1 1 0 0 -1
$EndComp $EndComp
$Comp $Comp
L Device:R R43 L Device:R R43
U 1 1 5F99C828 U 1 1 5F99C828
P 5150 13900 P 5150 14350
F 0 "R43" H 5220 13946 50 0000 L CNN F 0 "R43" H 5220 14396 50 0000 L CNN
F 1 "1k" H 5220 13855 50 0000 L CNN F 1 "1k" H 5220 14305 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 5080 13900 50 0001 C CNN F 2 "Resistor_SMD:R_0805_2012Metric" V 5080 14350 50 0001 C CNN
F 3 "~" H 5150 13900 50 0001 C CNN F 3 "~" H 5150 14350 50 0001 C CNN
F 4 "C95781" H 5150 13900 50 0001 C CNN "LCSC_PART_NUMBER" F 4 "C95781" H 5150 14350 50 0001 C CNN "LCSC_PART_NUMBER"
1 5150 13900 1 5150 14350
1 0 0 -1 1 0 0 -1
$EndComp $EndComp
$Comp $Comp
L Device:R R45 L Device:R R45
U 1 1 5F99CBD3 U 1 1 5F99CBD3
P 5950 13900 P 5950 14350
F 0 "R45" H 6020 13946 50 0000 L CNN F 0 "R45" H 6020 14396 50 0000 L CNN
F 1 "1k" H 6020 13855 50 0000 L CNN F 1 "1k" H 6020 14305 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 5880 13900 50 0001 C CNN F 2 "Resistor_SMD:R_0805_2012Metric" V 5880 14350 50 0001 C CNN
F 3 "~" H 5950 13900 50 0001 C CNN F 3 "~" H 5950 14350 50 0001 C CNN
F 4 "C95781" H 5950 13900 50 0001 C CNN "LCSC_PART_NUMBER" F 4 "C95781" H 5950 14350 50 0001 C CNN "LCSC_PART_NUMBER"
1 5950 13900 1 5950 14350
1 0 0 -1 1 0 0 -1
$EndComp $EndComp
$Comp $Comp
L Device:R R49 L Device:R R49
U 1 1 5F99CEF5 U 1 1 5F99CEF5
P 6750 13900 P 6750 14350
F 0 "R49" H 6820 13946 50 0000 L CNN F 0 "R49" H 6820 14396 50 0000 L CNN
F 1 "1k" H 6820 13855 50 0000 L CNN F 1 "1k" H 6820 14305 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 6680 13900 50 0001 C CNN F 2 "Resistor_SMD:R_0805_2012Metric" V 6680 14350 50 0001 C CNN
F 3 "~" H 6750 13900 50 0001 C CNN F 3 "~" H 6750 14350 50 0001 C CNN
F 4 "C95781" H 6750 13900 50 0001 C CNN "LCSC_PART_NUMBER" F 4 "C95781" H 6750 14350 50 0001 C CNN "LCSC_PART_NUMBER"
1 6750 13900 1 6750 14350
1 0 0 -1 1 0 0 -1
$EndComp $EndComp
$Comp $Comp
@ -1225,37 +1145,37 @@ Wire Wire Line
$Comp $Comp
L Device:R R39 L Device:R R39
U 1 1 5F99C2BC U 1 1 5F99C2BC
P 3600 13900 P 3600 14350
F 0 "R39" H 3670 13946 50 0000 L CNN F 0 "R39" H 3670 14396 50 0000 L CNN
F 1 "1k" H 3670 13855 50 0000 L CNN F 1 "1k" H 3670 14305 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 3530 13900 50 0001 C CNN F 2 "Resistor_SMD:R_0805_2012Metric" V 3530 14350 50 0001 C CNN
F 3 "~" H 3600 13900 50 0001 C CNN F 3 "~" H 3600 14350 50 0001 C CNN
F 4 "C95781" H 3600 13900 50 0001 C CNN "LCSC_PART_NUMBER" F 4 "C95781" H 3600 14350 50 0001 C CNN "LCSC_PART_NUMBER"
1 3600 13900 1 3600 14350
1 0 0 -1 1 0 0 -1
$EndComp $EndComp
$Comp $Comp
L Device:R R37 L Device:R R37
U 1 1 5F99BE26 U 1 1 5F99BE26
P 2800 13900 P 2800 14350
F 0 "R37" H 2870 13946 50 0000 L CNN F 0 "R37" H 2870 14396 50 0000 L CNN
F 1 "1k" H 2870 13855 50 0000 L CNN F 1 "1k" H 2870 14305 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 2730 13900 50 0001 C CNN F 2 "Resistor_SMD:R_0805_2012Metric" V 2730 14350 50 0001 C CNN
F 3 "~" H 2800 13900 50 0001 C CNN F 3 "~" H 2800 14350 50 0001 C CNN
F 4 "C95781" H 2800 13900 50 0001 C CNN "LCSC_PART_NUMBER" F 4 "C95781" H 2800 14350 50 0001 C CNN "LCSC_PART_NUMBER"
1 2800 13900 1 2800 14350
1 0 0 -1 1 0 0 -1
$EndComp $EndComp
$Comp $Comp
L Device:R R35 L Device:R R35
U 1 1 5F993C00 U 1 1 5F993C00
P 2100 13900 P 2100 14350
F 0 "R35" H 2170 13946 50 0000 L CNN F 0 "R35" H 2170 14396 50 0000 L CNN
F 1 "1k" H 2170 13855 50 0000 L CNN F 1 "1k" H 2170 14305 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 2030 13900 50 0001 C CNN F 2 "Resistor_SMD:R_0805_2012Metric" V 2030 14350 50 0001 C CNN
F 3 "~" H 2100 13900 50 0001 C CNN F 3 "~" H 2100 14350 50 0001 C CNN
F 4 "C95781" H 2100 13900 50 0001 C CNN "LCSC_PART_NUMBER" F 4 "C95781" H 2100 14350 50 0001 C CNN "LCSC_PART_NUMBER"
1 2100 13900 1 2100 14350
1 0 0 -1 1 0 0 -1
$EndComp $EndComp
Wire Wire Line Wire Wire Line
@ -1945,8 +1865,6 @@ Wire Wire Line
Wire Wire Line Wire Wire Line
10650 14250 10300 14250 10650 14250 10300 14250
Connection ~ 10300 14250 Connection ~ 10300 14250
Wire Wire Line
10300 14250 10300 14400
Wire Notes Line Wire Notes Line
13500 1000 22550 1000 13500 1000 22550 1000
Wire Notes Line Wire Notes Line
@ -2125,20 +2043,7 @@ F 4 "C45783" H 9800 5900 50 0001 C CNN "LCSC_PART_NUMBER"
$EndComp $EndComp
Text GLabel 9800 6050 3 50 Input ~ 0 Text GLabel 9800 6050 3 50 Input ~ 0
GND GND
Text GLabel 3950 4050 0 50 Input ~ 0 Text GLabel 3950 3850 0 50 Input ~ 0
PWR_SENSORS
$Comp
L Connector_Generic:Conn_01x04 Hall1
U 1 1 5F9D6D22
P 4200 3850
F 0 "Hall1" H 4280 3842 50 0000 L CNN
F 1 "Conn_01x04" H 4000 3550 50 0000 L CNN
F 2 "ESP32:SR04M-2PinHeader_1x04_P2.54mm_Vertical" H 4200 3850 50 0001 C CNN
F 3 "~" H 4200 3850 50 0001 C CNN
1 4200 3850
1 0 0 -1
$EndComp
Text GLabel 3950 3750 0 50 Input ~ 0
GND GND
Wire Wire Line Wire Wire Line
3950 3850 4000 3850 3950 3850 4000 3850
@ -2286,7 +2191,7 @@ Wire Wire Line
11650 5450 11650 5750 11650 5450 11650 5750
Wire Wire Line Wire Wire Line
11950 5450 12050 5450 11950 5450 12050 5450
Text GLabel 12050 5450 2 50 Input ~ 0 Text GLabel 12350 5450 2 50 Input ~ 0
3_3V 3_3V
NoConn ~ 10100 7150 NoConn ~ 10100 7150
NoConn ~ 10100 7250 NoConn ~ 10100 7250
@ -2508,10 +2413,10 @@ Wire Wire Line
Wire Wire Line Wire Wire Line
11300 5750 11650 5750 11300 5750 11650 5750
$Comp $Comp
L Connector:Conn_01x04_Female I2C1 L Connector:Conn_01x04_Female Custom1
U 1 1 607BAC29 U 1 1 607BAC29
P 12550 7950 P 12550 7950
F 0 "I2C1" H 12578 7926 50 0000 L CNN F 0 "Custom1" H 12578 7926 50 0000 L CNN
F 1 "Conn_01x04_Female" H 12578 7835 50 0000 L CNN F 1 "Conn_01x04_Female" H 12578 7835 50 0000 L CNN
F 2 "Connector_JST:JST_EH_B4B-EH-A_1x04_P2.50mm_Vertical" H 12550 7950 50 0001 C CNN F 2 "Connector_JST:JST_EH_B4B-EH-A_1x04_P2.50mm_Vertical" H 12550 7950 50 0001 C CNN
F 3 "~" H 12550 7950 50 0001 C CNN F 3 "~" H 12550 7950 50 0001 C CNN
@ -2531,8 +2436,6 @@ GND
Wire Wire Line Wire Wire Line
9600 15250 9600 15300 9600 15250 9600 15300
Connection ~ 9600 15250 Connection ~ 9600 15250
Wire Wire Line
3900 14200 3900 14150
$Comp $Comp
L ds2438:ds2438az+ U2 L ds2438:ds2438az+ U2
U 1 1 609FCF0F U 1 1 609FCF0F
@ -2615,9 +2518,6 @@ Wire Wire Line
Connection ~ 21850 7700 Connection ~ 21850 7700
Wire Wire Line Wire Wire Line
11300 6350 11400 6350 11300 6350 11400 6350
Connection ~ 3700 900
Wire Wire Line
3700 900 4150 900
Text GLabel 1700 10850 1 50 Input ~ 0 Text GLabel 1700 10850 1 50 Input ~ 0
PWR_PUMP_CONVERTER PWR_PUMP_CONVERTER
Text GLabel 2900 10850 1 50 Input ~ 0 Text GLabel 2900 10850 1 50 Input ~ 0
@ -2673,9 +2573,9 @@ F 4 "C503217" H 17000 6300 50 0001 C CNN "LCSC_PART_NUMBER"
1 0 0 -1 1 0 0 -1
$EndComp $EndComp
Text GLabel 11400 6750 2 50 Input ~ 0 Text GLabel 11400 6750 2 50 Input ~ 0
HALL_TX SCL
Text GLabel 3950 3850 0 50 Input ~ 0 Text GLabel 3500 4250 0 50 Input ~ 0
HALL_TX SDA
Text GLabel 11400 5850 2 50 Input ~ 0 Text GLabel 11400 5850 2 50 Input ~ 0
ESP_TX ESP_TX
Text GLabel 11400 6050 2 50 Input ~ 0 Text GLabel 11400 6050 2 50 Input ~ 0
@ -2684,8 +2584,8 @@ Wire Wire Line
11300 5850 11400 5850 11300 5850 11400 5850
Wire Wire Line Wire Wire Line
11300 6050 11400 6050 11300 6050 11400 6050
Text Notes 2950 3300 0 105 ~ 0 Text Notes 3650 3500 0 105 ~ 0
Hall Sensor Serial2|Trigger/Echo I2C
Wire Wire Line Wire Wire Line
10550 4850 10650 4850 10550 4850 10650 4850
Wire Wire Line Wire Wire Line
@ -2730,22 +2630,16 @@ Wire Wire Line
21850 7500 21850 7250 21850 7500 21850 7250
Wire Wire Line Wire Wire Line
8850 5750 8850 5450 8850 5750 8850 5450
Text Notes 3800 3650 0 39 ~ 8
JSN-SR04T-2.0\nIO16 RX\nIO17 TX
Text GLabel 11400 6850 2 50 Input ~ 0 Text GLabel 11400 6850 2 50 Input ~ 0
HALL_RX SDA
Wire Wire Line Wire Wire Line
11300 6750 11400 6750 11300 6750 11400 6750
Wire Wire Line Wire Wire Line
11300 6550 11400 6550 11300 6550 11400 6550
Text GLabel 3950 3950 0 50 Input ~ 0 Text GLabel 3300 4100 0 50 Input ~ 0
HALL_RX SCL
Wire Wire Line Wire Wire Line
3950 3950 4000 3950 3950 3950 4000 3950
Wire Wire Line
3950 3750 4000 3750
Wire Wire Line
4000 4050 3950 4050
Text GLabel 9050 1550 1 50 Input ~ 0 Text GLabel 9050 1550 1 50 Input ~ 0
3_3V 3_3V
Text GLabel 8200 1550 0 50 Input ~ 0 Text GLabel 8200 1550 0 50 Input ~ 0
@ -3194,39 +3088,482 @@ Text GLabel 1550 3750 2 50 Input ~ 0
ESP_RX ESP_RX
Text GLabel 1550 3650 2 50 Input ~ 0 Text GLabel 1550 3650 2 50 Input ~ 0
ESP_TX ESP_TX
Wire Wire Line
2100 14050 2100 14500
Wire Wire Line Wire Wire Line
2100 14500 2150 14500 2100 14500 2150 14500
Connection ~ 2150 14500 Connection ~ 2150 14500
Wire Wire Line
2800 14050 2800 14500
Wire Wire Line Wire Wire Line
2800 14500 2900 14500 2800 14500 2900 14500
Connection ~ 2900 14500 Connection ~ 2900 14500
Wire Wire Line
3600 14050 3600 14500
Wire Wire Line Wire Wire Line
3600 14500 3700 14500 3600 14500 3700 14500
Connection ~ 3700 14500 Connection ~ 3700 14500
Wire Wire Line Wire Wire Line
4500 14500 4400 14500 4500 14500 4400 14500
Wire Wire Line
4400 14500 4400 14050
Connection ~ 4500 14500 Connection ~ 4500 14500
Wire Wire Line
5950 14050 5950 14500
Wire Wire Line Wire Wire Line
5950 14500 6050 14500 5950 14500 6050 14500
Connection ~ 6050 14500 Connection ~ 6050 14500
Wire Wire Line Wire Wire Line
6850 14500 6750 14500 6850 14500 6750 14500
Wire Wire Line
6750 14500 6750 14050
Connection ~ 6850 14500 Connection ~ 6850 14500
Wire Wire Line
5150 14050 5150 14500
Wire Wire Line Wire Wire Line
5150 14500 5250 14500 5150 14500 5250 14500
Connection ~ 5250 14500 Connection ~ 5250 14500
$Comp
L Device:R R20
U 1 1 60BC1F44
P 2000 14350
F 0 "R20" H 2070 14396 50 0000 L CNN
F 1 "100k" H 2070 14305 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 1930 14350 50 0001 C CNN
F 3 "~" H 2000 14350 50 0001 C CNN
F 4 "C95781" H 2000 14350 50 0001 C CNN "LCSC_PART_NUMBER"
1 2000 14350
-1 0 0 1
$EndComp
Wire Wire Line
2000 14200 2100 14200
Wire Wire Line
2100 14200 2100 13750
Connection ~ 2100 14200
Wire Wire Line
2350 13750 2300 13750
Wire Wire Line
2350 13750 2350 14200
$Comp
L Device:R R56
U 1 1 60C29A59
P 2700 14350
F 0 "R56" H 2770 14396 50 0000 L CNN
F 1 "100k" H 2770 14305 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 2630 14350 50 0001 C CNN
F 3 "~" H 2700 14350 50 0001 C CNN
F 4 "C95781" H 2700 14350 50 0001 C CNN "LCSC_PART_NUMBER"
1 2700 14350
-1 0 0 1
$EndComp
Wire Wire Line
3100 13800 3000 13800
Wire Wire Line
3100 13800 3100 14200
Wire Wire Line
2700 14200 2800 14200
Wire Wire Line
2800 13750 2800 14200
Connection ~ 2800 14200
Wire Wire Line
4300 14200 4400 14200
Wire Wire Line
4400 14200 4400 13750
Connection ~ 4400 14200
Wire Wire Line
4700 13800 4600 13800
Wire Wire Line
4700 13800 4700 14200
Wire Wire Line
7050 13800 6950 13800
Wire Wire Line
7050 13800 7050 14200
Wire Wire Line
6250 13800 6150 13800
Wire Wire Line
6250 13800 6250 14200
Wire Wire Line
5450 13800 5350 13800
Wire Wire Line
5450 13800 5450 14200
Wire Wire Line
3500 14200 3600 14200
Wire Wire Line
3600 14200 3600 13750
Connection ~ 3600 14200
Wire Wire Line
5050 14200 5150 14200
Wire Wire Line
5150 14200 5150 13750
Connection ~ 5150 14200
Wire Wire Line
5850 14200 5950 14200
Wire Wire Line
5950 14200 5950 13750
Connection ~ 5950 14200
Wire Wire Line
6650 14200 6750 14200
Wire Wire Line
6750 13750 6750 14200
Connection ~ 6750 14200
$Comp
L Device:R R57
U 1 1 60E91322
P 3500 14350
F 0 "R57" H 3570 14396 50 0000 L CNN
F 1 "100k" H 3570 14305 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 3430 14350 50 0001 C CNN
F 3 "~" H 3500 14350 50 0001 C CNN
F 4 "C95781" H 3500 14350 50 0001 C CNN "LCSC_PART_NUMBER"
1 3500 14350
-1 0 0 1
$EndComp
$Comp
L Device:R R58
U 1 1 60E9171D
P 4300 14350
F 0 "R58" H 4370 14396 50 0000 L CNN
F 1 "100k" H 4370 14305 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 4230 14350 50 0001 C CNN
F 3 "~" H 4300 14350 50 0001 C CNN
F 4 "C95781" H 4300 14350 50 0001 C CNN "LCSC_PART_NUMBER"
1 4300 14350
-1 0 0 1
$EndComp
$Comp
L Device:R R60
U 1 1 60E91AB4
P 5050 14350
F 0 "R60" H 5120 14396 50 0000 L CNN
F 1 "100k" H 5120 14305 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 4980 14350 50 0001 C CNN
F 3 "~" H 5050 14350 50 0001 C CNN
F 4 "C95781" H 5050 14350 50 0001 C CNN "LCSC_PART_NUMBER"
1 5050 14350
-1 0 0 1
$EndComp
$Comp
L Device:R R61
U 1 1 60E91D47
P 5850 14350
F 0 "R61" H 5920 14396 50 0000 L CNN
F 1 "100k" H 5920 14305 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 5780 14350 50 0001 C CNN
F 3 "~" H 5850 14350 50 0001 C CNN
F 4 "C95781" H 5850 14350 50 0001 C CNN "LCSC_PART_NUMBER"
1 5850 14350
-1 0 0 1
$EndComp
$Comp
L Device:R R62
U 1 1 60E9212E
P 6650 14350
F 0 "R62" H 6720 14396 50 0000 L CNN
F 1 "100k" H 6720 14305 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 6580 14350 50 0001 C CNN
F 3 "~" H 6650 14350 50 0001 C CNN
F 4 "C95781" H 6650 14350 50 0001 C CNN "LCSC_PART_NUMBER"
1 6650 14350
-1 0 0 1
$EndComp
Wire Wire Line
3900 13800 3800 13800
Wire Wire Line
3900 13800 3900 14200
$Comp
L Device:R R63
U 1 1 60ECE989
P 4100 1200
F 0 "R63" H 4170 1246 50 0000 L CNN
F 1 "1k" H 4170 1155 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 4030 1200 50 0001 C CNN
F 3 "~" H 4100 1200 50 0001 C CNN
F 4 "C95781" H 4100 1200 50 0001 C CNN "LCSC_PART_NUMBER"
1 4100 1200
1 0 0 -1
$EndComp
Wire Wire Line
4000 1350 4100 1350
Connection ~ 4100 1350
Wire Wire Line
4100 1350 4250 1350
$Comp
L Device:R R26
U 1 1 60ECF5FB
P 3850 900
F 0 "R26" H 3920 946 50 0000 L CNN
F 1 "1k" H 3920 855 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 3780 900 50 0001 C CNN
F 3 "~" H 3850 900 50 0001 C CNN
F 4 "C95781" H 3850 900 50 0001 C CNN "LCSC_PART_NUMBER"
1 3850 900
0 1 1 0
$EndComp
Connection ~ 3700 900
Wire Wire Line
4100 1050 4100 900
Wire Wire Line
4100 900 4000 900
Wire Wire Line
10300 14250 10300 14350
$Comp
L Device:R R31
U 1 1 60EF6C81
P 10450 14350
F 0 "R31" H 10520 14396 50 0000 L CNN
F 1 "10k" H 10520 14305 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 10380 14350 50 0001 C CNN
F 3 "~" H 10450 14350 50 0001 C CNN
F 4 "C212284" H 10450 14350 50 0001 C CNN "LCSC_PART_NUMBER"
1 10450 14350
0 1 1 0
$EndComp
Connection ~ 10300 14350
Wire Wire Line
10300 14350 10300 14450
$Comp
L Device:R R64
U 1 1 60EF71EA
P 10450 14450
F 0 "R64" H 10520 14496 50 0000 L CNN
F 1 "10k" H 10520 14405 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 10380 14450 50 0001 C CNN
F 3 "~" H 10450 14450 50 0001 C CNN
F 4 "C212284" H 10450 14450 50 0001 C CNN "LCSC_PART_NUMBER"
1 10450 14450
0 1 1 0
$EndComp
Connection ~ 10300 14450
Wire Wire Line
10300 14450 10300 14550
Wire Wire Line
10600 14350 10600 14400
Connection ~ 10600 14400
Wire Wire Line
10600 14400 10600 14450
Wire Wire Line
16450 5750 16500 5750
$Comp
L Device:R R65
U 1 1 60F5A9A8
P 16500 6300
F 0 "R65" H 16570 6346 50 0000 L CNN
F 1 "10k" H 16570 6255 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 16430 6300 50 0001 C CNN
F 3 "~" H 16500 6300 50 0001 C CNN
F 4 "C212284" H 16500 6300 50 0001 C CNN "LCSC_PART_NUMBER"
1 16500 6300
1 0 0 -1
$EndComp
$Comp
L Device:R R21
U 1 1 60F5B465
P 16500 6000
F 0 "R21" H 16570 6046 50 0000 L CNN
F 1 "10k" H 16570 5955 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 16430 6000 50 0001 C CNN
F 3 "~" H 16500 6000 50 0001 C CNN
F 4 "C212284" H 16500 6000 50 0001 C CNN "LCSC_PART_NUMBER"
1 16500 6000
1 0 0 -1
$EndComp
Wire Wire Line
16500 5850 16500 5750
Connection ~ 16500 5750
Wire Wire Line
16500 5750 16800 5750
$Comp
L Device:R R66
U 1 1 60BFAB84
P 12200 5450
F 0 "R66" V 11993 5450 50 0000 C CNN
F 1 "1k" V 12084 5450 50 0000 C CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 12130 5450 50 0001 C CNN
F 3 "~" H 12200 5450 50 0001 C CNN
F 4 "C212284" H 12200 5450 50 0001 C CNN "LCSC_PART_NUMBER"
1 12200 5450
0 -1 -1 0
$EndComp
$Comp
L Connector_Generic:Conn_01x04 I2C1
U 1 1 60C08BAC
P 4200 3850
F 0 "I2C1" H 4280 3842 50 0000 L CNN
F 1 "Conn_01x04" H 4280 3751 50 0000 L CNN
F 2 "Connector_JST:JST_EH_B4B-EH-A_1x04_P2.50mm_Vertical" H 4200 3850 50 0001 C CNN
F 3 "~" H 4200 3850 50 0001 C CNN
1 4200 3850
1 0 0 -1
$EndComp
$Comp
L Device:R R67
U 1 1 60C19E10
P 3400 3900
F 0 "R67" H 3470 3946 50 0000 L CNN
F 1 "R" H 3470 3855 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 3330 3900 50 0001 C CNN
F 3 "~" H 3400 3900 50 0001 C CNN
1 3400 3900
1 0 0 -1
$EndComp
$Comp
L Device:R R68
U 1 1 60C1A741
P 3550 3900
F 0 "R68" H 3620 3946 50 0000 L CNN
F 1 "R" H 3620 3855 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 3480 3900 50 0001 C CNN
F 3 "~" H 3550 3900 50 0001 C CNN
1 3550 3900
1 0 0 -1
$EndComp
Wire Wire Line
3500 4250 3550 4250
Wire Wire Line
3550 4250 3550 4050
Wire Wire Line
3550 4050 4000 4050
Connection ~ 3550 4050
Wire Wire Line
3300 4100 3400 4100
Wire Wire Line
3400 4100 3400 4050
Wire Wire Line
3400 4100 3950 4100
Wire Wire Line
3950 4100 3950 3950
Connection ~ 3400 4100
Wire Wire Line
3400 3750 3550 3750
Connection ~ 3550 3750
Wire Wire Line
3550 3750 4000 3750
Text GLabel 14450 13950 3 50 Input ~ 0
3_3V
Wire Wire Line
13500 14300 13500 14600
Connection ~ 13500 14300
Wire Wire Line
13850 14300 13500 14300
Wire Wire Line
13850 14150 13850 14300
Wire Wire Line
14150 14150 13850 14150
Wire Wire Line
13500 14200 13500 14300
Text GLabel 13800 13950 0 50 Input ~ 0
GND
$Comp
L Diode:BAS40-04 D29
U 1 1 60CF85CE
P 14150 14050
F 0 "D29" H 14150 14375 50 0000 C CNN
F 1 "BAS40-04" H 14150 14284 50 0000 C CNN
F 2 "Package_TO_SOT_SMD:SOT-23" H 13900 14350 50 0001 L CNN
F 3 "http://www.vishay.com/docs/85701/bas40v.pdf" H 14030 14150 50 0001 C CNN
F 4 "C397601" H 14150 14050 50 0001 C CNN "LCSC_PART_NUMBER"
1 14150 14050
1 0 0 -1
$EndComp
Wire Wire Line
13800 13950 13850 13950
Connection ~ 13500 15000
Wire Wire Line
13350 15000 13350 15100
Wire Wire Line
13350 15000 13500 15000
Wire Wire Line
13350 15100 13200 15100
Wire Wire Line
13500 15050 13500 15000
Text GLabel 13500 15050 3 50 Input ~ 0
3_3V
Connection ~ 13200 14800
$Comp
L Device:R R72
U 1 1 60CF85A1
P 13200 14950
F 0 "R72" H 13270 14996 50 0000 L CNN
F 1 "10k" H 13270 14905 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 13130 14950 50 0001 C CNN
F 3 "~" H 13200 14950 50 0001 C CNN
F 4 "C212284" H 13200 14950 50 0001 C CNN "LCSC_PART_NUMBER"
1 13200 14950
1 0 0 -1
$EndComp
Text GLabel 13500 14200 1 50 Input ~ 0
PWR_I2C
Wire Wire Line
13150 14800 13200 14800
$Comp
L Transistor_FET:BSS84 Q_PWR4
U 1 1 60CF8589
P 13400 14800
F 0 "Q_PWR4" H 13604 14846 50 0000 L CNN
F 1 "P-channel 50v 4A" H 13604 14755 50 0000 L CNN
F 2 "Package_TO_SOT_SMD:SOT-23" H 13600 14725 50 0001 L CIN
F 3 "" H 13400 14800 50 0001 L CNN
F 4 "" H 13400 14800 50 0001 C CNN "LCSC_PART_NUMBER"
1 13400 14800
1 0 0 -1
$EndComp
$Comp
L Device:R R71
U 1 1 60CF85E1
P 13000 14800
F 0 "R71" H 13070 14846 50 0000 L CNN
F 1 "1k" H 13070 14755 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 12930 14800 50 0001 C CNN
F 3 "~" H 13000 14800 50 0001 C CNN
F 4 "C95781" H 13000 14800 50 0001 C CNN "LCSC_PART_NUMBER"
1 13000 14800
0 1 1 0
$EndComp
Text GLabel 12800 15350 3 50 Input ~ 0
GND
Wire Wire Line
12800 15300 12800 15350
Wire Wire Line
12800 15300 12800 15200
Connection ~ 12800 15300
Wire Wire Line
12500 15300 12800 15300
Wire Wire Line
12050 15000 12100 15000
$Comp
L Device:R R69
U 1 1 60CF85BD
P 12250 15000
F 0 "R69" H 12320 15046 50 0000 L CNN
F 1 "1k" H 12320 14955 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 12180 15000 50 0001 C CNN
F 3 "~" H 12250 15000 50 0001 C CNN
F 4 "C95781" H 12250 15000 50 0001 C CNN "LCSC_PART_NUMBER"
1 12250 15000
0 1 1 0
$EndComp
Wire Wire Line
12400 15000 12500 15000
Text GLabel 12050 15000 0 50 Input ~ 0
SENSORS_ENABLE
Wire Wire Line
12850 14800 12800 14800
$Comp
L Device:R R70
U 1 1 60CF8597
P 12500 15150
F 0 "R70" H 12570 15196 50 0000 L CNN
F 1 "10k" H 12570 15105 50 0000 L CNN
F 2 "Resistor_SMD:R_0805_2012Metric" V 12430 15150 50 0001 C CNN
F 3 "~" H 12500 15150 50 0001 C CNN
F 4 "C212284" H 12500 15150 50 0001 C CNN "LCSC_PART_NUMBER"
1 12500 15150
1 0 0 -1
$EndComp
Connection ~ 12500 15000
$Comp
L ESP32-DEVKITC-32D:SL2300 Q12
U 1 1 60CF8590
P 12750 15000
F 0 "Q12" H 12905 15046 50 0000 L CNN
F 1 "N-channel 30V 5A" H 12905 14955 50 0000 L CNN
F 2 "Package_TO_SOT_SMD:SOT-23" H 12750 15000 50 0001 C CNN
F 3 "" H 12750 15000 50 0001 C CNN
F 4 "C350314" H 12750 15000 50 0001 C CNN "LCSC_PART_NUMBER"
1 12750 15000
1 0 0 -1
$EndComp
Text GLabel 3350 3750 0 50 Input ~ 0
PWR_I2C
Wire Wire Line
3350 3750 3400 3750
Connection ~ 3400 3750
Wire Wire Line
10650 14750 10650 15150
$EndSCHEMATC $EndSCHEMATC

View File

@ -71,8 +71,8 @@
#define BUTTON GPIO_NUM_0 /**< GPIO 0 - Fix button of NodeMCU */ #define BUTTON GPIO_NUM_0 /**< GPIO 0 - Fix button of NodeMCU */
#define CUSTOM1_PIN3 GPIO_NUM_2 /**< GPIO 2 - Custom GPIO controlling a MOSFET, connected to GND */ #define CUSTOM1_PIN3 GPIO_NUM_2 /**< GPIO 2 - Custom GPIO controlling a MOSFET, connected to GND */
#define CUSTOM1_PIN2 GPIO_NUM_12 /**< GPIO 4 - custom GPIO directly connected to GPIO header */ #define CUSTOM1_PIN2 GPIO_NUM_12 /**< GPIO 4 - custom GPIO directly connected to GPIO header */
#define I2C1_PIN2 GPIO_NUM_34 /**< GPIO 34 - I2C */ #define I2C1_SDA GPIO_NUM_34 /**< GPIO 34 - I2C */
#define I2C1_PIN3 GPIO_NUM_35 /**< GPIO 35 - I2C */ #define I2C1_SCL GPIO_NUM_35 /**< GPIO 35 - I2C */
/* @} */ /* @} */
/** \addtogroup Configuration /** \addtogroup Configuration

View File

@ -19,6 +19,7 @@ board_build.partitions = defaultWithSmallerSpiffs.csv
lib_deps = ArduinoJson@6.16.1 lib_deps = ArduinoJson@6.16.1
OneWire OneWire
DallasTemperature DallasTemperature
pololu/VL53L0X
https://github.com/homieiot/homie-esp8266.git#develop https://github.com/homieiot/homie-esp8266.git#develop
[platformio] [platformio]

View File

@ -28,6 +28,8 @@
#include "DS2438.h" #include "DS2438.h"
#include "soc/soc.h" #include "soc/soc.h"
#include "soc/rtc_cntl_reg.h" #include "soc/rtc_cntl_reg.h"
#include <Wire.h>
#include <VL53L0X.h>
/****************************************************************************** /******************************************************************************
* DEFINES * DEFINES
@ -82,6 +84,7 @@ unsigned long setupFinishedTimestamp;
OneWire oneWire(SENSOR_ONEWIRE); OneWire oneWire(SENSOR_ONEWIRE);
DallasTemperature sensors(&oneWire); DallasTemperature sensors(&oneWire);
DS2438 battery(&oneWire, 0.0333333f, AMOUNT_SENOR_QUERYS); DS2438 battery(&oneWire, 0.0333333f, AMOUNT_SENOR_QUERYS);
VL53L0X tankSensor;
Plant mPlants[MAX_PLANTS] = { Plant mPlants[MAX_PLANTS] = {
Plant(SENSOR_PLANT0, OUTPUT_PUMP0, 0, &plant0, &mSetting0), Plant(SENSOR_PLANT0, OUTPUT_PUMP0, 0, &plant0, &mSetting0),
@ -211,7 +214,8 @@ void readOneWireSensors(bool withMQTT)
} }
} }
if(!valid){ if (!valid)
{
//wrong family or crc errors on each retry //wrong family or crc errors on each retry
continue; continue;
} }
@ -230,7 +234,7 @@ void readOneWireSensors(bool withMQTT)
if (valid) if (valid)
{ {
Serial << "DS18S20 Temperatur " << String(buf) << " : " << temp << " °C " << endl; Serial << "DS18S20 Temperatur " << String(buf) << " : " << temp << " °C " << endl;
if (strcmp(lipoSensorAddr.get(),buf) == 0) if (strcmp(lipoSensorAddr.get(), buf) == 0)
{ {
if (withMQTT) if (withMQTT)
{ {
@ -238,7 +242,7 @@ void readOneWireSensors(bool withMQTT)
} }
Serial << "Lipo Temperatur " << temp << " °C " << endl; Serial << "Lipo Temperatur " << temp << " °C " << endl;
} }
if (strcmp(waterSensorAddr.get(),buf) == 0) if (strcmp(waterSensorAddr.get(), buf) == 0)
{ {
if (withMQTT) if (withMQTT)
{ {
@ -281,33 +285,44 @@ void readPowerSwitchedSensors()
delay(2); delay(2);
} }
/* Read the distance and give the temperature sensors some time */ Wire.setPins(SENSOR_TANK_TRG, SENSOR_TANK_ECHO);
Wire.begin();
tankSensor.setTimeout(500);
long start = millis();
bool distanceReady = false;
while (start + 500 > millis())
{ {
for (int i = 0; i < AMOUNT_SENOR_QUERYS; i++) if (tankSensor.init())
{ {
unsigned long duration = 0; distanceReady = true;
break;
digitalWrite(SENSOR_TANK_TRG, HIGH);
delayMicroseconds(20);
cli();
digitalWrite(SENSOR_TANK_TRG, LOW);
//10ms is > 2m tank depth
duration = pulseIn(SENSOR_TANK_ECHO, HIGH, 10);
sei();
int mmDis = duration * 0.3432 / 2;
if (mmDis > MAX_TANK_DEPTH)
{
waterRawSensor.add(0);
} }
else else
{ {
waterRawSensor.add(mmDis); delay(20);
}
} }
} }
if (distanceReady)
{
tankSensor.setSignalRateLimit(0.1);
// increase laser pulse periods (defaults are 14 and 10 PCLKs)
tankSensor.setVcselPulsePeriod(VL53L0X::VcselPeriodPreRange, 18);
tankSensor.setVcselPulsePeriod(VL53L0X::VcselPeriodFinalRange, 14);
tankSensor.setMeasurementTimingBudget(200000);
Serial << "Distance sensor " << waterRawSensor.getAverage() << " cm" << endl; for (int readCnt = 0; readCnt < 5; readCnt++)
{
if(!tankSensor.timeoutOccurred()){
waterRawSensor.add(tankSensor.readRangeSingleMillimeters());
}
delay(10);
}
Serial << "Distance sensor " << waterRawSensor.getMedian() << " mm" << endl;
}
else
{
Serial.println("Failed to detect and initialize distance sensor!");
}
/* deactivate the sensors */ /* deactivate the sensors */
digitalWrite(OUTPUT_ENABLE_SENSOR, LOW); digitalWrite(OUTPUT_ENABLE_SENSOR, LOW);
@ -612,8 +627,7 @@ void setup()
// Set default values // Set default values
//in seconds //in seconds
deepSleepTime.setDefaultValue(600).setValidator([](long candidate) deepSleepTime.setDefaultValue(600).setValidator([](long candidate) { return (candidate > 0) && (candidate < (60 * 60 * 2) /** 2h max sleep */); });
{ return (candidate > 0) && (candidate < (60 * 60 * 2) /** 2h max sleep */); });
deepSleepNightTime.setDefaultValue(600); deepSleepNightTime.setDefaultValue(600);
wateringDeepSleep.setDefaultValue(5); wateringDeepSleep.setDefaultValue(5);
ntpServer.setDefaultValue("pool.ntp.org"); ntpServer.setDefaultValue("pool.ntp.org");
@ -633,8 +647,6 @@ void setup()
mConfigured = Homie.isConfigured(); mConfigured = Homie.isConfigured();
if (mConfigured) if (mConfigured)
{ {
Serial << "Wifi mode set to " << WIFI_STA << endl;
WiFi.mode(WIFI_STA);
for (int i = 0; i < MAX_PLANTS; i++) for (int i = 0; i < MAX_PLANTS; i++)
{ {
@ -675,10 +687,11 @@ void setup()
else else
{ {
readOneWireSensors(false); readOneWireSensors(false);
//prevent BOD to be paranoid
WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 0);
digitalWrite(OUTPUT_ENABLE_PUMP, HIGH); digitalWrite(OUTPUT_ENABLE_PUMP, HIGH);
delay(100); delay(100);
Serial << "Wifi mode set to " << WIFI_AP_STA << endl; WRITE_PERI_REG(RTC_CNTL_BROWN_OUT_REG, 1);
WiFi.mode(WIFI_AP_STA);
Serial.println("Initial Setup. Start Accesspoint..."); Serial.println("Initial Setup. Start Accesspoint...");
mDownloadMode = true; mDownloadMode = true;
} }
@ -796,6 +809,7 @@ void plantcontrol(bool withHomie)
if (withHomie) if (withHomie)
{ {
sensorWater.setProperty("remaining").send(String(waterLevelMax.get() - waterRawSensor.getAverage())); sensorWater.setProperty("remaining").send(String(waterLevelMax.get() - waterRawSensor.getAverage()));
sensorWater.setProperty("distance").send(String(waterRawSensor.getAverage()));
sensorLipo.setProperty("percent").send(String(100 * batteryVoltage / VOLT_MAX_BATT)); sensorLipo.setProperty("percent").send(String(100 * batteryVoltage / VOLT_MAX_BATT));
sensorLipo.setProperty("volt").send(String(batteryVoltage)); sensorLipo.setProperty("volt").send(String(batteryVoltage));
sensorLipo.setProperty("current").send(String(battery.getCurrent())); sensorLipo.setProperty("current").send(String(battery.getCurrent()));