lcsc/jlcpcb order changes
This commit is contained in:
commit
3bbcd24707
BIN
board/JLCPCB SMT Parts Library(20201125).ods
Normal file
BIN
board/JLCPCB SMT Parts Library(20201125).ods
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
||||
update=Thu 29 Oct 2020 22:18:09 CET
|
||||
update=Fri 27 Nov 2020 08:17:47 PM CET
|
||||
version=1
|
||||
last_client=kicad
|
||||
[general]
|
||||
@ -39,8 +39,9 @@ MinMicroViaDiameter=0.2
|
||||
MinMicroViaDrill=0.09999999999999999
|
||||
MinHoleToHole=0.25
|
||||
TrackWidth1=1.2
|
||||
TrackWidth2=0.25
|
||||
TrackWidth2=0.2
|
||||
TrackWidth3=0.5
|
||||
TrackWidth4=1
|
||||
ViaDiameter1=0.8
|
||||
ViaDrill1=0.4
|
||||
ViaDiameter2=4
|
||||
@ -71,7 +72,7 @@ OthersTextUpright=1
|
||||
SolderMaskClearance=0.051
|
||||
SolderMaskMinWidth=0.25
|
||||
SolderPasteClearance=0
|
||||
SolderPasteRatio=0
|
||||
SolderPasteRatio=-0
|
||||
[pcbnew/Layer.F.Cu]
|
||||
Name=F.Cu
|
||||
Type=0
|
||||
|
File diff suppressed because it is too large
Load Diff
33
board/kicad-stuff/DW01.lib
Normal file
33
board/kicad-stuff/DW01.lib
Normal file
@ -0,0 +1,33 @@
|
||||
EESchema-LIBRARY Version 2.3
|
||||
#encoding utf-8
|
||||
#(c) SnapEDA 2016 (snapeda.com)
|
||||
#This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License (CC BY-SA) with Design Exception 1.0
|
||||
#
|
||||
# DW01
|
||||
#
|
||||
DEF DW01 IC 0 40 Y Y 1 L N
|
||||
F0 "IC" 850 300 50 H V L BNN
|
||||
F1 "DW01" 850 200 50 H V L BNN
|
||||
F2 "SOT95P280X135-6N" 0 0 50 H I L BNN
|
||||
F3 "" 0 0 50 H I L BNN
|
||||
F4 "1.35mm" 0 0 50 H I L BNN "HEIGHT"
|
||||
F5 "ic" 0 0 50 H I L BNN "DESCRIPTION"
|
||||
F6 "" 0 0 50 H I L BNN "LCSC_PRICE-STOCK"
|
||||
F7 "DW01" 0 0 50 H I L BNN "MANUFACTURER_PART_NUMBER"
|
||||
F8 "" 0 0 50 H I L BNN "LCSC_PART_NUMBER"
|
||||
F9 "Slkor" 0 0 50 H I L BNN "MANUFACTURER_NAME"
|
||||
DRAW
|
||||
P 2 0 0 10 200 100 800 100 N
|
||||
P 2 0 0 10 800 -300 800 100 N
|
||||
P 2 0 0 10 800 -300 200 -300 N
|
||||
P 2 0 0 10 200 100 200 -300 N
|
||||
X OD 1 0 0 200 R 40 40 0 0 B
|
||||
X CSI 2 0 -100 200 R 40 40 0 0 B
|
||||
X OC 3 0 -200 200 R 40 40 0 0 B
|
||||
X VSS 6 1000 0 200 L 40 40 0 0 B
|
||||
X VDD 5 1000 -100 200 L 40 40 0 0 B
|
||||
X TD 4 1000 -200 200 L 40 40 0 0 B
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# End Library
|
@ -1,3 +1,9 @@
|
||||
EESchema-DOCLIB Version 2.0
|
||||
#
|
||||
$CMP SR04M-2-HeaderConn_01x04_Female
|
||||
D Generic connector, single row, 01x04, script generated (kicad-library-utils/schlib/autogen/connector/)
|
||||
K connector
|
||||
F ~
|
||||
$ENDCMP
|
||||
#
|
||||
#End Doc Library
|
||||
|
@ -83,4 +83,42 @@ X D 3 50 200 100 D 50 50 1 1 P
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# SR04M-2
|
||||
#
|
||||
DEF SR04M-2 H 0 40 Y Y 1 F N
|
||||
F0 "H" 250 1100 50 H V C CNN
|
||||
F1 "SR04M-2" 300 -850 50 H V C CNN
|
||||
F2 "" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
DRAW
|
||||
S -900 1050 1650 -800 0 1 10 N
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# SR04M-2-HeaderConn_01x04_Female
|
||||
#
|
||||
DEF SR04M-2-HeaderConn_01x04_Female J 0 40 Y N 1 F N
|
||||
F0 "J" 0 200 50 H V C CNN
|
||||
F1 "SR04M-2-HeaderConn_01x04_Female" 0 -300 50 H V C CNN
|
||||
F2 "ESP32:SR04M-2PinHeader_1x04_P2.54mm_Vertical" 0 0 50 H I C CNN
|
||||
F3 "" 0 0 50 H I C CNN
|
||||
$FPLIST
|
||||
Connector*:*_1x??_*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
A 0 -200 20 901 -901 1 1 6 N 0 -180 0 -220
|
||||
A 0 -100 20 901 -901 1 1 6 N 0 -80 0 -120
|
||||
A 0 0 20 901 -901 1 1 6 N 0 20 0 -20
|
||||
A 0 100 20 901 -901 1 1 6 N 0 120 0 80
|
||||
P 2 1 1 6 -50 -200 -20 -200 N
|
||||
P 2 1 1 6 -50 -100 -20 -100 N
|
||||
P 2 1 1 6 -50 0 -20 0 N
|
||||
P 2 1 1 6 -50 100 -20 100 N
|
||||
X VCC 1 -200 100 150 R 50 50 1 1 W
|
||||
X RX 2 -200 0 150 R 50 50 1 1 I
|
||||
X TX 3 -200 -100 150 R 50 50 1 1 O
|
||||
X GND 4 -200 -200 150 R 50 50 1 1 W
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
#End Library
|
||||
|
@ -0,0 +1,43 @@
|
||||
(module SR04M-2PinHeader_1x04_P2.54mm_Vertical (layer F.Cu) (tedit 5FC1448F)
|
||||
(descr "Through hole straight pin header, 1x04, 2.54mm pitch, single row")
|
||||
(tags "Through hole pin header THT 1x04 2.54mm single row")
|
||||
(fp_text reference REF** (at 0 -2.33) (layer F.SilkS)
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
)
|
||||
(fp_text value SR04M-2PinHeader_1x04_P2.54mm_Vertical (at 0 9.95) (layer F.Fab)
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
)
|
||||
(fp_line (start 1.8 -1.8) (end -1.8 -1.8) (layer F.CrtYd) (width 0.05))
|
||||
(fp_line (start 1.8 9.4) (end 1.8 -1.8) (layer F.CrtYd) (width 0.05))
|
||||
(fp_line (start -1.8 9.4) (end 1.8 9.4) (layer F.CrtYd) (width 0.05))
|
||||
(fp_line (start -1.8 -1.8) (end -1.8 9.4) (layer F.CrtYd) (width 0.05))
|
||||
(fp_line (start -1.33 -1.33) (end 0 -1.33) (layer F.SilkS) (width 0.12))
|
||||
(fp_line (start -1.33 0) (end -1.33 -1.33) (layer F.SilkS) (width 0.12))
|
||||
(fp_line (start -1.33 1.27) (end 1.33 1.27) (layer F.SilkS) (width 0.12))
|
||||
(fp_line (start 1.33 1.27) (end 1.33 8.95) (layer F.SilkS) (width 0.12))
|
||||
(fp_line (start -1.33 1.27) (end -1.33 8.95) (layer F.SilkS) (width 0.12))
|
||||
(fp_line (start -1.33 8.95) (end 1.33 8.95) (layer F.SilkS) (width 0.12))
|
||||
(fp_line (start -1.27 -0.635) (end -0.635 -1.27) (layer F.Fab) (width 0.1))
|
||||
(fp_line (start -1.27 8.89) (end -1.27 -0.635) (layer F.Fab) (width 0.1))
|
||||
(fp_line (start 1.27 8.89) (end -1.27 8.89) (layer F.Fab) (width 0.1))
|
||||
(fp_line (start 1.27 -1.27) (end 1.27 8.89) (layer F.Fab) (width 0.1))
|
||||
(fp_line (start -0.635 -1.27) (end 1.27 -1.27) (layer F.Fab) (width 0.1))
|
||||
(fp_line (start 0 -17.5) (end 10 -17.5) (layer F.SilkS) (width 0.12))
|
||||
(fp_line (start 10 -17.5) (end 10 23.5) (layer F.SilkS) (width 0.12))
|
||||
(fp_line (start 10 23.5) (end -10 23.5) (layer F.SilkS) (width 0.12))
|
||||
(fp_line (start -10 23.5) (end -10 -17.5) (layer F.SilkS) (width 0.12))
|
||||
(fp_line (start -10 -17.5) (end 0.5 -17.5) (layer F.SilkS) (width 0.12))
|
||||
(fp_poly (pts (xy 8.81 6.27) (xy 3.81 6.27) (xy 3.81 1.27) (xy 8.81 1.27)) (layer F.Fab) (width 0.1))
|
||||
(fp_text user %R (at 0 3.81 90) (layer F.Fab)
|
||||
(effects (font (size 1 1) (thickness 0.15)))
|
||||
)
|
||||
(pad 1 thru_hole rect (at 0 0) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask))
|
||||
(pad 2 thru_hole oval (at 0 2.54) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask))
|
||||
(pad 3 thru_hole oval (at 0 5.08) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask))
|
||||
(pad 4 thru_hole oval (at 0 7.62) (size 1.7 1.7) (drill 1) (layers *.Cu *.Mask))
|
||||
(model ${KISYS3DMOD}/Connector_PinHeader_2.54mm.3dshapes/PinHeader_1x04_P2.54mm_Vertical.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 1 1 1))
|
||||
(rotate (xyz 0 0 0))
|
||||
)
|
||||
)
|
31
board/kicad-stuff/SX1308.lib
Normal file
31
board/kicad-stuff/SX1308.lib
Normal file
@ -0,0 +1,31 @@
|
||||
EESchema-LIBRARY Version 2.3
|
||||
#encoding utf-8
|
||||
#(c) SnapEDA 2016 (snapeda.com)
|
||||
#This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License (CC BY-SA) with Design Exception 1.0
|
||||
#
|
||||
# SX1308
|
||||
#
|
||||
DEF SX1308 U 0 40 Y Y 1 L N
|
||||
F0 "U" -700 800 50 H V L BNN
|
||||
F1 "SX1308" -701 701 50 H V L BNN
|
||||
F2 "SOT-23-6" 0 0 50 H I L BNN
|
||||
F3 "" 0 0 50 H I L BNN
|
||||
DRAW
|
||||
P 2 0 0 10 -700 600 0 600 N
|
||||
P 2 0 0 10 0 600 0 -300 N
|
||||
P 2 0 0 10 0 -300 -700 -300 N
|
||||
P 2 0 0 10 -700 -300 -700 600 N
|
||||
P 2 0 0 10 -543 7 -443 7 N
|
||||
P 2 0 0 10 -443 7 -445 66 N
|
||||
P 2 0 0 10 -445 66 -345 66 N
|
||||
T 0 -428 -2 32 0 0 0 ON/OFF Normal 0 L B
|
||||
X SW 1 200 500 200 L 40 40 0 0 B
|
||||
X FB 3 200 -100 200 L 40 40 0 0 B
|
||||
X IN 5 -900 500 200 R 40 40 0 0 B
|
||||
X EN 4 -900 100 200 R 40 40 0 0 B
|
||||
X GND 2 -900 -200 200 R 40 40 0 0 B
|
||||
X N/C 6 200 200 200 L 40 40 0 0 B
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# End Library
|
@ -0,0 +1,21 @@
|
||||
|
||||
(module SOT-23-6 (layer F.Cu) (tedit 5FBEB024)
|
||||
(descr "")
|
||||
(fp_text reference REF** (at 0.0762369 -0.0794385 900) (layer F.SilkS)
|
||||
(effects (font (size 0.600290551181 0.600290551181) (thickness 0.015)))
|
||||
)
|
||||
(fp_text value SOT-23-6 (at 0 0) (layer F.Fab)
|
||||
(effects (font (size 0.787401574803 0.787401574803) (thickness 0.015)))
|
||||
)
|
||||
(fp_line (start 0.7 -1.5) (end 0.7 1.5) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start 0.7 1.5) (end -0.7 1.5) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -0.7 1.5) (end -0.7 -1.5) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -0.7 -1.5) (end 0.7 -1.5) (layer F.SilkS) (width 0.1524))
|
||||
(fp_circle (center -1.2 -1.7) (end -0.9764 -1.7) (layer F.SilkS) (width 0.1524))
|
||||
(pad 2 smd rect (at -1.35 0.0) (size 1.0 0.55) (layers F.Cu F.Mask F.Paste))
|
||||
(pad 1 smd rect (at -1.35 -0.95) (size 1.0 0.55) (layers F.Cu F.Mask F.Paste))
|
||||
(pad 3 smd rect (at -1.35 0.95) (size 1.0 0.55) (layers F.Cu F.Mask F.Paste))
|
||||
(pad 4 smd rect (at 1.35 0.95) (size 1.0 0.55) (layers F.Cu F.Mask F.Paste))
|
||||
(pad 6 smd rect (at 1.35 -0.95) (size 1.0 0.55) (layers F.Cu F.Mask F.Paste))
|
||||
(pad 5 smd rect (at 1.35 0.0) (size 1.0 0.55) (layers F.Cu F.Mask F.Paste))
|
||||
)
|
@ -0,0 +1,30 @@
|
||||
|
||||
(module SOT95P280X135-6N (layer F.Cu) (tedit 5FAC25EE)
|
||||
(descr "<b>SOT2-23-6</b><br>")
|
||||
(fp_text reference REF** (at 0.0 0.0 0) (layer F.SilkS)
|
||||
(effects (font (size 1.0 1.0) (thickness 0.015)))
|
||||
)
|
||||
(fp_text value SOT95P280X135-6N (at 0.0 0.0 0) (layer F.Fab)
|
||||
(effects (font (size 1.0 1.0) (thickness 0.015)))
|
||||
)
|
||||
(fp_line (start -2.125 -1.835) (end 2.125 -1.835) (layer F.Fab) (width 0.05))
|
||||
(fp_line (start 2.125 -1.835) (end 2.125 1.835) (layer F.Fab) (width 0.05))
|
||||
(fp_line (start 2.125 1.835) (end -2.125 1.835) (layer F.Fab) (width 0.05))
|
||||
(fp_line (start -2.125 1.835) (end -2.125 -1.835) (layer F.Fab) (width 0.05))
|
||||
(fp_line (start -0.8 -1.46) (end 0.8 -1.46) (layer F.Fab) (width 0.1))
|
||||
(fp_line (start 0.8 -1.46) (end 0.8 1.46) (layer F.Fab) (width 0.1))
|
||||
(fp_line (start 0.8 1.46) (end -0.8 1.46) (layer F.Fab) (width 0.1))
|
||||
(fp_line (start -0.8 1.46) (end -0.8 -1.46) (layer F.Fab) (width 0.1))
|
||||
(fp_line (start -0.8 -0.51) (end 0.15 -1.46) (layer F.Fab) (width 0.1))
|
||||
(fp_line (start -0.275 -1.46) (end 0.275 -1.46) (layer F.SilkS) (width 0.2))
|
||||
(fp_line (start 0.275 -1.46) (end 0.275 1.46) (layer F.SilkS) (width 0.2))
|
||||
(fp_line (start 0.275 1.46) (end -0.275 1.46) (layer F.SilkS) (width 0.2))
|
||||
(fp_line (start -0.275 1.46) (end -0.275 -1.46) (layer F.SilkS) (width 0.2))
|
||||
(fp_line (start -1.875 -1.6) (end -0.625 -1.6) (layer F.SilkS) (width 0.2))
|
||||
(pad 1 smd rect (at -1.25 -0.95) (size 1.25 0.6) (layers F.Cu F.Mask F.Paste))
|
||||
(pad 2 smd rect (at -1.25 0.0) (size 1.25 0.6) (layers F.Cu F.Mask F.Paste))
|
||||
(pad 3 smd rect (at -1.25 0.95) (size 1.25 0.6) (layers F.Cu F.Mask F.Paste))
|
||||
(pad 4 smd rect (at 1.25 0.95) (size 1.25 0.6) (layers F.Cu F.Mask F.Paste))
|
||||
(pad 5 smd rect (at 1.25 0.0) (size 1.25 0.6) (layers F.Cu F.Mask F.Paste))
|
||||
(pad 6 smd rect (at 1.25 -0.95) (size 1.25 0.6) (layers F.Cu F.Mask F.Paste))
|
||||
)
|
@ -1,5 +1,6 @@
|
||||
(sym_lib_table
|
||||
(lib (name LP38690DT-3.3)(type Legacy)(uri ${KIPRJMOD}/kicad-stuff/LP38690DT-3.3.lib)(options "")(descr ""))
|
||||
(lib (name ESP32-DEVKITC-32D)(type Legacy)(uri ${KIPRJMOD}/kicad-stuff/ESP32/ESP32-DEVKITC-32D.lib)(options "")(descr ""))
|
||||
(lib (name PlantCtrlESP32-rescue)(type Legacy)(uri ${KIPRJMOD}/PlantCtrlESP32-rescue.lib)(options "")(descr ""))
|
||||
)
|
||||
(sym_lib_table
|
||||
(lib (name LP38690DT-3.3)(type Legacy)(uri ${KIPRJMOD}/kicad-stuff/LP38690DT-3.3.lib)(options "")(descr ""))
|
||||
(lib (name ESP32-DEVKITC-32D)(type Legacy)(uri ${KIPRJMOD}/kicad-stuff/ESP32/ESP32-DEVKITC-32D.lib)(options "")(descr ""))
|
||||
(lib (name DW01)(type Legacy)(uri ${KIPRJMOD}/kicad-stuff/DW01.lib)(options "")(descr ""))
|
||||
(lib (name SX1308)(type Legacy)(uri ${KIPRJMOD}/kicad-stuff/SX1308.lib)(options "")(descr ""))
|
||||
)
|
||||
|
1
esp32/.gitignore
vendored
1
esp32/.gitignore
vendored
@ -4,3 +4,4 @@
|
||||
.vscode/launch.json
|
||||
.vscode/ipch
|
||||
doc/
|
||||
custom_platformio.ini
|
||||
|
17
esp32/custom_platformio.ini.example
Normal file
17
esp32/custom_platformio.ini.example
Normal file
@ -0,0 +1,17 @@
|
||||
[env:esp32doit-devkit-v1]
|
||||
platform = espressif32
|
||||
board = esp32doit-devkit-v1
|
||||
framework = arduino
|
||||
build_flags = -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
|
||||
board_build.partitions = defaultWithSmallerSpiffs.csv
|
||||
|
||||
extra_configs = custom_platformio.ini
|
||||
|
||||
; the latest development brankitchen-lightch (convention V3.0.x)
|
||||
lib_deps = ArduinoJson@6.16.1
|
||||
https://github.com/homieiot/homie-esp8266.git#v3.0
|
||||
OneWire
|
||||
DallasTemperature
|
||||
|
||||
; add additional parameter, like the upload port
|
||||
upload_port=/dev/ttyUSB1
|
@ -89,10 +89,6 @@
|
||||
#define SOLAR_CHARGE_MIN_VOLTAGE 7 /**< Sun is rising (morning detected) */
|
||||
#define SOLAR_CHARGE_MAX_VOLTAGE 9 /**< Sun is shining (noon) */
|
||||
|
||||
#define HC_SR04 /**< Ultrasonic distance sensor to measure water level */
|
||||
#define SENSOR_SR04_ECHO 17 /**< GPIO 17 - Echo */
|
||||
#define SENSOR_SR04_TRIG 23 /**< GPIO 23 - Trigger */
|
||||
|
||||
#define MAX_CONFIG_SETTING_ITEMS 50 /**< Parameter, that can be configured in Homie */
|
||||
|
||||
#define PANIK_MODE_DEEPSLEEP (60 * 60 * 5U) /**< 5 hours in usecond */
|
||||
|
@ -15,10 +15,12 @@ framework = arduino
|
||||
build_flags = -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
|
||||
board_build.partitions = defaultWithSmallerSpiffs.csv
|
||||
|
||||
upload_port=/dev/ttyUSB1
|
||||
|
||||
; the latest development brankitchen-lightch (convention V3.0.x)
|
||||
lib_deps = ArduinoJson@6.16.1
|
||||
https://github.com/homieiot/homie-esp8266.git#v3.0
|
||||
OneWire
|
||||
DallasTemperature
|
||||
|
||||
[platformio]
|
||||
|
||||
extra_configs = custom_platformio.ini
|
@ -55,10 +55,8 @@ int wakeUpReason = WAKEUP_REASON_UNDEFINED;
|
||||
bool volatile mode3Active = false; /**< Controller must not sleep */
|
||||
bool volatile mDeepsleep = false;
|
||||
|
||||
|
||||
int plantSensor1 = 0;
|
||||
|
||||
int mWaterGone = -1; /**< Amount of centimeter, where no water is seen */
|
||||
int readCounter = 0;
|
||||
bool mConfigured = false;
|
||||
|
||||
@ -117,6 +115,30 @@ long getLastMoisture(int plantId)
|
||||
}
|
||||
}
|
||||
|
||||
long getDistance(){
|
||||
unsigned int distance;
|
||||
byte startByte, h_data, l_data, sum = 0;
|
||||
byte buf[3];
|
||||
|
||||
startByte = (byte)Serial.read();
|
||||
if(startByte == 255){
|
||||
Serial.readBytes(buf, 3);
|
||||
h_data = buf[0];
|
||||
l_data = buf[1];
|
||||
sum = buf[2];
|
||||
distance = (h_data<<8) + l_data;
|
||||
if(((startByte + h_data + l_data)&0xFF) != sum){
|
||||
return -1;
|
||||
}
|
||||
else{
|
||||
return distance;
|
||||
}
|
||||
} else {
|
||||
return -2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void readSystemSensors()
|
||||
{
|
||||
for (int i=0; i < 5; i++) {
|
||||
@ -205,7 +227,7 @@ void mode2MQTT()
|
||||
|
||||
if (lastPumpRunning != -1)
|
||||
{
|
||||
long waterDiff = mWaterGone - lastWaterValue;
|
||||
long waterDiff = waterRawSensor.getAverage() - lastWaterValue;
|
||||
//TODO attribute used water in ml to plantid
|
||||
}
|
||||
for (int i = 0; i < MAX_PLANTS; i++)
|
||||
@ -228,9 +250,9 @@ void mode2MQTT()
|
||||
mPlants[i].setProperty("moist").send(String(pct));
|
||||
mPlants[i].setProperty("moistraw").send(String(raw));
|
||||
}
|
||||
sensorWater.setProperty("remaining").send(String(waterLevelMax.get() - mWaterGone));
|
||||
Serial << "W : " << mWaterGone << " cm (" << String(waterLevelMax.get() - mWaterGone) << "%)" << endl;
|
||||
lastWaterValue = mWaterGone;
|
||||
sensorWater.setProperty("remaining").send(String(waterLevelMax.get() - waterRawSensor.getAverage()));
|
||||
Serial << "W : " << waterRawSensor.getAverage() << " cm (" << String(waterLevelMax.get() - waterRawSensor.getAverage()) << "%)" << endl;
|
||||
lastWaterValue = waterRawSensor.getAverage();
|
||||
|
||||
sensorLipo.setProperty("percent").send(String(100 * lipoRawSensor.getAverage() / 4095));
|
||||
sensorLipo.setProperty("volt").send(String(getBatteryVoltage()));
|
||||
@ -389,7 +411,8 @@ bool readSensors()
|
||||
delay(200);
|
||||
|
||||
/* Required to read the temperature once */
|
||||
for (int i = 0; i < 5; i++)
|
||||
int readAgain = 5;
|
||||
while (readAgain > 0)
|
||||
{
|
||||
int sensors = dallas.readAllTemperatures(pFloat, 2);
|
||||
if (sensors > 0)
|
||||
@ -402,6 +425,19 @@ bool readSensors()
|
||||
Serial << "t2: " << String(temp[1]) << endl;
|
||||
temp2.add(temp[1]);
|
||||
}
|
||||
if ((temp1.getAverage() - rtcLastTemp1 > TEMPERATURE_DELTA_TRIGGER_IN_C) ||
|
||||
(rtcLastTemp1 - temp1.getAverage() > TEMPERATURE_DELTA_TRIGGER_IN_C)) {
|
||||
leaveMode1 = true;
|
||||
}
|
||||
if ((temp2.getAverage() - rtcLastTemp2 > TEMPERATURE_DELTA_TRIGGER_IN_C) ||
|
||||
(rtcLastTemp2 - temp2.getAverage() > TEMPERATURE_DELTA_TRIGGER_IN_C)) {
|
||||
leaveMode1 = true;
|
||||
}
|
||||
if(!leaveMode1){
|
||||
readAgain = 0;
|
||||
}
|
||||
|
||||
readAgain--;
|
||||
delay(50);
|
||||
}
|
||||
|
||||
@ -429,13 +465,15 @@ bool readSensors()
|
||||
rtcLastSolarVoltage = getSolarVoltage();
|
||||
|
||||
/* Use the Ultrasonic sensor to measure waterLevel */
|
||||
digitalWrite(SENSOR_SR04_TRIG, LOW);
|
||||
delayMicroseconds(2);
|
||||
digitalWrite(SENSOR_SR04_TRIG, HIGH);
|
||||
delayMicroseconds(10);
|
||||
digitalWrite(SENSOR_SR04_TRIG, LOW);
|
||||
float duration = pulseIn(SENSOR_SR04_ECHO, HIGH);
|
||||
waterRawSensor.add((duration * .343) / 2);
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
while(!Serial.available()){}
|
||||
unsigned int distance = getDistance();
|
||||
if(distance > 0){
|
||||
waterRawSensor.add(distance);
|
||||
}
|
||||
}
|
||||
Serial << "Distance sensor " << waterRawSensor.getAverage() << " cm" << endl;
|
||||
/* deactivate the sensors */
|
||||
digitalWrite(OUTPUT_SENSOR, LOW);
|
||||
return leaveMode1;
|
||||
@ -717,7 +755,7 @@ void mode2()
|
||||
*/
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(115200);
|
||||
Serial.begin(9600);
|
||||
Serial.setTimeout(1000); // Set timeout of 1 second
|
||||
Serial << endl
|
||||
<< endl;
|
||||
@ -807,4 +845,4 @@ void loop()
|
||||
}
|
||||
}
|
||||
|
||||
/** @}*/
|
||||
/** @}*/
|
||||
|
BIN
sheets/1811011513_SX-Shenzhen-Suosemi-Tech-SX1308_C78162.pdf
Normal file
BIN
sheets/1811011513_SX-Shenzhen-Suosemi-Tech-SX1308_C78162.pdf
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user