Compare commits
47 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6da0e0268e | |||
| 4ef13cbe59 | |||
| 0784d2da44 | |||
|
|
38ffd64305 | ||
|
|
5e2ab1eedb | ||
|
|
cf905c9c03 | ||
|
|
9f96fa2c5b | ||
|
|
86b82d03b3 | ||
| 552c27632b | |||
| fcdcfe2720 | |||
| d5fbd38762 | |||
| f1f21027ed | |||
|
|
093b7c7fc3 | ||
|
|
55d66b763c | ||
|
|
5deea587a8 | ||
| 17b0bb435c | |||
| ae18a25c69 | |||
| 6843a58228 | |||
| 3e73e5e9b0 | |||
| 4836f4eb58 | |||
| 8412ee863d | |||
| 9d20474bdd | |||
| 20a61aa87a | |||
|
|
062638378f | ||
| afc244a3b2 | |||
| a6b1bb7a70 | |||
|
|
e006d719d7 | ||
|
|
7cad34627f | ||
|
|
938f253072 | ||
| 4cd9b35cd2 | |||
|
|
d3809c1db9 | ||
|
|
c3408a7a36 | ||
| 268fe0fdc0 | |||
|
|
6b64fa50a4 | ||
|
|
3a5405998c | ||
|
|
a1bae8180d | ||
|
|
11cde021a2 | ||
| 653d962cdf | |||
| d4ccab6ea5 | |||
|
|
4a00af5506 | ||
|
|
f4f7195e4f | ||
|
|
1060166d43 | ||
|
|
bb1e59c79d | ||
|
|
bd3c6ec4eb | ||
|
|
cf9e4a5f47 | ||
|
|
505a5e337a | ||
|
|
8b1367a20c |
@@ -18,7 +18,8 @@ There the following components are connected:
|
||||
* 7 pump
|
||||
* DC-DC convert (generating voltage from Lipo for pumps)
|
||||
* DS18B20 temperature sensors
|
||||
* water tank ultrasonic sensor (via HC_SR04)
|
||||
* water tank ultrasonic sensor (via JSN-SR04T-2.0)
|
||||
* DS2438 battery monitor
|
||||
* general purpose expansion pin
|
||||
|
||||
# Software
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
BIN
board/PlantCtrlESP32_Board0_7.ods
Normal file
BIN
board/PlantCtrlESP32_Board0_7.ods
Normal file
Binary file not shown.
@@ -1,14 +0,0 @@
|
||||
G04 #@! TF.GenerationSoftware,KiCad,Pcbnew,(5.1.5)-3*
|
||||
G04 #@! TF.CreationDate,2020-11-29T03:44:08+01:00*
|
||||
G04 #@! TF.ProjectId,PlantCtrlESP32,506c616e-7443-4747-926c-45535033322e,rev?*
|
||||
G04 #@! TF.SameCoordinates,Original*
|
||||
G04 #@! TF.FileFunction,Glue,Bot*
|
||||
G04 #@! TF.FilePolarity,Positive*
|
||||
%FSLAX46Y46*%
|
||||
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)*
|
||||
G04 Created by KiCad (PCBNEW (5.1.5)-3) date 2020-11-29 03:44:08*
|
||||
%MOMM*%
|
||||
%LPD*%
|
||||
G04 APERTURE LIST*
|
||||
G04 APERTURE END LIST*
|
||||
M02*
|
||||
@@ -1,23 +0,0 @@
|
||||
G04 #@! TF.GenerationSoftware,KiCad,Pcbnew,(5.1.5)-3*
|
||||
G04 #@! TF.CreationDate,2020-11-29T03:44:09+01:00*
|
||||
G04 #@! TF.ProjectId,PlantCtrlESP32,506c616e-7443-4747-926c-45535033322e,rev?*
|
||||
G04 #@! TF.SameCoordinates,Original*
|
||||
G04 #@! TF.FileFunction,Other,User*
|
||||
%FSLAX46Y46*%
|
||||
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)*
|
||||
G04 Created by KiCad (PCBNEW (5.1.5)-3) date 2020-11-29 03:44:09*
|
||||
%MOMM*%
|
||||
%LPD*%
|
||||
G04 APERTURE LIST*
|
||||
%ADD10C,0.050000*%
|
||||
G04 APERTURE END LIST*
|
||||
D10*
|
||||
X248020000Y-64572000D02*
|
||||
X239620000Y-64572000D01*
|
||||
X248020000Y-57822000D02*
|
||||
X248020000Y-64572000D01*
|
||||
X239620000Y-57822000D02*
|
||||
X248020000Y-57822000D01*
|
||||
X239620000Y-64572000D02*
|
||||
X239620000Y-57822000D01*
|
||||
M02*
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,155 +0,0 @@
|
||||
G04 #@! TF.GenerationSoftware,KiCad,Pcbnew,(5.1.5)-3*
|
||||
G04 #@! TF.CreationDate,2020-11-29T03:44:09+01:00*
|
||||
G04 #@! TF.ProjectId,PlantCtrlESP32,506c616e-7443-4747-926c-45535033322e,rev?*
|
||||
G04 #@! TF.SameCoordinates,Original*
|
||||
G04 #@! TF.FileFunction,Other,Fab,Bot*
|
||||
%FSLAX46Y46*%
|
||||
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)*
|
||||
G04 Created by KiCad (PCBNEW (5.1.5)-3) date 2020-11-29 03:44:09*
|
||||
%MOMM*%
|
||||
%LPD*%
|
||||
G04 APERTURE LIST*
|
||||
%ADD10C,0.100000*%
|
||||
%ADD11C,0.150000*%
|
||||
G04 APERTURE END LIST*
|
||||
D10*
|
||||
X242570000Y-63072000D02*
|
||||
X243195000Y-64072000D01*
|
||||
X241945000Y-64072000D02*
|
||||
X242570000Y-63072000D01*
|
||||
X247520000Y-64072000D02*
|
||||
X240120000Y-64072000D01*
|
||||
X247520000Y-58322000D02*
|
||||
X247520000Y-64072000D01*
|
||||
X240120000Y-58322000D02*
|
||||
X247520000Y-58322000D01*
|
||||
X240120000Y-64072000D02*
|
||||
X240120000Y-58322000D01*
|
||||
D11*
|
||||
X247558095Y-57479142D02*
|
||||
X247605714Y-57526761D01*
|
||||
X247748571Y-57574380D01*
|
||||
X247843809Y-57574380D01*
|
||||
X247986666Y-57526761D01*
|
||||
X248081904Y-57431523D01*
|
||||
X248129523Y-57336285D01*
|
||||
X248177142Y-57145809D01*
|
||||
X248177142Y-57002952D01*
|
||||
X248129523Y-56812476D01*
|
||||
X248081904Y-56717238D01*
|
||||
X247986666Y-56622000D01*
|
||||
X247843809Y-56574380D01*
|
||||
X247748571Y-56574380D01*
|
||||
X247605714Y-56622000D01*
|
||||
X247558095Y-56669619D01*
|
||||
X246986666Y-57574380D02*
|
||||
X247081904Y-57526761D01*
|
||||
X247129523Y-57479142D01*
|
||||
X247177142Y-57383904D01*
|
||||
X247177142Y-57098190D01*
|
||||
X247129523Y-57002952D01*
|
||||
X247081904Y-56955333D01*
|
||||
X246986666Y-56907714D01*
|
||||
X246843809Y-56907714D01*
|
||||
X246748571Y-56955333D01*
|
||||
X246700952Y-57002952D01*
|
||||
X246653333Y-57098190D01*
|
||||
X246653333Y-57383904D01*
|
||||
X246700952Y-57479142D01*
|
||||
X246748571Y-57526761D01*
|
||||
X246843809Y-57574380D01*
|
||||
X246986666Y-57574380D01*
|
||||
X246224761Y-56907714D02*
|
||||
X246224761Y-57574380D01*
|
||||
X246224761Y-57002952D02*
|
||||
X246177142Y-56955333D01*
|
||||
X246081904Y-56907714D01*
|
||||
X245939047Y-56907714D01*
|
||||
X245843809Y-56955333D01*
|
||||
X245796190Y-57050571D01*
|
||||
X245796190Y-57574380D01*
|
||||
X245320000Y-56907714D02*
|
||||
X245320000Y-57574380D01*
|
||||
X245320000Y-57002952D02*
|
||||
X245272380Y-56955333D01*
|
||||
X245177142Y-56907714D01*
|
||||
X245034285Y-56907714D01*
|
||||
X244939047Y-56955333D01*
|
||||
X244891428Y-57050571D01*
|
||||
X244891428Y-57574380D01*
|
||||
X244653333Y-57669619D02*
|
||||
X243891428Y-57669619D01*
|
||||
X243462857Y-56574380D02*
|
||||
X243367619Y-56574380D01*
|
||||
X243272380Y-56622000D01*
|
||||
X243224761Y-56669619D01*
|
||||
X243177142Y-56764857D01*
|
||||
X243129523Y-56955333D01*
|
||||
X243129523Y-57193428D01*
|
||||
X243177142Y-57383904D01*
|
||||
X243224761Y-57479142D01*
|
||||
X243272380Y-57526761D01*
|
||||
X243367619Y-57574380D01*
|
||||
X243462857Y-57574380D01*
|
||||
X243558095Y-57526761D01*
|
||||
X243605714Y-57479142D01*
|
||||
X243653333Y-57383904D01*
|
||||
X243700952Y-57193428D01*
|
||||
X243700952Y-56955333D01*
|
||||
X243653333Y-56764857D01*
|
||||
X243605714Y-56669619D01*
|
||||
X243558095Y-56622000D01*
|
||||
X243462857Y-56574380D01*
|
||||
X242177142Y-57574380D02*
|
||||
X242748571Y-57574380D01*
|
||||
X242462857Y-57574380D02*
|
||||
X242462857Y-56574380D01*
|
||||
X242558095Y-56717238D01*
|
||||
X242653333Y-56812476D01*
|
||||
X242748571Y-56860095D01*
|
||||
X241843809Y-57574380D02*
|
||||
X241320000Y-56907714D01*
|
||||
X241843809Y-56907714D02*
|
||||
X241320000Y-57574380D01*
|
||||
X240748571Y-56574380D02*
|
||||
X240653333Y-56574380D01*
|
||||
X240558095Y-56622000D01*
|
||||
X240510476Y-56669619D01*
|
||||
X240462857Y-56764857D01*
|
||||
X240415238Y-56955333D01*
|
||||
X240415238Y-57193428D01*
|
||||
X240462857Y-57383904D01*
|
||||
X240510476Y-57479142D01*
|
||||
X240558095Y-57526761D01*
|
||||
X240653333Y-57574380D01*
|
||||
X240748571Y-57574380D01*
|
||||
X240843809Y-57526761D01*
|
||||
X240891428Y-57479142D01*
|
||||
X240939047Y-57383904D01*
|
||||
X240986666Y-57193428D01*
|
||||
X240986666Y-56955333D01*
|
||||
X240939047Y-56764857D01*
|
||||
X240891428Y-56669619D01*
|
||||
X240843809Y-56622000D01*
|
||||
X240748571Y-56574380D01*
|
||||
X240034285Y-56669619D02*
|
||||
X239986666Y-56622000D01*
|
||||
X239891428Y-56574380D01*
|
||||
X239653333Y-56574380D01*
|
||||
X239558095Y-56622000D01*
|
||||
X239510476Y-56669619D01*
|
||||
X239462857Y-56764857D01*
|
||||
X239462857Y-56860095D01*
|
||||
X239510476Y-57002952D01*
|
||||
X240081904Y-57574380D01*
|
||||
X239462857Y-57574380D01*
|
||||
X244153333Y-58474380D02*
|
||||
X244153333Y-59188666D01*
|
||||
X244200952Y-59331523D01*
|
||||
X244296190Y-59426761D01*
|
||||
X244439047Y-59474380D01*
|
||||
X244534285Y-59474380D01*
|
||||
X243772380Y-58474380D02*
|
||||
X243105714Y-58474380D01*
|
||||
X243534285Y-59474380D01*
|
||||
M02*
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,14 +0,0 @@
|
||||
G04 #@! TF.GenerationSoftware,KiCad,Pcbnew,(5.1.5)-3*
|
||||
G04 #@! TF.CreationDate,2020-11-29T03:44:08+01:00*
|
||||
G04 #@! TF.ProjectId,PlantCtrlESP32,506c616e-7443-4747-926c-45535033322e,rev?*
|
||||
G04 #@! TF.SameCoordinates,Original*
|
||||
G04 #@! TF.FileFunction,Paste,Bot*
|
||||
G04 #@! TF.FilePolarity,Positive*
|
||||
%FSLAX46Y46*%
|
||||
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)*
|
||||
G04 Created by KiCad (PCBNEW (5.1.5)-3) date 2020-11-29 03:44:08*
|
||||
%MOMM*%
|
||||
%LPD*%
|
||||
G04 APERTURE LIST*
|
||||
G04 APERTURE END LIST*
|
||||
M02*
|
||||
@@ -1,193 +0,0 @@
|
||||
G04 #@! TF.GenerationSoftware,KiCad,Pcbnew,(5.1.5)-3*
|
||||
G04 #@! TF.CreationDate,2020-11-29T03:44:08+01:00*
|
||||
G04 #@! TF.ProjectId,PlantCtrlESP32,506c616e-7443-4747-926c-45535033322e,rev?*
|
||||
G04 #@! TF.SameCoordinates,Original*
|
||||
G04 #@! TF.FileFunction,Legend,Bot*
|
||||
G04 #@! TF.FilePolarity,Positive*
|
||||
%FSLAX46Y46*%
|
||||
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)*
|
||||
G04 Created by KiCad (PCBNEW (5.1.5)-3) date 2020-11-29 03:44:08*
|
||||
%MOMM*%
|
||||
%LPD*%
|
||||
G04 APERTURE LIST*
|
||||
%ADD10C,0.500000*%
|
||||
%ADD11C,0.120000*%
|
||||
%ADD12C,0.150000*%
|
||||
G04 APERTURE END LIST*
|
||||
D10*
|
||||
X235779314Y-50323523D02*
|
||||
X235779314Y-46323523D01*
|
||||
X234255504Y-46323523D01*
|
||||
X233874552Y-46514000D01*
|
||||
X233684076Y-46704476D01*
|
||||
X233493600Y-47085428D01*
|
||||
X233493600Y-47656857D01*
|
||||
X233684076Y-48037809D01*
|
||||
X233874552Y-48228285D01*
|
||||
X234255504Y-48418761D01*
|
||||
X235779314Y-48418761D01*
|
||||
X231207885Y-50323523D02*
|
||||
X231588838Y-50133047D01*
|
||||
X231779314Y-49752095D01*
|
||||
X231779314Y-46323523D01*
|
||||
X227969790Y-50323523D02*
|
||||
X227969790Y-48228285D01*
|
||||
X228160266Y-47847333D01*
|
||||
X228541219Y-47656857D01*
|
||||
X229303123Y-47656857D01*
|
||||
X229684076Y-47847333D01*
|
||||
X227969790Y-50133047D02*
|
||||
X228350742Y-50323523D01*
|
||||
X229303123Y-50323523D01*
|
||||
X229684076Y-50133047D01*
|
||||
X229874552Y-49752095D01*
|
||||
X229874552Y-49371142D01*
|
||||
X229684076Y-48990190D01*
|
||||
X229303123Y-48799714D01*
|
||||
X228350742Y-48799714D01*
|
||||
X227969790Y-48609238D01*
|
||||
X226065028Y-47656857D02*
|
||||
X226065028Y-50323523D01*
|
||||
X226065028Y-48037809D02*
|
||||
X225874552Y-47847333D01*
|
||||
X225493600Y-47656857D01*
|
||||
X224922171Y-47656857D01*
|
||||
X224541219Y-47847333D01*
|
||||
X224350742Y-48228285D01*
|
||||
X224350742Y-50323523D01*
|
||||
X223017409Y-47656857D02*
|
||||
X221493600Y-47656857D01*
|
||||
X222445980Y-46323523D02*
|
||||
X222445980Y-49752095D01*
|
||||
X222255504Y-50133047D01*
|
||||
X221874552Y-50323523D01*
|
||||
X221493600Y-50323523D01*
|
||||
X217874552Y-49942571D02*
|
||||
X218065028Y-50133047D01*
|
||||
X218636457Y-50323523D01*
|
||||
X219017409Y-50323523D01*
|
||||
X219588838Y-50133047D01*
|
||||
X219969790Y-49752095D01*
|
||||
X220160266Y-49371142D01*
|
||||
X220350742Y-48609238D01*
|
||||
X220350742Y-48037809D01*
|
||||
X220160266Y-47275904D01*
|
||||
X219969790Y-46894952D01*
|
||||
X219588838Y-46514000D01*
|
||||
X219017409Y-46323523D01*
|
||||
X218636457Y-46323523D01*
|
||||
X218065028Y-46514000D01*
|
||||
X217874552Y-46704476D01*
|
||||
X216731695Y-47656857D02*
|
||||
X215207885Y-47656857D01*
|
||||
X216160266Y-46323523D02*
|
||||
X216160266Y-49752095D01*
|
||||
X215969790Y-50133047D01*
|
||||
X215588838Y-50323523D01*
|
||||
X215207885Y-50323523D01*
|
||||
X213874552Y-50323523D02*
|
||||
X213874552Y-47656857D01*
|
||||
X213874552Y-48418761D02*
|
||||
X213684076Y-48037809D01*
|
||||
X213493600Y-47847333D01*
|
||||
X213112647Y-47656857D01*
|
||||
X212731695Y-47656857D01*
|
||||
X210826933Y-50323523D02*
|
||||
X211207885Y-50133047D01*
|
||||
X211398361Y-49752095D01*
|
||||
X211398361Y-46323523D01*
|
||||
X206826933Y-46323523D02*
|
||||
X205493600Y-50323523D01*
|
||||
X204160266Y-46323523D01*
|
||||
X202065028Y-46323523D02*
|
||||
X201684076Y-46323523D01*
|
||||
X201303123Y-46514000D01*
|
||||
X201112647Y-46704476D01*
|
||||
X200922171Y-47085428D01*
|
||||
X200731695Y-47847333D01*
|
||||
X200731695Y-48799714D01*
|
||||
X200922171Y-49561619D01*
|
||||
X201112647Y-49942571D01*
|
||||
X201303123Y-50133047D01*
|
||||
X201684076Y-50323523D01*
|
||||
X202065028Y-50323523D01*
|
||||
X202445980Y-50133047D01*
|
||||
X202636457Y-49942571D01*
|
||||
X202826933Y-49561619D01*
|
||||
X203017409Y-48799714D01*
|
||||
X203017409Y-47847333D01*
|
||||
X202826933Y-47085428D01*
|
||||
X202636457Y-46704476D01*
|
||||
X202445980Y-46514000D01*
|
||||
X202065028Y-46323523D01*
|
||||
X199017409Y-49942571D02*
|
||||
X198826933Y-50133047D01*
|
||||
X199017409Y-50323523D01*
|
||||
X199207885Y-50133047D01*
|
||||
X199017409Y-49942571D01*
|
||||
X199017409Y-50323523D01*
|
||||
X195398361Y-47656857D02*
|
||||
X195398361Y-50323523D01*
|
||||
X196350742Y-46133047D02*
|
||||
X197303123Y-48990190D01*
|
||||
X194826933Y-48990190D01*
|
||||
D11*
|
||||
X239720000Y-64472000D02*
|
||||
X239720000Y-63222000D01*
|
||||
X240970000Y-64472000D02*
|
||||
X239720000Y-64472000D01*
|
||||
X246870000Y-58972000D02*
|
||||
X243820000Y-58972000D01*
|
||||
X246870000Y-61922000D02*
|
||||
X246870000Y-58972000D01*
|
||||
X247620000Y-61922000D02*
|
||||
X246870000Y-61922000D01*
|
||||
X240770000Y-58972000D02*
|
||||
X243820000Y-58972000D01*
|
||||
X240770000Y-61922000D02*
|
||||
X240770000Y-58972000D01*
|
||||
X240020000Y-61922000D02*
|
||||
X240770000Y-61922000D01*
|
||||
X247620000Y-64172000D02*
|
||||
X245820000Y-64172000D01*
|
||||
X247620000Y-63422000D02*
|
||||
X247620000Y-64172000D01*
|
||||
X245820000Y-63422000D02*
|
||||
X247620000Y-63422000D01*
|
||||
X245820000Y-64172000D02*
|
||||
X245820000Y-63422000D01*
|
||||
X241820000Y-64172000D02*
|
||||
X240020000Y-64172000D01*
|
||||
X241820000Y-63422000D02*
|
||||
X241820000Y-64172000D01*
|
||||
X240020000Y-63422000D02*
|
||||
X241820000Y-63422000D01*
|
||||
X240020000Y-64172000D02*
|
||||
X240020000Y-63422000D01*
|
||||
X244320000Y-64172000D02*
|
||||
X243320000Y-64172000D01*
|
||||
X244320000Y-63422000D02*
|
||||
X244320000Y-64172000D01*
|
||||
X243320000Y-63422000D02*
|
||||
X244320000Y-63422000D01*
|
||||
X243320000Y-64172000D02*
|
||||
X243320000Y-63422000D01*
|
||||
X247630000Y-64182000D02*
|
||||
X240010000Y-64182000D01*
|
||||
X247630000Y-58212000D02*
|
||||
X247630000Y-64182000D01*
|
||||
X240010000Y-58212000D02*
|
||||
X247630000Y-58212000D01*
|
||||
X240010000Y-64182000D02*
|
||||
X240010000Y-58212000D01*
|
||||
D12*
|
||||
X244153333Y-64724380D02*
|
||||
X244153333Y-65438666D01*
|
||||
X244200952Y-65581523D01*
|
||||
X244296190Y-65676761D01*
|
||||
X244439047Y-65724380D01*
|
||||
X244534285Y-65724380D01*
|
||||
X243772380Y-64724380D02*
|
||||
X243105714Y-64724380D01*
|
||||
X243534285Y-65724380D01*
|
||||
M02*
|
||||
@@ -1,372 +0,0 @@
|
||||
G04 #@! TF.GenerationSoftware,KiCad,Pcbnew,(5.1.5)-3*
|
||||
G04 #@! TF.CreationDate,2020-11-29T03:44:09+01:00*
|
||||
G04 #@! TF.ProjectId,PlantCtrlESP32,506c616e-7443-4747-926c-45535033322e,rev?*
|
||||
G04 #@! TF.SameCoordinates,Original*
|
||||
G04 #@! TF.FileFunction,Other,Comment*
|
||||
%FSLAX46Y46*%
|
||||
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)*
|
||||
G04 Created by KiCad (PCBNEW (5.1.5)-3) date 2020-11-29 03:44:09*
|
||||
%MOMM*%
|
||||
%LPD*%
|
||||
G04 APERTURE LIST*
|
||||
%ADD10C,0.150000*%
|
||||
G04 APERTURE END LIST*
|
||||
D10*
|
||||
X277589033Y-83880909D02*
|
||||
X277638018Y-83927121D01*
|
||||
X277688390Y-84020933D01*
|
||||
X277695322Y-84258927D01*
|
||||
X277650496Y-84355511D01*
|
||||
X277604283Y-84404496D01*
|
||||
X277510472Y-84454868D01*
|
||||
X277415274Y-84457641D01*
|
||||
X277271091Y-84414201D01*
|
||||
X276683268Y-83859651D01*
|
||||
X276701291Y-84478436D01*
|
||||
X277725822Y-85306102D02*
|
||||
X277720277Y-85115707D01*
|
||||
X277669905Y-85021895D01*
|
||||
X277620920Y-84975683D01*
|
||||
X277475350Y-84884644D01*
|
||||
X277283569Y-84842591D01*
|
||||
X276902778Y-84853682D01*
|
||||
X276808966Y-84904053D01*
|
||||
X276762754Y-84953039D01*
|
||||
X276717928Y-85049623D01*
|
||||
X276723473Y-85240018D01*
|
||||
X276773845Y-85333830D01*
|
||||
X276822830Y-85380042D01*
|
||||
X276919414Y-85424868D01*
|
||||
X277157408Y-85417936D01*
|
||||
X277251220Y-85367565D01*
|
||||
X277297432Y-85318579D01*
|
||||
X277342258Y-85221995D01*
|
||||
X277336713Y-85031600D01*
|
||||
X277286341Y-84937789D01*
|
||||
X277237356Y-84891576D01*
|
||||
X277140772Y-84846750D01*
|
||||
X276836694Y-85856031D02*
|
||||
X276790481Y-85905016D01*
|
||||
X276741496Y-85858803D01*
|
||||
X276787709Y-85809818D01*
|
||||
X276836694Y-85856031D01*
|
||||
X276741496Y-85858803D01*
|
||||
X276770610Y-86858380D02*
|
||||
X276753973Y-86287193D01*
|
||||
X276762292Y-86572786D02*
|
||||
X277761868Y-86543672D01*
|
||||
X277616298Y-86452634D01*
|
||||
X277518328Y-86360209D01*
|
||||
X277467956Y-86266398D01*
|
||||
X277779891Y-87162458D02*
|
||||
X277799300Y-87828842D01*
|
||||
X276787246Y-87429566D01*
|
||||
X277807618Y-88114435D02*
|
||||
X277825641Y-88733220D01*
|
||||
X277435146Y-88411119D01*
|
||||
X277439305Y-88553916D01*
|
||||
X277394479Y-88650500D01*
|
||||
X277348266Y-88699485D01*
|
||||
X277254455Y-88749857D01*
|
||||
X277016460Y-88756788D01*
|
||||
X276919876Y-88711962D01*
|
||||
X276870891Y-88665750D01*
|
||||
X276820519Y-88571939D01*
|
||||
X276812201Y-88286345D01*
|
||||
X276857027Y-88189761D01*
|
||||
X276903240Y-88140776D01*
|
||||
X276860724Y-89952306D02*
|
||||
X277527108Y-89932896D01*
|
||||
X277431911Y-89935669D02*
|
||||
X277480896Y-89981882D01*
|
||||
X277531267Y-90075693D01*
|
||||
X277535427Y-90218489D01*
|
||||
X277490600Y-90315074D01*
|
||||
X277396789Y-90365445D01*
|
||||
X276873202Y-90380695D01*
|
||||
X277396789Y-90365445D02*
|
||||
X277493373Y-90410271D01*
|
||||
X277543745Y-90504083D01*
|
||||
X277547904Y-90646879D01*
|
||||
X277503078Y-90743463D01*
|
||||
X277409267Y-90793835D01*
|
||||
X276885679Y-90809085D01*
|
||||
X276899543Y-91285074D02*
|
||||
X277565927Y-91265664D01*
|
||||
X277470729Y-91268437D02*
|
||||
X277519714Y-91314650D01*
|
||||
X277570086Y-91408461D01*
|
||||
X277574245Y-91551258D01*
|
||||
X277529419Y-91647842D01*
|
||||
X277435608Y-91698213D01*
|
||||
X276912020Y-91713463D01*
|
||||
X277435608Y-91698213D02*
|
||||
X277532192Y-91743039D01*
|
||||
X277582563Y-91836851D01*
|
||||
X277586722Y-91979647D01*
|
||||
X277541896Y-92076231D01*
|
||||
X277448085Y-92126603D01*
|
||||
X276924498Y-92141853D01*
|
||||
X276339010Y-101154029D02*
|
||||
X275577010Y-74992029D01*
|
||||
X269748000Y-101346000D02*
|
||||
X276925182Y-101136956D01*
|
||||
X268986000Y-75184000D02*
|
||||
X276163182Y-74974956D01*
|
||||
X275577010Y-74992029D02*
|
||||
X276195979Y-76100982D01*
|
||||
X275577010Y-74992029D02*
|
||||
X275023635Y-76135128D01*
|
||||
X276339010Y-101154029D02*
|
||||
X276892385Y-100010930D01*
|
||||
X276339010Y-101154029D02*
|
||||
X275720041Y-100045076D01*
|
||||
X283091941Y-71405219D02*
|
||||
X283084973Y-70929080D01*
|
||||
X282608137Y-70888434D01*
|
||||
X282656447Y-70935351D01*
|
||||
X282705455Y-71029882D01*
|
||||
X282708939Y-71267952D01*
|
||||
X282662719Y-71363876D01*
|
||||
X282615801Y-71412187D01*
|
||||
X282521270Y-71461195D01*
|
||||
X282283201Y-71464679D01*
|
||||
X282187276Y-71418458D01*
|
||||
X282138965Y-71371541D01*
|
||||
X282089958Y-71277010D01*
|
||||
X282086474Y-71038940D01*
|
||||
X282132694Y-70943016D01*
|
||||
X282179611Y-70894705D01*
|
||||
X283002984Y-71835138D02*
|
||||
X283051295Y-71882056D01*
|
||||
X283100302Y-71976587D01*
|
||||
X283103786Y-72214656D01*
|
||||
X283057566Y-72310581D01*
|
||||
X283010649Y-72358892D01*
|
||||
X282916118Y-72407899D01*
|
||||
X282820890Y-72409293D01*
|
||||
X282677351Y-72363769D01*
|
||||
X282097622Y-71800763D01*
|
||||
X282106681Y-72419745D01*
|
||||
X282208180Y-72846877D02*
|
||||
X282161262Y-72895187D01*
|
||||
X282112952Y-72848270D01*
|
||||
X282159869Y-72799960D01*
|
||||
X282208180Y-72846877D01*
|
||||
X282112952Y-72848270D01*
|
||||
X283122600Y-73500233D02*
|
||||
X283123993Y-73595461D01*
|
||||
X283077773Y-73691386D01*
|
||||
X283030856Y-73739696D01*
|
||||
X282936325Y-73788704D01*
|
||||
X282746566Y-73839105D01*
|
||||
X282508496Y-73842589D01*
|
||||
X282317343Y-73797762D01*
|
||||
X282221419Y-73751542D01*
|
||||
X282173108Y-73704625D01*
|
||||
X282124100Y-73610094D01*
|
||||
X282122707Y-73514866D01*
|
||||
X282168927Y-73418941D01*
|
||||
X282215844Y-73370630D01*
|
||||
X282310375Y-73321623D01*
|
||||
X282500134Y-73271222D01*
|
||||
X282738204Y-73267738D01*
|
||||
X282929357Y-73312564D01*
|
||||
X283025281Y-73358785D01*
|
||||
X283073592Y-73405702D01*
|
||||
X283122600Y-73500233D01*
|
||||
X283132355Y-74166828D02*
|
||||
X283142110Y-74833424D01*
|
||||
X282135946Y-74419531D01*
|
||||
X283153955Y-75642861D02*
|
||||
X283151168Y-75452405D01*
|
||||
X283102160Y-75357874D01*
|
||||
X283053850Y-75310957D01*
|
||||
X282909614Y-75217819D01*
|
||||
X282718462Y-75172992D01*
|
||||
X282337550Y-75178567D01*
|
||||
X282243019Y-75227574D01*
|
||||
X282196102Y-75275885D01*
|
||||
X282149882Y-75371810D01*
|
||||
X282152669Y-75562265D01*
|
||||
X282201676Y-75656797D01*
|
||||
X282249987Y-75703714D01*
|
||||
X282345912Y-75749934D01*
|
||||
X282583981Y-75746450D01*
|
||||
X282678512Y-75697443D01*
|
||||
X282725430Y-75649132D01*
|
||||
X282771650Y-75553207D01*
|
||||
X282768863Y-75362751D01*
|
||||
X282719855Y-75268220D01*
|
||||
X282671545Y-75221303D01*
|
||||
X282575620Y-75175083D01*
|
||||
X282172876Y-76943070D02*
|
||||
X282839471Y-76933315D01*
|
||||
X282744243Y-76934709D02*
|
||||
X282792554Y-76981626D01*
|
||||
X282841561Y-77076157D01*
|
||||
X282843652Y-77218999D01*
|
||||
X282797431Y-77314923D01*
|
||||
X282702900Y-77363931D01*
|
||||
X282179147Y-77371596D01*
|
||||
X282702900Y-77363931D02*
|
||||
X282798825Y-77410151D01*
|
||||
X282847832Y-77504682D01*
|
||||
X282849923Y-77647524D01*
|
||||
X282803702Y-77743449D01*
|
||||
X282709171Y-77792456D01*
|
||||
X282185418Y-77800121D01*
|
||||
X282192386Y-78276261D02*
|
||||
X282858981Y-78266506D01*
|
||||
X282763753Y-78267899D02*
|
||||
X282812064Y-78314816D01*
|
||||
X282861071Y-78409347D01*
|
||||
X282863162Y-78552189D01*
|
||||
X282816941Y-78648114D01*
|
||||
X282722410Y-78697121D01*
|
||||
X282198657Y-78704786D01*
|
||||
X282722410Y-78697121D02*
|
||||
X282818335Y-78743342D01*
|
||||
X282867342Y-78837873D01*
|
||||
X282869433Y-78980715D01*
|
||||
X282823212Y-79076639D01*
|
||||
X282728681Y-79125647D01*
|
||||
X282204928Y-79133312D01*
|
||||
X281678476Y-101085915D02*
|
||||
X280916476Y-49015915D01*
|
||||
X263906000Y-101346000D02*
|
||||
X282264834Y-101077334D01*
|
||||
X263144000Y-49276000D02*
|
||||
X281502834Y-49007334D01*
|
||||
X280916476Y-49015915D02*
|
||||
X281519318Y-50133717D01*
|
||||
X280916476Y-49015915D02*
|
||||
X280346602Y-50150879D01*
|
||||
X281678476Y-101085915D02*
|
||||
X282248350Y-99950951D01*
|
||||
X281678476Y-101085915D02*
|
||||
X281075634Y-99968113D01*
|
||||
X260308156Y-74045062D02*
|
||||
X259736906Y-74059343D01*
|
||||
X260022531Y-74052203D02*
|
||||
X259997539Y-73052515D01*
|
||||
X259905901Y-73197708D01*
|
||||
X259813073Y-73295296D01*
|
||||
X259719055Y-73345281D01*
|
||||
X260902019Y-73029903D02*
|
||||
X260997227Y-73027523D01*
|
||||
X261093625Y-73072747D01*
|
||||
X261142420Y-73119161D01*
|
||||
X261192404Y-73213179D01*
|
||||
X261244769Y-73402406D01*
|
||||
X261250719Y-73640426D01*
|
||||
X261207875Y-73832033D01*
|
||||
X261162651Y-73928432D01*
|
||||
X261116237Y-73977226D01*
|
||||
X261022219Y-74027210D01*
|
||||
X260927011Y-74029591D01*
|
||||
X260830612Y-73984367D01*
|
||||
X260781818Y-73937953D01*
|
||||
X260731834Y-73843934D01*
|
||||
X260679469Y-73654708D01*
|
||||
X260673519Y-73416687D01*
|
||||
X260716362Y-73225080D01*
|
||||
X260761586Y-73128682D01*
|
||||
X260808000Y-73079887D01*
|
||||
X260902019Y-73029903D01*
|
||||
X261686297Y-73915341D02*
|
||||
X261735092Y-73961755D01*
|
||||
X261688678Y-74010549D01*
|
||||
X261639883Y-73964135D01*
|
||||
X261686297Y-73915341D01*
|
||||
X261688678Y-74010549D01*
|
||||
X262688365Y-73985557D02*
|
||||
X262117115Y-73999838D01*
|
||||
X262402740Y-73992697D02*
|
||||
X262377748Y-72993010D01*
|
||||
X262286110Y-73138202D01*
|
||||
X262193282Y-73235791D01*
|
||||
X262099264Y-73285775D01*
|
||||
X263520248Y-72964447D02*
|
||||
X263329831Y-72969208D01*
|
||||
X263235813Y-73019192D01*
|
||||
X263189399Y-73067986D01*
|
||||
X263097761Y-73213179D01*
|
||||
X263054917Y-73404786D01*
|
||||
X263064438Y-73785619D01*
|
||||
X263114423Y-73879637D01*
|
||||
X263163217Y-73926052D01*
|
||||
X263259615Y-73971276D01*
|
||||
X263450032Y-73966515D01*
|
||||
X263544050Y-73916531D01*
|
||||
X263590464Y-73867736D01*
|
||||
X263635688Y-73771338D01*
|
||||
X263629738Y-73533317D01*
|
||||
X263579753Y-73439299D01*
|
||||
X263530959Y-73392885D01*
|
||||
X263434561Y-73347661D01*
|
||||
X263244144Y-73352421D01*
|
||||
X263150126Y-73402406D01*
|
||||
X263103712Y-73451200D01*
|
||||
X263058488Y-73547598D01*
|
||||
X263948686Y-72953736D02*
|
||||
X264567540Y-72938265D01*
|
||||
X264243832Y-73327429D01*
|
||||
X264386644Y-73323859D01*
|
||||
X264483042Y-73369083D01*
|
||||
X264531837Y-73415497D01*
|
||||
X264581821Y-73509515D01*
|
||||
X264587772Y-73747536D01*
|
||||
X264542548Y-73843934D01*
|
||||
X264496134Y-73892729D01*
|
||||
X264402115Y-73942713D01*
|
||||
X264116490Y-73949854D01*
|
||||
X264020092Y-73904630D01*
|
||||
X263971298Y-73858216D01*
|
||||
X265782636Y-73908200D02*
|
||||
X265765975Y-73241742D01*
|
||||
X265768355Y-73336950D02*
|
||||
X265814769Y-73288156D01*
|
||||
X265908787Y-73238171D01*
|
||||
X266051600Y-73234601D01*
|
||||
X266147998Y-73279825D01*
|
||||
X266197983Y-73373843D01*
|
||||
X266211074Y-73897489D01*
|
||||
X266197983Y-73373843D02*
|
||||
X266243207Y-73277445D01*
|
||||
X266337225Y-73227460D01*
|
||||
X266480038Y-73223890D01*
|
||||
X266576436Y-73269114D01*
|
||||
X266626420Y-73363132D01*
|
||||
X266639512Y-73886778D01*
|
||||
X267115553Y-73874877D02*
|
||||
X267098892Y-73208419D01*
|
||||
X267101272Y-73303627D02*
|
||||
X267147686Y-73254833D01*
|
||||
X267241704Y-73204848D01*
|
||||
X267384517Y-73201278D01*
|
||||
X267480915Y-73246502D01*
|
||||
X267530900Y-73340520D01*
|
||||
X267543991Y-73864166D01*
|
||||
X267530900Y-73340520D02*
|
||||
X267576124Y-73244122D01*
|
||||
X267670142Y-73194137D01*
|
||||
X267812954Y-73190567D01*
|
||||
X267909353Y-73235791D01*
|
||||
X267959337Y-73329809D01*
|
||||
X267972428Y-73853455D01*
|
||||
X268979654Y-74676159D02*
|
||||
X258819654Y-74930159D01*
|
||||
X269240000Y-85090000D02*
|
||||
X268964998Y-74089921D01*
|
||||
X259080000Y-85344000D02*
|
||||
X258804998Y-74343921D01*
|
||||
X258819654Y-74930159D02*
|
||||
X259931150Y-74315768D01*
|
||||
X258819654Y-74930159D02*
|
||||
X259960462Y-75488243D01*
|
||||
X268979654Y-74676159D02*
|
||||
X267838846Y-74118075D01*
|
||||
X268979654Y-74676159D02*
|
||||
X267868158Y-75290550D01*
|
||||
M02*
|
||||
@@ -1,13 +0,0 @@
|
||||
G04 #@! TF.GenerationSoftware,KiCad,Pcbnew,(5.1.5)-3*
|
||||
G04 #@! TF.CreationDate,2020-11-29T03:44:09+01:00*
|
||||
G04 #@! TF.ProjectId,PlantCtrlESP32,506c616e-7443-4747-926c-45535033322e,rev?*
|
||||
G04 #@! TF.SameCoordinates,Original*
|
||||
G04 #@! TF.FileFunction,OtherDrawing,Comment*
|
||||
%FSLAX46Y46*%
|
||||
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)*
|
||||
G04 Created by KiCad (PCBNEW (5.1.5)-3) date 2020-11-29 03:44:09*
|
||||
%MOMM*%
|
||||
%LPD*%
|
||||
G04 APERTURE LIST*
|
||||
G04 APERTURE END LIST*
|
||||
M02*
|
||||
@@ -1,13 +0,0 @@
|
||||
G04 #@! TF.GenerationSoftware,KiCad,Pcbnew,(5.1.5)-3*
|
||||
G04 #@! TF.CreationDate,2020-11-29T03:44:09+01:00*
|
||||
G04 #@! TF.ProjectId,PlantCtrlESP32,506c616e-7443-4747-926c-45535033322e,rev?*
|
||||
G04 #@! TF.SameCoordinates,Original*
|
||||
G04 #@! TF.FileFunction,Other,ECO1*
|
||||
%FSLAX46Y46*%
|
||||
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)*
|
||||
G04 Created by KiCad (PCBNEW (5.1.5)-3) date 2020-11-29 03:44:09*
|
||||
%MOMM*%
|
||||
%LPD*%
|
||||
G04 APERTURE LIST*
|
||||
G04 APERTURE END LIST*
|
||||
M02*
|
||||
@@ -1,13 +0,0 @@
|
||||
G04 #@! TF.GenerationSoftware,KiCad,Pcbnew,(5.1.5)-3*
|
||||
G04 #@! TF.CreationDate,2020-11-29T03:44:09+01:00*
|
||||
G04 #@! TF.ProjectId,PlantCtrlESP32,506c616e-7443-4747-926c-45535033322e,rev?*
|
||||
G04 #@! TF.SameCoordinates,Original*
|
||||
G04 #@! TF.FileFunction,Other,ECO2*
|
||||
%FSLAX46Y46*%
|
||||
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)*
|
||||
G04 Created by KiCad (PCBNEW (5.1.5)-3) date 2020-11-29 03:44:09*
|
||||
%MOMM*%
|
||||
%LPD*%
|
||||
G04 APERTURE LIST*
|
||||
G04 APERTURE END LIST*
|
||||
M02*
|
||||
@@ -1,25 +0,0 @@
|
||||
G04 #@! TF.GenerationSoftware,KiCad,Pcbnew,(5.1.5)-3*
|
||||
G04 #@! TF.CreationDate,2020-11-29T03:44:09+01:00*
|
||||
G04 #@! TF.ProjectId,PlantCtrlESP32,506c616e-7443-4747-926c-45535033322e,rev?*
|
||||
G04 #@! TF.SameCoordinates,Original*
|
||||
G04 #@! TF.FileFunction,Profile,NP*
|
||||
%FSLAX46Y46*%
|
||||
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)*
|
||||
G04 Created by KiCad (PCBNEW (5.1.5)-3) date 2020-11-29 03:44:09*
|
||||
%MOMM*%
|
||||
%LPD*%
|
||||
G04 APERTURE LIST*
|
||||
%ADD10C,0.050000*%
|
||||
G04 APERTURE END LIST*
|
||||
D10*
|
||||
X170180000Y-40640000D02*
|
||||
X269240000Y-40640000D01*
|
||||
X170180000Y-43180000D02*
|
||||
X170180000Y-40640000D01*
|
||||
X170180000Y-139700000D02*
|
||||
X170180000Y-43180000D01*
|
||||
X269240000Y-139700000D02*
|
||||
X269240000Y-40640000D01*
|
||||
X170180000Y-139700000D02*
|
||||
X269240000Y-139700000D01*
|
||||
M02*
|
||||
@@ -1,14 +0,0 @@
|
||||
G04 #@! TF.GenerationSoftware,KiCad,Pcbnew,(5.1.5)-3*
|
||||
G04 #@! TF.CreationDate,2020-11-29T03:44:08+01:00*
|
||||
G04 #@! TF.ProjectId,PlantCtrlESP32,506c616e-7443-4747-926c-45535033322e,rev?*
|
||||
G04 #@! TF.SameCoordinates,Original*
|
||||
G04 #@! TF.FileFunction,Glue,Top*
|
||||
G04 #@! TF.FilePolarity,Positive*
|
||||
%FSLAX46Y46*%
|
||||
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)*
|
||||
G04 Created by KiCad (PCBNEW (5.1.5)-3) date 2020-11-29 03:44:08*
|
||||
%MOMM*%
|
||||
%LPD*%
|
||||
G04 APERTURE LIST*
|
||||
G04 APERTURE END LIST*
|
||||
M02*
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,13 +0,0 @@
|
||||
G04 #@! TF.GenerationSoftware,KiCad,Pcbnew,(5.1.5)-3*
|
||||
G04 #@! TF.CreationDate,2020-11-29T03:44:09+01:00*
|
||||
G04 #@! TF.ProjectId,PlantCtrlESP32,506c616e-7443-4747-926c-45535033322e,rev?*
|
||||
G04 #@! TF.SameCoordinates,Original*
|
||||
G04 #@! TF.FileFunction,Other,User*
|
||||
%FSLAX46Y46*%
|
||||
G04 Gerber Fmt 4.6, Leading zero omitted, Abs format (unit mm)*
|
||||
G04 Created by KiCad (PCBNEW (5.1.5)-3) date 2020-11-29 03:44:09*
|
||||
%MOMM*%
|
||||
%LPD*%
|
||||
G04 APERTURE LIST*
|
||||
G04 APERTURE END LIST*
|
||||
M02*
|
||||
@@ -1,20 +0,0 @@
|
||||
M48
|
||||
; DRILL file {KiCad (5.1.5)-3} date 11/29/20 03:44:10
|
||||
; FORMAT={-:-/ absolute / metric / decimal}
|
||||
; #@! TF.CreationDate,2020-11-29T03:44:10+01:00
|
||||
; #@! TF.GenerationSoftware,Kicad,Pcbnew,(5.1.5)-3
|
||||
; #@! TF.FileFunction,NonPlated,1,2,NPTH
|
||||
FMAT,2
|
||||
METRIC
|
||||
T1C2.390
|
||||
T2C3.450
|
||||
%
|
||||
G90
|
||||
G05
|
||||
T1
|
||||
X251.83Y-62.61
|
||||
T2
|
||||
X188.3Y-62.61
|
||||
X243.5Y-46.61
|
||||
T0
|
||||
M30
|
||||
@@ -1,200 +0,0 @@
|
||||
M48
|
||||
; DRILL file {KiCad (5.1.5)-3} date 11/29/20 03:44:10
|
||||
; FORMAT={-:-/ absolute / metric / decimal}
|
||||
; #@! TF.CreationDate,2020-11-29T03:44:10+01:00
|
||||
; #@! TF.GenerationSoftware,Kicad,Pcbnew,(5.1.5)-3
|
||||
; #@! TF.FileFunction,Plated,1,2,PTH
|
||||
FMAT,2
|
||||
METRIC
|
||||
T1C0.400
|
||||
T2C0.750
|
||||
T3C0.950
|
||||
T4C1.000
|
||||
T5C1.040
|
||||
T6C2.000
|
||||
T7C3.000
|
||||
%
|
||||
G90
|
||||
G05
|
||||
T1
|
||||
X171.45Y-77.724
|
||||
X175.26Y-76.454
|
||||
X176.276Y-66.548
|
||||
X176.784Y-59.944
|
||||
X184.404Y-99.568
|
||||
X185.42Y-122.428
|
||||
X187.706Y-122.428
|
||||
X188.976Y-95.504
|
||||
X188.976Y-98.552
|
||||
X189.794Y-80.208
|
||||
X189.992Y-122.428
|
||||
X191.008Y-54.61
|
||||
X191.262Y-66.548
|
||||
X192.024Y-99.822
|
||||
X192.278Y-88.9
|
||||
X192.278Y-122.428
|
||||
X194.564Y-122.428
|
||||
X195.834Y-77.47
|
||||
X196.85Y-122.428
|
||||
X196.88Y-78.77
|
||||
X197.612Y-135.636
|
||||
X199.136Y-122.428
|
||||
X200.214Y-128.016
|
||||
X200.914Y-129.286
|
||||
X201.93Y-127.0
|
||||
X202.438Y-98.044
|
||||
X208.28Y-65.024
|
||||
X210.12Y-102.616
|
||||
X210.82Y-104.14
|
||||
X211.455Y-59.817
|
||||
X212.32Y-85.598
|
||||
X212.344Y-87.122
|
||||
X213.106Y-92.202
|
||||
X214.122Y-54.356
|
||||
X216.916Y-98.044
|
||||
X220.284Y-92.268
|
||||
X221.234Y-54.61
|
||||
X224.282Y-98.044
|
||||
X226.822Y-85.09
|
||||
X227.396Y-92.268
|
||||
X227.584Y-87.376
|
||||
X231.902Y-98.044
|
||||
X235.016Y-92.268
|
||||
X235.204Y-87.63
|
||||
X236.474Y-80.01
|
||||
X237.38Y-76.344
|
||||
X239.776Y-98.044
|
||||
X241.3Y-87.122
|
||||
X242.25Y-92.268
|
||||
X242.316Y-83.058
|
||||
X247.396Y-98.044
|
||||
X250.886Y-92.268
|
||||
X255.27Y-98.044
|
||||
X257.744Y-92.268
|
||||
X262.636Y-98.044
|
||||
X263.398Y-59.436
|
||||
T2
|
||||
X215.138Y-41.783
|
||||
X216.408Y-41.783
|
||||
X217.678Y-41.783
|
||||
T3
|
||||
X237.49Y-124.54
|
||||
X237.49Y-127.04
|
||||
X237.49Y-129.54
|
||||
X214.63Y-124.54
|
||||
X214.63Y-127.04
|
||||
X214.63Y-129.54
|
||||
X252.73Y-124.54
|
||||
X252.73Y-127.04
|
||||
X252.73Y-129.54
|
||||
X173.99Y-101.6
|
||||
X173.99Y-104.1
|
||||
X173.99Y-106.6
|
||||
X245.11Y-124.54
|
||||
X245.11Y-127.04
|
||||
X245.11Y-129.54
|
||||
X173.99Y-86.36
|
||||
X173.99Y-88.86
|
||||
X173.99Y-91.36
|
||||
X173.99Y-93.86
|
||||
X173.736Y-113.792
|
||||
X173.736Y-116.292
|
||||
X173.736Y-118.792
|
||||
X229.87Y-124.54
|
||||
X229.87Y-127.04
|
||||
X229.87Y-129.54
|
||||
X260.35Y-124.54
|
||||
X260.35Y-127.04
|
||||
X260.35Y-129.54
|
||||
X222.25Y-124.54
|
||||
X222.25Y-127.04
|
||||
X222.25Y-129.54
|
||||
T4
|
||||
X214.63Y-110.53
|
||||
X214.63Y-113.03
|
||||
X229.87Y-110.53
|
||||
X229.87Y-113.03
|
||||
X259.842Y-71.374
|
||||
X259.842Y-73.914
|
||||
X259.842Y-76.454
|
||||
X259.842Y-78.994
|
||||
X237.49Y-110.53
|
||||
X237.49Y-113.03
|
||||
X238.76Y-67.564
|
||||
X241.3Y-67.564
|
||||
X243.84Y-67.564
|
||||
X246.38Y-67.564
|
||||
X186.055Y-133.985
|
||||
X188.595Y-133.985
|
||||
X191.135Y-133.985
|
||||
X193.675Y-133.985
|
||||
X222.25Y-110.53
|
||||
X222.25Y-113.03
|
||||
X252.73Y-110.53
|
||||
X252.73Y-113.03
|
||||
X242.57Y-61.722
|
||||
X245.07Y-61.722
|
||||
X245.11Y-110.53
|
||||
X245.11Y-113.03
|
||||
X260.35Y-110.53
|
||||
X260.35Y-113.03
|
||||
T5
|
||||
X179.705Y-74.855
|
||||
X179.705Y-77.395
|
||||
X179.705Y-79.935
|
||||
X179.705Y-82.475
|
||||
X179.705Y-85.015
|
||||
X179.705Y-87.555
|
||||
X179.705Y-90.095
|
||||
X179.705Y-92.635
|
||||
X179.705Y-95.175
|
||||
X179.705Y-97.715
|
||||
X179.705Y-100.255
|
||||
X179.705Y-102.795
|
||||
X179.705Y-105.335
|
||||
X179.705Y-107.875
|
||||
X179.705Y-110.415
|
||||
X179.705Y-112.955
|
||||
X179.705Y-115.495
|
||||
X179.705Y-118.035
|
||||
X179.705Y-120.575
|
||||
X205.105Y-74.855
|
||||
X205.105Y-77.395
|
||||
X205.105Y-79.935
|
||||
X205.105Y-82.475
|
||||
X205.105Y-85.015
|
||||
X205.105Y-87.555
|
||||
X205.105Y-90.095
|
||||
X205.105Y-92.635
|
||||
X205.105Y-95.175
|
||||
X205.105Y-97.715
|
||||
X205.105Y-100.255
|
||||
X205.105Y-102.795
|
||||
X205.105Y-105.335
|
||||
X205.105Y-107.875
|
||||
X205.105Y-110.415
|
||||
X205.105Y-112.955
|
||||
X205.105Y-115.495
|
||||
X205.105Y-118.035
|
||||
X205.105Y-120.575
|
||||
T6
|
||||
X176.57Y-54.61
|
||||
X255.23Y-54.61
|
||||
T7
|
||||
X173.99Y-44.45
|
||||
X173.99Y-135.636
|
||||
X265.43Y-44.45
|
||||
X265.43Y-135.636
|
||||
T6
|
||||
G00X252.73Y-74.234
|
||||
M15
|
||||
G01X252.73Y-70.234
|
||||
M16
|
||||
G05
|
||||
G00X252.73Y-83.534
|
||||
M15
|
||||
G01X252.73Y-79.534
|
||||
M16
|
||||
G05
|
||||
T0
|
||||
M30
|
||||
@@ -1,3 +1,9 @@
|
||||
EESchema-DOCLIB Version 2.0
|
||||
#
|
||||
$CMP CN61CN33
|
||||
D Microprocessor Reset (active-low) Circuit, SOT-23
|
||||
K reset supervisor
|
||||
F http://www.ti.com/lit/ds/symlink/lm809.pdf
|
||||
$ENDCMP
|
||||
#
|
||||
#End Doc Library
|
||||
|
||||
@@ -1,6 +1,24 @@
|
||||
EESchema-LIBRARY Version 2.4
|
||||
#encoding utf-8
|
||||
#
|
||||
# CN61CN33
|
||||
#
|
||||
DEF CN61CN33 U 0 20 Y Y 1 F N
|
||||
F0 "U" 100 500 50 H V C CNN
|
||||
F1 "CN61CN33" 200 400 50 H V C CNN
|
||||
F2 "Package_TO_SOT_SMD:SOT-23" 300 100 50 H I C CNN
|
||||
F3 "" 300 100 50 H I C CNN
|
||||
$FPLIST
|
||||
SOT?23*
|
||||
$ENDFPLIST
|
||||
DRAW
|
||||
S 200 300 -200 -300 0 1 10 f
|
||||
X RESET 1 0 -400 100 U 50 50 1 1 O
|
||||
X GND 2 300 0 100 L 50 50 1 1 W
|
||||
X VCC 3 0 400 100 D 50 50 1 1 W
|
||||
ENDDRAW
|
||||
ENDDEF
|
||||
#
|
||||
# DS2438
|
||||
#
|
||||
DEF DS2438 U 0 40 Y Y 1 F N
|
||||
|
||||
7
esp32/.vscode/extensions.json
vendored
Normal file
7
esp32/.vscode/extensions.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
// See http://go.microsoft.com/fwlink/?LinkId=827846
|
||||
// for the documentation about the extensions.json format
|
||||
"recommendations": [
|
||||
"platformio.platformio-ide"
|
||||
]
|
||||
}
|
||||
@@ -6,16 +6,19 @@
|
||||
],
|
||||
"settings": {
|
||||
"files.associations": {
|
||||
"functional": "cpp",
|
||||
"*.tcc": "cpp",
|
||||
"map": "cpp",
|
||||
"*.cps": "javascript",
|
||||
"bitset": "cpp",
|
||||
"algorithm": "cpp",
|
||||
"istream": "cpp",
|
||||
"limits": "cpp",
|
||||
"streambuf": "cpp",
|
||||
"functional": "cpp",
|
||||
"string": "cpp",
|
||||
"typeinfo": "cpp",
|
||||
"cmath": "cpp"
|
||||
"cmath": "cpp",
|
||||
"iterator": "cpp"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,34 +46,33 @@
|
||||
/** \addtogroup Configuration
|
||||
* @{
|
||||
*/
|
||||
#define FIRMWARE_VERSION "1.0.10"
|
||||
#define FIRMWARE_VERSION "1.1.0"
|
||||
|
||||
#define ADC_TO_VOLT(adc) ((adc) * 3.3 ) / 4095)
|
||||
#define ADC_TO_VOLT_WITH_MULTI(adc, multi) (((adc)*3.3 * (multi)) / 4095)
|
||||
#define MOIST_SENSOR_MAX_ADC (85 * 4095 / 100)
|
||||
#define MOIST_SENSOR_MIN_ADC (25 * 4095 / 100)
|
||||
|
||||
#define SOLAR_VOLT(adc) ADC_TO_VOLT_WITH_MULTI(adc, 4.0306) /**< 100k and 33k voltage dividor */
|
||||
#define ADC_5V_TO_3V3(adc) ADC_TO_VOLT_WITH_MULTI(adc, 1.69) /**< 33k and 47k8 voltage dividor */
|
||||
#define SOLAR_VOLT_FACTOR 2
|
||||
#define BATTSENSOR_INDEX_SOLAR 0
|
||||
#define BATTSENSOR_INDEX_BATTERY 1
|
||||
#define MS_TO_S 1000
|
||||
|
||||
#define SENSOR_LIPO 34 /**< GPIO 34 (ADC1) */
|
||||
#define SENSOR_SOLAR 35 /**< GPIO 35 (ADC1) */
|
||||
#define SENSOR_PLANT0 12 /**< GPIO 32 (ADC1) */
|
||||
#define SENSOR_PLANT1 14/**< GPIO 33 (ADC1) */
|
||||
#define SENSOR_PLANT2 27 /**< GPIO 25 (ADC2) */
|
||||
#define SENSOR_PLANT0 32 /**< GPIO 32 (ADC1) */
|
||||
#define SENSOR_PLANT1 33 /**< GPIO 33 (ADC1) */
|
||||
#define SENSOR_PLANT2 25 /**< GPIO 25 (ADC2) */
|
||||
#define SENSOR_PLANT3 26 /**< GPIO 26 (ADC2) */
|
||||
#define SENSOR_PLANT4 25 /**< GPIO 27 (ADC2) */
|
||||
#define SENSOR_PLANT5 14 /**< GPIO 14 (ADC2) */
|
||||
#define SENSOR_PLANT6 12 /**< GPIO 12 (ADC2) */
|
||||
#define SENSOR_PLANT4 27 /**< GPIO 27 (ADC2) */
|
||||
#define SENSOR_PLANT5 39 /**< SENSOR_VIN */
|
||||
#define SENSOR_PLANT6 36 /**< SENSOR_VP */
|
||||
|
||||
#define OUTPUT_PUMP0 15 /**< GPIO 23 */
|
||||
#define OUTPUT_PUMP1 5 /**< GPIO 22 */
|
||||
#define OUTPUT_PUMP2 18 /**< GPIO 21 */
|
||||
#define OUTPUT_PUMP0 17 /**< GPIO 17 */
|
||||
#define OUTPUT_PUMP1 5 /**< GPIO 5 */
|
||||
#define OUTPUT_PUMP2 18 /**< GPIO 18 */
|
||||
#define OUTPUT_PUMP3 19 /**< GPIO 19 */
|
||||
#define OUTPUT_PUMP4 21 /**< GPIO 18 */
|
||||
#define OUTPUT_PUMP5 22 /**< GPIO 5 */
|
||||
#define OUTPUT_PUMP6 23 /**< GPIO 15 */
|
||||
#define OUTPUT_PUMP4 21 /**< GPIO 21 */
|
||||
#define OUTPUT_PUMP5 22 /**< GPIO 22 */
|
||||
#define OUTPUT_PUMP6 23 /**< GPIO 23 */
|
||||
|
||||
#define OUTPUT_SENSOR 16 /**< GPIO 16 - Enable Sensors */
|
||||
#define OUTPUT_PUMP 13 /**< GPIO 13 - Enable Pumps */
|
||||
@@ -83,11 +82,12 @@
|
||||
|
||||
#define MIN_TIME_RUNNING 5UL /**< Amount of seconds the controller must stay awoken */
|
||||
#define MAX_PLANTS 7
|
||||
#define MINIMUM_LIPO_VOLT 3.6f /**< Minimum voltage of the Lipo, that must be present */
|
||||
#define MINIMUM_LIPO_VOLT 3.2f /**< Minimum voltage of the Lipo, that must be present */
|
||||
#define NO_LIPO_VOLT 2.0f /**< No Lipo connected */
|
||||
#define MINIMUM_SOLAR_VOLT 4.0f /**< Minimum voltage of the sun, to detect daylight */
|
||||
#define SOLAR_CHARGE_MIN_VOLTAGE 7 /**< Sun is rising (morning detected) */
|
||||
#define SOLAR_CHARGE_MAX_VOLTAGE 9 /**< Sun is shining (noon) */
|
||||
#define VOLT_MAX_BATT 4.2f
|
||||
|
||||
#define MAX_CONFIG_SETTING_ITEMS 50 /**< Parameter, that can be configured in Homie */
|
||||
|
||||
@@ -103,7 +103,6 @@
|
||||
|
||||
#define TEMPERATUR_TIMEOUT 3000 /**< 3 Seconds timeout for the temperatur sensors */
|
||||
#define TEMP_SENSOR_MEASURE_SERIES 5
|
||||
#define VOLT_SENSOR_MEASURE_SERIES 5
|
||||
|
||||
/* @} */
|
||||
#endif
|
||||
119
esp32/include/DS2438.h
Normal file
119
esp32/include/DS2438.h
Normal file
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
* DS2438.h
|
||||
*
|
||||
* by Joe Bechter
|
||||
*
|
||||
* (C) 2012, bechter.com
|
||||
*
|
||||
* All files, software, schematics and designs are provided as-is with no warranty.
|
||||
* All files, software, schematics and designs are for experimental/hobby use.
|
||||
* Under no circumstances should any part be used for critical systems where safety,
|
||||
* life or property depends upon it. You are responsible for all use.
|
||||
* You are free to use, modify, derive or otherwise extend for your own non-commercial purposes provided
|
||||
* 1. No part of this software or design may be used to cause injury or death to humans or animals.
|
||||
* 2. Use is non-commercial.
|
||||
* 3. Credit is given to the author (i.e. portions © bechter.com), and provide a link to the original source.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DS2438_h
|
||||
#define DS2438_h
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <OneWire.h>
|
||||
|
||||
#define DS2438_TEMPERATURE_CONVERSION_COMMAND 0x44
|
||||
#define DS2438_VOLTAGE_CONVERSION_COMMAND 0xb4
|
||||
#define DS2438_WRITE_SCRATCHPAD_COMMAND 0x4e
|
||||
#define DS2438_COPY_SCRATCHPAD_COMMAND 0x48
|
||||
#define DS2438_READ_SCRATCHPAD_COMMAND 0xbe
|
||||
#define DS2438_RECALL_MEMORY_COMMAND 0xb8
|
||||
|
||||
#define PAGE_MIN 0
|
||||
#define PAGE_MAX 7
|
||||
|
||||
#define DS2438_CHA 0
|
||||
#define DS2438_CHB 1
|
||||
|
||||
#define DS2438_MODE_CHA 0x01
|
||||
#define DS2438_MODE_CHB 0x02
|
||||
#define DS2438_MODE_TEMPERATURE 0x04
|
||||
|
||||
#define DS2438_TEMPERATURE_DELAY 10
|
||||
#define DS2438_VOLTAGE_CONVERSION_DELAY 8
|
||||
|
||||
#define DEFAULT_PAGE0(var) uint8_t var[8] { \
|
||||
0b00001011 /* X, ADB=0, NVB=0, TB=0, AD=1, EE=0, CA=1, IAD=1 */, \
|
||||
0, /* Temperatur */ \
|
||||
0, /* Temperatur */ \
|
||||
0, /* Voltage */ \
|
||||
0, /* Voltage */ \
|
||||
0, /* Current */ \
|
||||
0, /* Current */ \
|
||||
0 /* Threashold */ \
|
||||
}
|
||||
|
||||
typedef struct PageOne {
|
||||
uint8_t eleapsedTimerByte0; /**< LSB of timestamp */
|
||||
uint8_t eleapsedTimerByte1;
|
||||
uint8_t eleapsedTimerByte2;
|
||||
uint8_t eleapsedTimerByte3; /**< MSB of timestamp */
|
||||
uint8_t ICA; /**< Integrated Current Accumulator (current flowing into and out of the battery) */
|
||||
uint8_t offsetRegisterByte0; /**< Offset for ADC calibdation */
|
||||
uint8_t offsetRegisterByte1; /**< Offset for ADC calibdation */
|
||||
uint8_t reserved;
|
||||
} PageOne_t;
|
||||
|
||||
typedef struct PageSeven {
|
||||
uint8_t userByte0;
|
||||
uint8_t userByte1;
|
||||
uint8_t userByte2;
|
||||
uint8_t userByte3;
|
||||
uint8_t CCA0; /**< Charging Current Accumulator (CCA) */
|
||||
uint8_t CCA1; /**< Charging Current Accumulator (CCA) */
|
||||
uint8_t DCA0; /**< Discharge Current Accumulator (DCA) */
|
||||
uint8_t DCA1; /**< Discharge Current Accumulator (DCA) */
|
||||
} PageSeven_t;
|
||||
|
||||
typedef uint8_t DeviceAddress[8];
|
||||
|
||||
class DS2438 {
|
||||
public:
|
||||
DS2438(OneWire *ow, float currentShunt);
|
||||
DS2438(OneWire *ow, uint8_t *address);
|
||||
|
||||
void begin();
|
||||
void update();
|
||||
double getTemperature();
|
||||
float getVoltage(int channel=DS2438_CHA);
|
||||
float getCurrent();
|
||||
long getICA();
|
||||
long getCCA();
|
||||
long getDCA();
|
||||
float getAh();
|
||||
boolean isError();
|
||||
boolean isFound();
|
||||
private:
|
||||
bool validAddress(const uint8_t*);
|
||||
bool validFamily(const uint8_t* deviceAddress);
|
||||
|
||||
bool deviceFound = false;
|
||||
OneWire *_ow;
|
||||
DeviceAddress _address;
|
||||
uint8_t _mode;
|
||||
double _temperature;
|
||||
float _voltageA;
|
||||
float _voltageB;
|
||||
float _current;
|
||||
float _currentShunt;
|
||||
long _CCA;
|
||||
long _DCA;
|
||||
long _ICA;
|
||||
boolean _error;
|
||||
boolean startConversion(int channel, boolean doTemperature);
|
||||
boolean selectChannel(int channel);
|
||||
void writePage(int page, uint8_t *data);
|
||||
boolean readPage(int page, uint8_t *data);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -28,6 +28,7 @@
|
||||
#define TEMPERATUR_SENSOR_LIPO "lipo"
|
||||
#define TEMPERATUR_SENSOR_WATER "water"
|
||||
#define TEMPERATUR_SENSOR_OUTSIDE "temp"
|
||||
#define TEMPERATUR_SENSOR_CHIP "chip"
|
||||
#define TEMPERATURE_NAME "Temperature"
|
||||
#define TEMPERATURE_UNIT "°C"
|
||||
|
||||
|
||||
255
esp32/src/DS2438.cpp
Normal file
255
esp32/src/DS2438.cpp
Normal file
@@ -0,0 +1,255 @@
|
||||
/*
|
||||
* DS2438.cpp
|
||||
*
|
||||
* by Joe Bechter
|
||||
*
|
||||
* (C) 2012, bechter.com
|
||||
*
|
||||
* All files, software, schematics and designs are provided as-is with no warranty.
|
||||
* All files, software, schematics and designs are for experimental/hobby use.
|
||||
* Under no circumstances should any part be used for critical systems where safety,
|
||||
* life or property depends upon it. You are responsible for all use.
|
||||
* You are free to use, modify, derive or otherwise extend for your own non-commercial purposes provided
|
||||
* 1. No part of this software or design may be used to cause injury or death to humans or animals.
|
||||
* 2. Use is non-commercial.
|
||||
* 3. Credit is given to the author (i.e. portions © bechter.com), and provide a link to the original source.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "DS2438.h"
|
||||
|
||||
// DSROM FIELDS
|
||||
#define DSROM_FAMILY 0
|
||||
#define DSROM_CRC 7
|
||||
|
||||
#define DS2438MODEL 0x26
|
||||
|
||||
DS2438::DS2438(OneWire *ow, float currentShunt = 1.0f) {
|
||||
_ow = ow;
|
||||
_currentShunt = currentShunt;
|
||||
};
|
||||
|
||||
void DS2438::begin(){
|
||||
DeviceAddress searchDeviceAddress;
|
||||
|
||||
_ow->reset_search();
|
||||
memset(searchDeviceAddress,0, 8);
|
||||
_temperature = 0;
|
||||
_voltageA = 0.0;
|
||||
_voltageB = 0.0;
|
||||
_error = true;
|
||||
_mode = (DS2438_MODE_CHA | DS2438_MODE_CHB | DS2438_MODE_TEMPERATURE);
|
||||
|
||||
deviceFound = false; // Reset the number of devices when we enumerate wire devices
|
||||
|
||||
while (_ow->search(searchDeviceAddress)) {
|
||||
if (validAddress(searchDeviceAddress)) {
|
||||
if (validFamily(searchDeviceAddress)) {
|
||||
memcpy(_address,searchDeviceAddress,8);
|
||||
DEFAULT_PAGE0(defaultConfig);
|
||||
writePage(0, defaultConfig);
|
||||
deviceFound = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool DS2438::isFound(){
|
||||
return deviceFound;
|
||||
}
|
||||
|
||||
bool DS2438::validAddress(const uint8_t* deviceAddress) {
|
||||
return (_ow->crc8(deviceAddress, 7) == deviceAddress[DSROM_CRC]);
|
||||
}
|
||||
|
||||
bool DS2438::validFamily(const uint8_t* deviceAddress) {
|
||||
switch (deviceAddress[DSROM_FAMILY]) {
|
||||
case DS2438MODEL:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void DS2438::update() {
|
||||
uint8_t data[9];
|
||||
|
||||
_error = true;
|
||||
if(!isFound()){
|
||||
return;
|
||||
}
|
||||
|
||||
if (_mode & DS2438_MODE_CHA || _mode == DS2438_MODE_TEMPERATURE) {
|
||||
boolean doTemperature = _mode & DS2438_MODE_TEMPERATURE;
|
||||
if (!startConversion(DS2438_CHA, doTemperature)) {
|
||||
Serial.println("Error starting temp conversion ds2438 channel a");
|
||||
return;
|
||||
}
|
||||
if (!readPage(0, data)){
|
||||
|
||||
Serial.println("Error reading zero page ds2438 channel a");
|
||||
return;
|
||||
}
|
||||
|
||||
if (doTemperature) {
|
||||
_temperature = (double)(((((int16_t)data[2]) << 8) | (data[1] & 0x0ff)) >> 3) * 0.03125;
|
||||
}
|
||||
if (_mode & DS2438_MODE_CHA) {
|
||||
_voltageA = (((data[4] << 8) & 0x00300) | (data[3] & 0x0ff)) / 100.0;
|
||||
}
|
||||
}
|
||||
if (_mode & DS2438_MODE_CHB) {
|
||||
boolean doTemperature = _mode & DS2438_MODE_TEMPERATURE && !(_mode & DS2438_MODE_CHA);
|
||||
if (!startConversion(DS2438_CHB, doTemperature)) {
|
||||
Serial.println("Error starting temp conversion channel b ds2438");
|
||||
return;
|
||||
}
|
||||
if (!readPage(0, data)){
|
||||
Serial.println("Error reading zero page ds2438 channel b");
|
||||
return;
|
||||
}
|
||||
if (doTemperature) {
|
||||
int16_t upperByte = ((int16_t)data[2]) << 8;
|
||||
int16_t lowerByte = data[1] >> 3;
|
||||
int16_t fullByte = (upperByte | lowerByte);
|
||||
_temperature = ((double)fullByte) * 0.03125;
|
||||
}
|
||||
_voltageB = (((data[4] << 8) & 0x00300) | (data[3] & 0x0ff)) / 100.0;
|
||||
}
|
||||
|
||||
int16_t upperByte = ((int16_t)data[6]) << 8;
|
||||
int16_t lowerByte = data[5];
|
||||
int16_t fullByte = (int16_t)(upperByte | lowerByte);
|
||||
float fullByteb = fullByte;
|
||||
_current = (fullByteb) / ((4096.0f * _currentShunt));
|
||||
_error = false;
|
||||
|
||||
if (readPage(1, data)){
|
||||
PageOne_t *pOne = (PageOne_t *) data;
|
||||
_ICA = pOne->ICA;
|
||||
}
|
||||
|
||||
if (readPage(7, data)){
|
||||
PageSeven_t *pSeven = (PageSeven_t *) data;
|
||||
_CCA = pSeven->CCA0 | ((int16_t) pSeven->CCA1) << 8;
|
||||
_DCA = pSeven->DCA0 | ((int16_t) pSeven->DCA1) << 8;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
double DS2438::getTemperature() {
|
||||
return _temperature;
|
||||
}
|
||||
|
||||
float DS2438::getAh(){
|
||||
return _ICA / (2048.0f * _currentShunt);
|
||||
}
|
||||
|
||||
long DS2438::getICA(){
|
||||
return _ICA;
|
||||
}
|
||||
|
||||
long DS2438::getDCA(){
|
||||
return _DCA;
|
||||
}
|
||||
|
||||
long DS2438::getCCA(){
|
||||
return _CCA;
|
||||
}
|
||||
|
||||
|
||||
float DS2438::getVoltage(int channel) {
|
||||
if (channel == DS2438_CHA) {
|
||||
return _voltageA;
|
||||
} else if (channel == DS2438_CHB) {
|
||||
return _voltageB;
|
||||
} else {
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
float DS2438::getCurrent() {
|
||||
return _current;
|
||||
}
|
||||
|
||||
boolean DS2438::isError() {
|
||||
return _error;
|
||||
}
|
||||
|
||||
boolean DS2438::startConversion(int channel, boolean doTemperature) {
|
||||
if(!isFound()){
|
||||
return false;
|
||||
}
|
||||
if (!selectChannel(channel)){
|
||||
return false;
|
||||
}
|
||||
_ow->reset();
|
||||
_ow->select(_address);
|
||||
if (doTemperature) {
|
||||
_ow->write(DS2438_TEMPERATURE_CONVERSION_COMMAND, 0);
|
||||
delay(DS2438_TEMPERATURE_DELAY);
|
||||
_ow->reset();
|
||||
_ow->select(_address);
|
||||
}
|
||||
_ow->write(DS2438_VOLTAGE_CONVERSION_COMMAND, 0);
|
||||
delay(DS2438_VOLTAGE_CONVERSION_DELAY);
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean DS2438::selectChannel(int channel) {
|
||||
if(!isFound()){
|
||||
return false;
|
||||
}
|
||||
uint8_t data[9];
|
||||
if (readPage(0, data)) {
|
||||
if (channel == DS2438_CHB){
|
||||
data[0] = data[0] | 0x08;
|
||||
}
|
||||
else {
|
||||
data[0] = data[0] & 0xf7;
|
||||
}
|
||||
writePage(0, data);
|
||||
return true;
|
||||
}
|
||||
Serial.println("Could not read page zero data");
|
||||
return false;
|
||||
}
|
||||
|
||||
void DS2438::writePage(int page, uint8_t *data) {
|
||||
_ow->reset();
|
||||
_ow->select(_address);
|
||||
_ow->write(DS2438_WRITE_SCRATCHPAD_COMMAND, 0);
|
||||
if ((page >= PAGE_MIN) && (page <= PAGE_MAX)) {
|
||||
_ow->write(page, 0);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < 8; i++){
|
||||
_ow->write(data[i], 0);
|
||||
}
|
||||
_ow->reset();
|
||||
_ow->select(_address);
|
||||
_ow->write(DS2438_COPY_SCRATCHPAD_COMMAND, 0);
|
||||
_ow->write(page, 0);
|
||||
}
|
||||
|
||||
boolean DS2438::readPage(int page, uint8_t *data) {
|
||||
//TODO if all data is 0 0 is a valid crc, but most likly not as intended
|
||||
_ow->reset();
|
||||
_ow->select(_address);
|
||||
_ow->write(DS2438_RECALL_MEMORY_COMMAND, 0);
|
||||
if ((page >= PAGE_MIN) && (page <= PAGE_MAX)) {
|
||||
_ow->write(page, 0);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
_ow->reset();
|
||||
_ow->select(_address);
|
||||
_ow->write(DS2438_READ_SCRATCHPAD_COMMAND, 0);
|
||||
_ow->write(page, 0);
|
||||
for (int i = 0; i < 9; i++){
|
||||
data[i] = _ow->read();
|
||||
}
|
||||
return _ow->crc8(data, 8) == data[8];
|
||||
}
|
||||
|
||||
@@ -25,75 +25,58 @@
|
||||
#include <stdint.h>
|
||||
#include <math.h>
|
||||
#include <OneWire.h>
|
||||
#include "DS2438.h"
|
||||
|
||||
/******************************************************************************
|
||||
* DEFINES
|
||||
******************************************************************************/
|
||||
#define AMOUNT_SENOR_QUERYS 8
|
||||
#define SENSOR_QUERY_SHIFTS 3
|
||||
#define SOLAR4SENSORS 6.0f
|
||||
#define TEMP_INIT_VALUE -999.0f
|
||||
#define TEMP_MAX_VALUE 85.0f
|
||||
#define HalfHour 60
|
||||
|
||||
/******************************************************************************
|
||||
* TYPE DEFS
|
||||
******************************************************************************/
|
||||
typedef struct
|
||||
{
|
||||
long lastActive; /**< Timestamp, a pump was activated */
|
||||
long moistTrigger; /**< Trigger value of the moist sensor */
|
||||
long moisture; /**< last measured moist value */
|
||||
|
||||
} rtc_plant_t;
|
||||
#define MAX_TANK_DEPTH 1000
|
||||
|
||||
/******************************************************************************
|
||||
* FUNCTION PROTOTYPES
|
||||
******************************************************************************/
|
||||
|
||||
int determineNextPump();
|
||||
void setLastActivationForPump(int pumpId, long time);
|
||||
//void setLastActivationForPump(int pumpId, long time);
|
||||
int readTemp();
|
||||
|
||||
/******************************************************************************
|
||||
* NON VOLATILE VARIABLES in DEEP SLEEP
|
||||
******************************************************************************/
|
||||
|
||||
RTC_DATA_ATTR rtc_plant_t rtcPlant[MAX_PLANTS];
|
||||
RTC_DATA_ATTR long gotoMode2AfterThisTimestamp = 0;
|
||||
RTC_DATA_ATTR long rtcDeepSleepTime = 0; /**< Time, when the microcontroller shall be up again */
|
||||
//only relevant if mode2 did start pumping before
|
||||
RTC_DATA_ATTR int lastPumpRunning = 0;
|
||||
RTC_DATA_ATTR long lastWaterValue = 0;
|
||||
RTC_DATA_ATTR float rtcLastLipoTemp = 0.0f;
|
||||
RTC_DATA_ATTR float rtcLastWaterTemp = 0.0f;
|
||||
RTC_DATA_ATTR float rtcLastBatteryVoltage = 0.0f;
|
||||
RTC_DATA_ATTR float rtcLastSolarVoltage = 0.0f;
|
||||
|
||||
RTC_DATA_ATTR int gBootCount = 0;
|
||||
RTC_DATA_ATTR int gCurrentPlant = 0; /**< Value Range: 1 ... 7 (0: no plant needs water) */
|
||||
RTC_DATA_ATTR int rtcLipoTempIndex = -1;
|
||||
|
||||
//FIXME use -1 and configure properly
|
||||
RTC_DATA_ATTR int rtcLipoTempIndex = 0;
|
||||
RTC_DATA_ATTR int rtcWaterTempIndex = -1;
|
||||
|
||||
/******************************************************************************
|
||||
* LOCAL VARIABLES
|
||||
******************************************************************************/
|
||||
const unsigned long TEMPREADCYCLE = 30000; /**< Check temperature all half minutes */
|
||||
|
||||
int wakeUpReason = WAKEUP_REASON_UNDEFINED;
|
||||
bool volatile mode3Active = false; /**< Controller must not sleep */
|
||||
bool volatile mDeepsleep = false;
|
||||
|
||||
int readCounter = 0;
|
||||
bool mConfigured = false;
|
||||
long nextBlink = 0; /**< Time needed in main loop to support expected blink code */
|
||||
long nextBlink = 0; /**< Time needed in main loop to support expected blink code */
|
||||
|
||||
RunningMedian lipoRawSensor = RunningMedian(VOLT_SENSOR_MEASURE_SERIES);
|
||||
RunningMedian solarRawSensor = RunningMedian(VOLT_SENSOR_MEASURE_SERIES);
|
||||
RunningMedian waterRawSensor = RunningMedian(5);
|
||||
RunningMedian lipoTempSensor = RunningMedian(TEMP_SENSOR_MEASURE_SERIES);
|
||||
RunningMedian waterTempSensor = RunningMedian(TEMP_SENSOR_MEASURE_SERIES);
|
||||
float mTempLipo = 0.0f;
|
||||
float mTempWater = 0.0f;
|
||||
float mBatteryVoltage = 0.0f;
|
||||
float mSolarVoltage = 0.0f;
|
||||
float mChipTemp = 0.0f;
|
||||
|
||||
/*************************** Hardware abstraction *****************************/
|
||||
|
||||
OneWire oneWire(SENSOR_DS18B20);
|
||||
DallasTemperature sensors(&oneWire);
|
||||
DS2438 battery(&oneWire, 0.1f);
|
||||
|
||||
Plant mPlants[MAX_PLANTS] = {
|
||||
Plant(SENSOR_PLANT0, OUTPUT_PUMP0, 0, &plant0, &mSetting0),
|
||||
@@ -107,88 +90,6 @@ Plant mPlants[MAX_PLANTS] = {
|
||||
/******************************************************************************
|
||||
* LOCAL FUNCTIONS
|
||||
******************************************************************************/
|
||||
|
||||
float getBatteryVoltage()
|
||||
{
|
||||
return ADC_5V_TO_3V3(lipoRawSensor.getAverage());
|
||||
}
|
||||
|
||||
float getSolarVoltage()
|
||||
{
|
||||
return SOLAR_VOLT(solarRawSensor.getAverage());
|
||||
}
|
||||
|
||||
void setMoistureTrigger(int plantId, long value)
|
||||
{
|
||||
if ((plantId >= 0) && (plantId < MAX_PLANTS))
|
||||
{
|
||||
rtcPlant[plantId].moistTrigger = value;
|
||||
}
|
||||
}
|
||||
|
||||
void setLastMoisture(int plantId, long value)
|
||||
{
|
||||
if ((plantId >= 0) && (plantId < MAX_PLANTS))
|
||||
{
|
||||
rtcPlant[plantId].moisture = value;
|
||||
}
|
||||
}
|
||||
|
||||
long getLastMoisture(int plantId)
|
||||
{
|
||||
if ((plantId >= 0) && (plantId < MAX_PLANTS))
|
||||
{
|
||||
return rtcPlant[plantId].moisture;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
long getDistance()
|
||||
{
|
||||
byte startByte, h_data, l_data, sum;
|
||||
byte buf[3];
|
||||
|
||||
startByte = (byte)Serial.read();
|
||||
if (startByte == 255)
|
||||
{
|
||||
unsigned int distance;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read Voltage
|
||||
* Read the battery voltage and the current voltage, provided by the solar panel
|
||||
*/
|
||||
void readSystemSensors()
|
||||
{
|
||||
for (int i = 0; i < VOLT_SENSOR_MEASURE_SERIES; i++)
|
||||
{
|
||||
lipoRawSensor.add(analogRead(SENSOR_LIPO));
|
||||
solarRawSensor.add(analogRead(SENSOR_SOLAR));
|
||||
}
|
||||
Serial << "Lipo " << lipoRawSensor.getAverage() << " -> " << getBatteryVoltage() << endl;
|
||||
}
|
||||
|
||||
long getCurrentTime()
|
||||
{
|
||||
struct timeval tv_now;
|
||||
@@ -218,16 +119,17 @@ void espDeepSleepFor(long seconds, bool activatePump = false)
|
||||
}
|
||||
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_OFF);
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_FAST_MEM, ESP_PD_OPTION_OFF);
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_XTAL, ESP_PD_OPTION_ON);
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_ON);
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_FAST_MEM, ESP_PD_OPTION_ON);
|
||||
if (activatePump)
|
||||
{
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_XTAL, ESP_PD_OPTION_ON);
|
||||
gpio_deep_sleep_hold_en();
|
||||
gpio_hold_en(GPIO_NUM_13); //pump pwr
|
||||
}
|
||||
else
|
||||
{
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_FAST_MEM, ESP_PD_OPTION_OFF);
|
||||
gpio_hold_dis(GPIO_NUM_13); //pump pwr
|
||||
gpio_deep_sleep_hold_dis();
|
||||
digitalWrite(OUTPUT_PUMP, LOW);
|
||||
@@ -244,28 +146,21 @@ void espDeepSleepFor(long seconds, bool activatePump = false)
|
||||
Serial.print(seconds);
|
||||
Serial.println(" seconds");
|
||||
esp_sleep_enable_timer_wakeup((seconds * 1000U * 1000U));
|
||||
|
||||
mDeepsleep = true;
|
||||
}
|
||||
|
||||
void mode2MQTT()
|
||||
{
|
||||
readSystemSensors();
|
||||
|
||||
digitalWrite(OUTPUT_PUMP, LOW);
|
||||
for (int i = 0; i < MAX_PLANTS; i++)
|
||||
{
|
||||
mPlants[i].deactivatePump();
|
||||
}
|
||||
|
||||
if (deepSleepTime.get())
|
||||
{
|
||||
Serial << "deepsleep time is configured to " << deepSleepTime.get() << endl;
|
||||
}
|
||||
/* Publish default values */
|
||||
|
||||
if (lastPumpRunning != -1)
|
||||
{
|
||||
long waterDiff = waterRawSensor.getAverage() - lastWaterValue;
|
||||
//long waterDiff = waterRawSensor.getAverage() - lastWaterValue;
|
||||
//TODO attribute used water in ml to plantid
|
||||
}
|
||||
for (int i = 0; i < MAX_PLANTS; i++)
|
||||
@@ -292,85 +187,26 @@ void mode2MQTT()
|
||||
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()));
|
||||
sensorSolar.setProperty("percent").send(String((100 * solarRawSensor.getAverage()) / 4095));
|
||||
sensorSolar.setProperty("volt").send(String(getSolarVoltage()));
|
||||
startupReason.setProperty("startupReason").send(String(wakeUpReason));
|
||||
sensorLipo.setProperty("percent").send(String(100 * mBatteryVoltage / VOLT_MAX_BATT));
|
||||
sensorLipo.setProperty("volt").send(String(mBatteryVoltage));
|
||||
sensorLipo.setProperty("current").send(String(battery.getCurrent()));
|
||||
sensorLipo.setProperty("Ah").send(String(battery.getAh()));
|
||||
sensorLipo.setProperty("ICA").send(String(battery.getICA()));
|
||||
sensorLipo.setProperty("DCA").send(String(battery.getDCA()));
|
||||
sensorLipo.setProperty("CCA").send(String(battery.getCCA()));
|
||||
sensorSolar.setProperty("volt").send(String(mSolarVoltage));
|
||||
|
||||
rtcLipoTempIndex = lipoSensorIndex.get();
|
||||
rtcWaterTempIndex = waterSensorIndex.get();
|
||||
|
||||
float lipoTempCurrent = lipoTempSensor.getMedian();
|
||||
float t2 = NAN;
|
||||
if (! isnan(lipoTempCurrent))
|
||||
{
|
||||
sensorTemp.setProperty(TEMPERATUR_SENSOR_LIPO).send(String(lipoTempCurrent));
|
||||
Serial << "Lipo Temperatur " << lipoTempCurrent << " °C " << endl;
|
||||
sensorTemp.setProperty(TEMPERATUR_SENSOR_LIPO).send(String(mTempLipo));
|
||||
Serial << "Lipo Temperatur " << mTempLipo << " °C " << endl;
|
||||
|
||||
t2 = waterTempSensor.getMedian();
|
||||
if (! isnan(t2))
|
||||
{
|
||||
sensorTemp.setProperty(TEMPERATUR_SENSOR_WATER).send(String(t2));
|
||||
Serial << "Water Temperatur " << lipoTempCurrent << " °C " << endl;
|
||||
}
|
||||
//give mqtt time, use via publish callback instead?
|
||||
delay(100);
|
||||
} else {
|
||||
int j=0;
|
||||
/* Activate the Sensors and measure the temperature again */
|
||||
/* activate all sensors */
|
||||
pinMode(OUTPUT_SENSOR, OUTPUT);
|
||||
digitalWrite(OUTPUT_SENSOR, HIGH);
|
||||
sensorTemp.setProperty(TEMPERATUR_SENSOR_WATER).send(String(mTempWater));
|
||||
Serial << "Water Temperatur " << mTempWater << " °C " << endl;
|
||||
|
||||
delay(100);
|
||||
sensors.begin();
|
||||
|
||||
for(j=0; j < TEMP_SENSOR_MEASURE_SERIES && sensors.getDeviceCount() == 0; j++) {
|
||||
delay(100);
|
||||
sensors.begin();
|
||||
Serial << "Reset 1-Wire Bus" << endl;
|
||||
}
|
||||
|
||||
for(j=0; j < TEMP_SENSOR_MEASURE_SERIES && isnan(lipoTempCurrent); j++) {
|
||||
delay(200);
|
||||
readTemp();
|
||||
lipoTempCurrent = lipoTempSensor.getMedian();
|
||||
t2 = waterTempSensor.getMedian();
|
||||
Serial << "Temperatur Lipo:" << lipoTempCurrent << " °C Water : " << t2 << " °C" << endl;
|
||||
}
|
||||
|
||||
if (! isnan(lipoTempCurrent))
|
||||
{
|
||||
sensorTemp.setProperty(TEMPERATUR_SENSOR_LIPO).send(String(lipoTempCurrent));
|
||||
Serial << "Lipo Temperatur " << lipoTempCurrent << " °C " << endl;
|
||||
|
||||
t2 = waterTempSensor.getMedian();
|
||||
if (! isnan(t2))
|
||||
{
|
||||
sensorTemp.setProperty(TEMPERATUR_SENSOR_WATER).send(String(t2));
|
||||
Serial << "Water Temperatur " << lipoTempCurrent << " °C " << endl;
|
||||
}
|
||||
}
|
||||
|
||||
/* deactivate the sensors */
|
||||
digitalWrite(OUTPUT_SENSOR, LOW);
|
||||
}
|
||||
|
||||
if (! isnan(lipoTempCurrent) && ! isnan(t2)) {
|
||||
bool lipoTempWarning = (lipoTempCurrent != LIPO_MAX_TEMPERATUR) && abs(lipoTempCurrent - t2) > LIPO_MAX_TEMPERATUR_DIFF;
|
||||
if (lipoTempWarning)
|
||||
{
|
||||
Serial.println("Lipo temp incorrect, panic mode deepsleep TODO");
|
||||
//espDeepSleepFor(PANIK_MODE_DEEPSLEEP);
|
||||
//return;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAX_PLANTS; i++)
|
||||
{
|
||||
setMoistureTrigger(i, mPlants[i].mSetting->pSensorDry->get());
|
||||
}
|
||||
sensorTemp.setProperty(TEMPERATUR_SENSOR_CHIP).send(String(mChipTemp));
|
||||
Serial << "Chip Temperatur " << mChipTemp << " °C " << endl;
|
||||
|
||||
bool hasWater = true; //FIXMEmWaterGone > waterLevelMin.get();
|
||||
//FIXME no water warning message
|
||||
@@ -388,162 +224,109 @@ void mode2MQTT()
|
||||
else
|
||||
{
|
||||
digitalWrite(OUTPUT_PUMP, HIGH);
|
||||
setLastActivationForPump(lastPumpRunning, getCurrentTime());
|
||||
//TODO setLastActivationForPump(lastPumpRunning, getCurrentTime());
|
||||
mPlants[lastPumpRunning].activatePump();
|
||||
}
|
||||
}
|
||||
|
||||
if (lastPumpRunning == -1 || !hasWater)
|
||||
{
|
||||
if (getSolarVoltage() < SOLAR_CHARGE_MIN_VOLTAGE)
|
||||
if (mSolarVoltage < SOLAR_CHARGE_MIN_VOLTAGE)
|
||||
{
|
||||
gotoMode2AfterThisTimestamp = getCurrentTime() + maxTimeBetweenMQTTUpdates.get();
|
||||
Serial.println("No pumps to activate and low light, deepSleepNight");
|
||||
Serial.print(mSolarVoltage);
|
||||
Serial.println("V! No pumps to activate and low light, deepSleepNight");
|
||||
espDeepSleepFor(deepSleepNightTime.get());
|
||||
rtcDeepSleepTime = deepSleepNightTime.get();
|
||||
}
|
||||
else
|
||||
{
|
||||
gotoMode2AfterThisTimestamp = getCurrentTime() + maxTimeBetweenMQTTUpdates.get();
|
||||
Serial.println("No pumps to activate, deepSleep");
|
||||
espDeepSleepFor(deepSleepTime.get());
|
||||
rtcDeepSleepTime = deepSleepTime.get();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gotoMode2AfterThisTimestamp = 0;
|
||||
Serial.println("Running pump, watering deepsleep");
|
||||
espDeepSleepFor(wateringDeepSleep.get(), true);
|
||||
}
|
||||
}
|
||||
|
||||
long getMoistureTrigger(int plantId)
|
||||
{
|
||||
if ((plantId >= 0) && (plantId < MAX_PLANTS))
|
||||
{
|
||||
return rtcPlant[plantId].moistTrigger;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
void setLastActivationForPump(int plantId, long value)
|
||||
{
|
||||
if ((plantId >= 0) && (plantId < MAX_PLANTS))
|
||||
{
|
||||
rtcPlant[plantId].lastActive = value;
|
||||
}
|
||||
}
|
||||
|
||||
long getLastActivationForPump(int plantId)
|
||||
{
|
||||
if ((plantId >= 0) && (plantId < MAX_PLANTS))
|
||||
{
|
||||
return rtcPlant[plantId].lastActive;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read ultra sensor JSN-SR04T-2.0
|
||||
* Read the distance of the water level.
|
||||
*/
|
||||
void readDistance()
|
||||
{
|
||||
for (int i = 0; i < 5; i++)
|
||||
for (int i = 0; i < AMOUNT_SENOR_QUERYS; i++)
|
||||
{
|
||||
long start = millis();
|
||||
while (!Serial.available())
|
||||
{
|
||||
if ((start + 500) < millis())
|
||||
{
|
||||
Serial << "Abort reading hall sensor, not measurement after 200ms" << endl;
|
||||
waterRawSensor.add(0);
|
||||
return;
|
||||
}
|
||||
}
|
||||
unsigned int distance = getDistance();
|
||||
if (distance > 0)
|
||||
{
|
||||
waterRawSensor.add(distance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief read all temperatur sensors
|
||||
*
|
||||
* @return int
|
||||
* <code>0</code> device can sleep, no change in the temperatures
|
||||
* <code>1</code> something changed and the temperatures shall be published via MQTT
|
||||
*/
|
||||
int readTemp() {
|
||||
int readAgain = TEMP_SENSOR_MEASURE_SERIES;
|
||||
int sensorCount = sensors.getDeviceCount();
|
||||
int leaveMode1 = 0;
|
||||
unsigned long duration = 0;
|
||||
|
||||
while (readAgain > 0)
|
||||
{
|
||||
sensors.requestTemperatures();
|
||||
if (sensorCount > 0)
|
||||
{
|
||||
if (rtcLipoTempIndex != -1)
|
||||
{
|
||||
float temp1Raw = sensors.getTempCByIndex(rtcLipoTempIndex);
|
||||
//Serial << "lipoTempCurrent: " << temp1Raw << endl;
|
||||
lipoTempSensor.add(temp1Raw);
|
||||
}
|
||||
else
|
||||
{
|
||||
Serial << "missing lipotemp, proceed to mode2: " << endl;
|
||||
leaveMode1 = 1;
|
||||
readAgain = 0;
|
||||
wakeUpReason = WAKEUP_REASON_RTC_MISSING;
|
||||
}
|
||||
} else {
|
||||
Serial << "No Sensors detected" << endl;
|
||||
return 1;
|
||||
}
|
||||
digitalWrite(triggerPin, HIGH);
|
||||
delayMicroseconds(20);
|
||||
cli();
|
||||
digitalWrite(triggerPin, LOW);
|
||||
duration = pulseIn(echoPin, HIGH);
|
||||
sei();
|
||||
|
||||
if (sensorCount > 1 && rtcWaterTempIndex != -1)
|
||||
{
|
||||
float temp2Raw = sensors.getTempCByIndex(rtcWaterTempIndex);
|
||||
//Serial << "waterTempCurrent: " << temp2Raw << endl;
|
||||
waterTempSensor.add(temp2Raw);
|
||||
int mmDis = duration * 0.3432 / 2;
|
||||
if(mmDis > MAX_TANK_DEPTH){
|
||||
waterRawSensor.add(0);
|
||||
} else {
|
||||
waterRawSensor.add(mmDis);
|
||||
}
|
||||
|
||||
readAgain--;
|
||||
delay(50);
|
||||
}
|
||||
return leaveMode1;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Sensors, that are connected to GPIOs, mandatory for WIFI.
|
||||
* These sensors (ADC2) can only be read when no Wifi is used.
|
||||
*/
|
||||
bool readSensors()
|
||||
void readSensors()
|
||||
{
|
||||
bool leaveMode1 = false;
|
||||
Serial << "Read Sensors" << endl;
|
||||
/* activate all sensors */
|
||||
digitalWrite(OUTPUT_SENSOR, HIGH);
|
||||
/* wait before reading something */
|
||||
delay(20);
|
||||
|
||||
int timeoutTemp = millis() + TEMPERATUR_TIMEOUT;
|
||||
int sensorCount = 0;
|
||||
|
||||
Serial << "Read Sensors" << endl;
|
||||
|
||||
readSystemSensors();
|
||||
/* Required to read the temperature at least once */
|
||||
while ((sensorCount == 0 || !battery.isFound()) && millis() < timeoutTemp)
|
||||
{
|
||||
sensors.begin();
|
||||
battery.begin();
|
||||
sensorCount = sensors.getDS18Count();
|
||||
delay(50);
|
||||
}
|
||||
|
||||
/* activate all sensors */
|
||||
pinMode(OUTPUT_SENSOR, OUTPUT);
|
||||
digitalWrite(OUTPUT_SENSOR, HIGH);
|
||||
Serial << "One wire count: " << sensorCount << " found in " << (millis() - timeoutTemp) << "ms" << endl;
|
||||
/* Measure temperature */
|
||||
if (sensorCount > 0)
|
||||
{
|
||||
sensors.requestTemperatures();
|
||||
}
|
||||
|
||||
for (int i = 0; i < sensorCount; i++) {
|
||||
float temp = sensors.getTempCByIndex(i);
|
||||
Serial << "OneWire sensor " << i << " has value " << temp << endl;
|
||||
if (rtcWaterTempIndex != -1 && rtcWaterTempIndex == i) {
|
||||
mTempWater = temp;
|
||||
}
|
||||
if (rtcLipoTempIndex != -1 && rtcLipoTempIndex == i) {
|
||||
mTempLipo = temp;
|
||||
}
|
||||
}
|
||||
|
||||
// Update battery chip data
|
||||
battery.update();
|
||||
mSolarVoltage = battery.getVoltage(BATTSENSOR_INDEX_SOLAR) * SOLAR_VOLT_FACTOR;
|
||||
mBatteryVoltage = battery.getVoltage(BATTSENSOR_INDEX_BATTERY);
|
||||
mChipTemp = battery.getTemperature();
|
||||
// if(mBatteryVoltage < MINIMUM_LIPO_VOLT){
|
||||
// Serial.println("Low lipo voltage, abort high level processing");
|
||||
// }
|
||||
|
||||
delay(20);
|
||||
sensors.begin();
|
||||
/* wait before reading something */
|
||||
for (int readCnt = 0; readCnt < AMOUNT_SENOR_QUERYS; readCnt++)
|
||||
{
|
||||
for (int i = 0; i < MAX_PLANTS; i++)
|
||||
@@ -553,81 +336,12 @@ bool readSensors()
|
||||
delay(10);
|
||||
}
|
||||
|
||||
for (int i = 0; i < MAX_PLANTS; i++)
|
||||
{
|
||||
long current = mPlants[i].getCurrentMoisture();
|
||||
long delta = abs(getLastMoisture(i) - current);
|
||||
bool tmp = (delta > MOIST_DELTA_TRIGGER_ADC);
|
||||
setLastMoisture(i, current);
|
||||
if (tmp)
|
||||
{
|
||||
wakeUpReason = WAKEUP_REASON_MOIST_CHANGE + i;
|
||||
leaveMode1 = true;
|
||||
Serial.printf("Mode2 start due to moist delta in plant %d with %ld \r\n", i, delta);
|
||||
}
|
||||
}
|
||||
|
||||
if (abs(getBatteryVoltage() - rtcLastBatteryVoltage) > LIPO_DELTA_VOLT_ADC)
|
||||
{
|
||||
wakeUpReason = WAKEUP_REASON_BATTERY_CHANGE;
|
||||
leaveMode1 = true;
|
||||
}
|
||||
if (abs(getSolarVoltage() - rtcLastSolarVoltage) > SOLAR_DELTA_VOLT_ADC)
|
||||
{
|
||||
wakeUpReason = WAKEUP_REASON_SOLAR_CHANGE;
|
||||
leaveMode1 = true;
|
||||
}
|
||||
|
||||
rtcLastLipoTemp = lipoTempSensor.getAverage();
|
||||
rtcLastWaterTemp = waterTempSensor.getAverage();
|
||||
rtcLastBatteryVoltage = getBatteryVoltage();
|
||||
rtcLastSolarVoltage = getSolarVoltage();
|
||||
|
||||
/* Required to read the temperature at least once */
|
||||
while (sensorCount == 0 && millis() < timeoutTemp)
|
||||
{
|
||||
sensors.begin();
|
||||
sensorCount = sensors.getDeviceCount();
|
||||
Serial << "Waitloop: One wire count: " << sensorCount << endl;
|
||||
delay(200);
|
||||
}
|
||||
|
||||
Serial << "One wire count: " << sensorCount << endl;
|
||||
/* Measure temperature */
|
||||
if (sensorCount > 0)
|
||||
{
|
||||
sensors.requestTemperatures();
|
||||
}
|
||||
|
||||
/* Read the distance and give the temperature sensors some time */
|
||||
readDistance();
|
||||
Serial << "Distance sensor " << waterRawSensor.getAverage() << " cm" << endl;
|
||||
|
||||
/* Retreive temperatures */
|
||||
if (sensorCount > 0)
|
||||
{
|
||||
leaveMode1 |= readTemp();
|
||||
|
||||
for (int i = 0; i < sensorCount; i++)
|
||||
{
|
||||
Serial << "OnwWire sensor " << i << " has value " << sensors.getTempCByIndex(i) << endl;
|
||||
}
|
||||
|
||||
if (abs(lipoTempSensor.getAverage() - rtcLastLipoTemp) > TEMPERATURE_DELTA_TRIGGER_IN_C)
|
||||
{
|
||||
leaveMode1 = true;
|
||||
wakeUpReason = WAKEUP_REASON_TEMP1_CHANGE;
|
||||
}
|
||||
if (abs(waterTempSensor.getAverage() - rtcLastWaterTemp) > TEMPERATURE_DELTA_TRIGGER_IN_C)
|
||||
{
|
||||
wakeUpReason = WAKEUP_REASON_TEMP2_CHANGE;
|
||||
leaveMode1 = true;
|
||||
}
|
||||
}
|
||||
|
||||
/* deactivate the sensors */
|
||||
digitalWrite(OUTPUT_SENSOR, LOW);
|
||||
return leaveMode1;
|
||||
}
|
||||
|
||||
void onHomieEvent(const HomieEvent &event)
|
||||
@@ -640,8 +354,7 @@ void onHomieEvent(const HomieEvent &event)
|
||||
case HomieEventType::MQTT_READY:
|
||||
Serial.printf("NTP Setup with server %s\r\n", ntpServer.get());
|
||||
configTime(0, 0, ntpServer.get());
|
||||
//wait for rtc sync?
|
||||
rtcDeepSleepTime = deepSleepTime.get();
|
||||
|
||||
Serial << "Setup plants" << endl;
|
||||
for (int i = 0; i < MAX_PLANTS; i++)
|
||||
{
|
||||
@@ -650,10 +363,6 @@ void onHomieEvent(const HomieEvent &event)
|
||||
|
||||
mode2MQTT();
|
||||
break;
|
||||
case HomieEventType::READY_TO_SLEEP:
|
||||
Homie.getLogger() << "rtsleep" << endl;
|
||||
esp_deep_sleep_start();
|
||||
break;
|
||||
case HomieEventType::OTA_STARTED:
|
||||
Homie.getLogger() << "OTA started" << endl;
|
||||
digitalWrite(OUTPUT_SENSOR, HIGH);
|
||||
@@ -679,8 +388,7 @@ void onHomieEvent(const HomieEvent &event)
|
||||
|
||||
int determineNextPump()
|
||||
{
|
||||
float solarValue = getSolarVoltage();
|
||||
bool isLowLight = (solarValue > SOLAR_CHARGE_MIN_VOLTAGE || solarValue < SOLAR_CHARGE_MAX_VOLTAGE);
|
||||
bool isLowLight = (mSolarVoltage > SOLAR_CHARGE_MIN_VOLTAGE || mSolarVoltage < SOLAR_CHARGE_MAX_VOLTAGE);
|
||||
|
||||
//FIXME instead of for, use sorted by last activation index to ensure equal runtime?
|
||||
|
||||
@@ -688,15 +396,12 @@ int determineNextPump()
|
||||
for (int i = 0; i < MAX_PLANTS; i++)
|
||||
{
|
||||
Plant plant = mPlants[i];
|
||||
long lastActivation = getLastActivationForPump(i);
|
||||
long sinceLastActivation = getCurrentTime() - lastActivation;
|
||||
//this pump is in cooldown skip it and disable low power mode trigger for it
|
||||
if (plant.isInCooldown(sinceLastActivation))
|
||||
{
|
||||
Serial.printf("%d Skipping due to cooldown %ld / %ld \r\n", i, sinceLastActivation, plant.getCooldownInSeconds());
|
||||
setMoistureTrigger(i, DEACTIVATED_PLANT);
|
||||
continue;
|
||||
}
|
||||
//TODO skip pump last used here!
|
||||
//if (plant.isInCooldown(sinceLastActivation))
|
||||
//{
|
||||
// Serial.printf("%d Skipping due to cooldown %ld / %ld \r\n", i, sinceLastActivation, plant.getCooldownInSeconds());
|
||||
//continue;
|
||||
//}
|
||||
//skip as it is not low light
|
||||
if (!isLowLight && plant.isAllowedOnlyAtLowLight())
|
||||
{
|
||||
@@ -763,8 +468,8 @@ void systemInit()
|
||||
|
||||
//in seconds
|
||||
|
||||
maxTimeBetweenMQTTUpdates.setDefaultValue(120);
|
||||
deepSleepTime.setDefaultValue(60);
|
||||
maxTimeBetweenMQTTUpdates.setDefaultValue(700);
|
||||
deepSleepTime.setDefaultValue(600);
|
||||
deepSleepNightTime.setDefaultValue(600);
|
||||
wateringDeepSleep.setDefaultValue(5);
|
||||
ntpServer.setDefaultValue("pool.ntp.org");
|
||||
@@ -795,6 +500,10 @@ void systemInit()
|
||||
.setName(TEMPERATURE_NAME)
|
||||
.setDatatype(NUMBER_TYPE)
|
||||
.setUnit(TEMPERATURE_UNIT);
|
||||
sensorTemp.advertise(TEMPERATUR_SENSOR_CHIP)
|
||||
.setName(TEMPERATURE_NAME)
|
||||
.setDatatype(NUMBER_TYPE)
|
||||
.setUnit(TEMPERATURE_UNIT);
|
||||
|
||||
sensorLipo.advertise("percent")
|
||||
.setName("Percent")
|
||||
@@ -819,74 +528,6 @@ void systemInit()
|
||||
stayAlive.advertise("alive").setName("Alive").setDatatype(NUMBER_TYPE).settable(aliveHandler);
|
||||
}
|
||||
|
||||
bool mode1()
|
||||
{
|
||||
Serial.println("==== Mode 1 ====");
|
||||
Serial << getCurrentTime() << " curtime" << endl;
|
||||
|
||||
bool deltaTrigger = readSensors();
|
||||
//queue sensor values for
|
||||
|
||||
if (deltaTrigger)
|
||||
{
|
||||
Serial.println("1 delta triggered, going to mode2");
|
||||
return true;
|
||||
}
|
||||
if (rtcDeepSleepTime == 0)
|
||||
{
|
||||
wakeUpReason = WAKEUP_REASON_RTC_MISSING;
|
||||
Serial.println("1 missing rtc value, going to mode2");
|
||||
return true;
|
||||
}
|
||||
for (int i = 0; i < MAX_PLANTS; i++)
|
||||
{
|
||||
long trigger = getMoistureTrigger(i);
|
||||
if (trigger == 0)
|
||||
{
|
||||
wakeUpReason = WAKEUP_REASON_RTC_MISSING;
|
||||
Serial << "Missing rtc trigger " << i << endl;
|
||||
return true;
|
||||
}
|
||||
if (trigger == DEACTIVATED_PLANT)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
long raw = mPlants[i].getCurrentMoisture();
|
||||
if (raw == MISSING_SENSOR)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (raw > trigger)
|
||||
{
|
||||
Serial << "plant " << i << " dry " << raw << " / " << trigger << " starting mode 2" << endl;
|
||||
wakeUpReason = WAKEUP_REASON_PLANT_DRY + i;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
//check how long it was already in mode1 if to long goto mode2
|
||||
|
||||
long cTime = getCurrentTime();
|
||||
if (cTime < 100000)
|
||||
{
|
||||
Serial.println("Starting mode 2 due to missing ntp");
|
||||
//missing ntp time boot to mode3
|
||||
wakeUpReason = WAKEUP_REASON_TIME_UNSET;
|
||||
return true;
|
||||
}
|
||||
if (gotoMode2AfterThisTimestamp < cTime)
|
||||
{
|
||||
wakeUpReason = WAKEUP_REASON_MODE2_WAKEUP_TIMER;
|
||||
Serial.println("Starting mode 2 after specified mode1 time");
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Serial << "Mode2 Timer " << gotoMode2AfterThisTimestamp << " curtime " << cTime << endl;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void mode2()
|
||||
{
|
||||
Serial.println("==== Mode 2 ====");
|
||||
@@ -906,8 +547,7 @@ void mode2()
|
||||
*/
|
||||
void setup()
|
||||
{
|
||||
Serial.begin(9600);
|
||||
Serial.setTimeout(1000); // Set timeout of 1 second
|
||||
Serial.begin(115200);
|
||||
Serial << endl
|
||||
<< endl;
|
||||
/* Intialize Plant */
|
||||
@@ -916,14 +556,14 @@ void setup()
|
||||
mPlants[i].init();
|
||||
}
|
||||
|
||||
/* Intialize inputs and outputs */
|
||||
pinMode(SENSOR_LIPO, ANALOG);
|
||||
pinMode(SENSOR_SOLAR, ANALOG);
|
||||
/* read button */
|
||||
// read button
|
||||
pinMode(BUTTON, INPUT);
|
||||
|
||||
/* Power pins */
|
||||
// Power pins
|
||||
pinMode(OUTPUT_PUMP, OUTPUT);
|
||||
pinMode(OUTPUT_SENSOR, OUTPUT);
|
||||
|
||||
// Individual Pump pins
|
||||
|
||||
/* Disable Wifi and bluetooth */
|
||||
WiFi.mode(WIFI_OFF);
|
||||
@@ -934,30 +574,23 @@ void setup()
|
||||
Serial << "Limits.hpp" << endl;
|
||||
}
|
||||
|
||||
readSensors();
|
||||
|
||||
// Big TODO use here the settings in RTC_Memory
|
||||
|
||||
//Panik mode, the Lipo is empty, sleep a long long time:
|
||||
if ((getBatteryVoltage() < MINIMUM_LIPO_VOLT) &&
|
||||
(getBatteryVoltage() > NO_LIPO_VOLT))
|
||||
{
|
||||
Serial << PANIK_MODE_DEEPSLEEP << " s lipo " << getBatteryVoltage() << "V" << endl;
|
||||
esp_sleep_enable_timer_wakeup(PANIK_MODE_DEEPSLEEP_US);
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_OFF);
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_FAST_MEM, ESP_PD_OPTION_OFF);
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_XTAL, ESP_PD_OPTION_ON);
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_OFF);
|
||||
esp_deep_sleep_start();
|
||||
}
|
||||
|
||||
if (mode1())
|
||||
{
|
||||
mode2();
|
||||
}
|
||||
else
|
||||
{
|
||||
Serial.println("nop");
|
||||
espDeepSleepFor(rtcDeepSleepTime);
|
||||
}
|
||||
// if ((mBatteryVoltage < MINIMUM_LIPO_VOLT) &&
|
||||
// (mBatteryVoltage > NO_LIPO_VOLT))
|
||||
// {
|
||||
// Serial << PANIK_MODE_DEEPSLEEP << " s lipo " << mBatteryVoltage << "V" << endl;
|
||||
// esp_sleep_enable_timer_wakeup(PANIK_MODE_DEEPSLEEP_US);
|
||||
// esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_OFF);
|
||||
// esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_FAST_MEM, ESP_PD_OPTION_OFF);
|
||||
// esp_sleep_pd_config(ESP_PD_DOMAIN_XTAL, ESP_PD_OPTION_ON);
|
||||
// esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_OFF);
|
||||
// esp_deep_sleep_start();
|
||||
// }
|
||||
mode2();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -966,7 +599,16 @@ void setup()
|
||||
*/
|
||||
void loop()
|
||||
{
|
||||
if (!mDeepsleep || mode3Active)
|
||||
/* Toggel Senor LED to visualize mode 3 */
|
||||
if (mode3Active)
|
||||
{
|
||||
if (nextBlink < millis())
|
||||
{
|
||||
nextBlink = millis() + 500;
|
||||
digitalWrite(OUTPUT_SENSOR, !digitalRead(OUTPUT_SENSOR));
|
||||
}
|
||||
}
|
||||
else if (!mDeepsleep)
|
||||
{
|
||||
Homie.loop();
|
||||
}
|
||||
@@ -979,19 +621,9 @@ void loop()
|
||||
|
||||
if (millis() > 30000 && !mode3Active)
|
||||
{
|
||||
Serial << (millis() / 1000) << "not terminated watchdog putting to sleep" << endl;
|
||||
Serial << (millis() / 1000) << "not terminated watchdog reset" << endl;
|
||||
Serial.flush();
|
||||
espDeepSleepFor(rtcDeepSleepTime);
|
||||
}
|
||||
|
||||
/* Toggel Senor LED to visualize mode 3 */
|
||||
if (mode3Active)
|
||||
{
|
||||
if (nextBlink < millis())
|
||||
{
|
||||
nextBlink = millis() + 500;
|
||||
digitalWrite(OUTPUT_SENSOR, !digitalRead(OUTPUT_SENSOR));
|
||||
}
|
||||
esp_restart();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
21
esp32test/Esp32DeepSleepTest/PlantControlTest.code-workspace
Normal file
21
esp32test/Esp32DeepSleepTest/PlantControlTest.code-workspace
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "."
|
||||
}
|
||||
],
|
||||
"settings": {
|
||||
"files.associations": {
|
||||
"*.tcc": "cpp",
|
||||
"bitset": "cpp",
|
||||
"algorithm": "cpp",
|
||||
"istream": "cpp",
|
||||
"limits": "cpp",
|
||||
"streambuf": "cpp",
|
||||
"functional": "cpp",
|
||||
"string": "cpp",
|
||||
"typeinfo": "cpp",
|
||||
"cmath": "cpp"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
/**
|
||||
* @file DS18B20.h
|
||||
* @author your name (you@domain.com)
|
||||
* @brief
|
||||
* @version 0.1
|
||||
* @date 2020-06-09
|
||||
*
|
||||
* @copyright Copyright (c) 2020
|
||||
* Based on the LUA code from the ESP8266
|
||||
* --------------------------------------------------------------------------------
|
||||
* -- DS18B20 one wire module for NODEMCU
|
||||
* -- NODEMCU TEAM
|
||||
* -- LICENCE: http://opensource.org/licenses/MIT
|
||||
* -- Vowstar <vowstar@nodemcu.com>
|
||||
* -- 2015/02/14 sza2 <sza2trash@gmail.com> Fix for negative values
|
||||
* --------------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef DS18B20_H
|
||||
#define DS18B20_H
|
||||
|
||||
#include <OneWire.h>
|
||||
|
||||
class Ds18B20 {
|
||||
private:
|
||||
OneWire* mDs;
|
||||
int foundDevices;
|
||||
public:
|
||||
Ds18B20(int pin) {
|
||||
this->mDs = new OneWire(pin);
|
||||
}
|
||||
|
||||
~Ds18B20() {
|
||||
delete this->mDs;
|
||||
}
|
||||
/**
|
||||
* @brief read amount sensots
|
||||
* check for available of DS18B20 sensors
|
||||
* @return amount of sensors
|
||||
*/
|
||||
int readDevices(void);
|
||||
|
||||
/**
|
||||
* @brief Read all temperatures in celsius
|
||||
*
|
||||
* @param pTemperatures array of float valuies
|
||||
* @param maxTemperatures size of the given array
|
||||
* @return int amount of read temperature values
|
||||
*/
|
||||
int readAllTemperatures(float* pTemperatures, int maxTemperatures);
|
||||
};
|
||||
#endif
|
||||
112
esp32test/Esp32DeepSleepTest/include/DS2438.h
Normal file
112
esp32test/Esp32DeepSleepTest/include/DS2438.h
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* DS2438.h
|
||||
*
|
||||
* by Joe Bechter
|
||||
*
|
||||
* (C) 2012, bechter.com
|
||||
*
|
||||
* All files, software, schematics and designs are provided as-is with no warranty.
|
||||
* All files, software, schematics and designs are for experimental/hobby use.
|
||||
* Under no circumstances should any part be used for critical systems where safety,
|
||||
* life or property depends upon it. You are responsible for all use.
|
||||
* You are free to use, modify, derive or otherwise extend for your own non-commercial purposes provided
|
||||
* 1. No part of this software or design may be used to cause injury or death to humans or animals.
|
||||
* 2. Use is non-commercial.
|
||||
* 3. Credit is given to the author (i.e. portions © bechter.com), and provide a link to the original source.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef DS2438_h
|
||||
#define DS2438_h
|
||||
|
||||
#include <Arduino.h>
|
||||
#include <OneWire.h>
|
||||
|
||||
#define DS2438_TEMPERATURE_CONVERSION_COMMAND 0x44
|
||||
#define DS2438_VOLTAGE_CONVERSION_COMMAND 0xb4
|
||||
#define DS2438_WRITE_SCRATCHPAD_COMMAND 0x4e
|
||||
#define DS2438_COPY_SCRATCHPAD_COMMAND 0x48
|
||||
#define DS2438_READ_SCRATCHPAD_COMMAND 0xbe
|
||||
#define DS2438_RECALL_MEMORY_COMMAND 0xb8
|
||||
|
||||
#define PAGE_MIN 0
|
||||
#define PAGE_MAX 7
|
||||
|
||||
#define DS2438_CHA 0
|
||||
#define DS2438_CHB 1
|
||||
|
||||
#define DS2438_MODE_CHA 0x01
|
||||
#define DS2438_MODE_CHB 0x02
|
||||
#define DS2438_MODE_TEMPERATURE 0x04
|
||||
|
||||
#define DS2438_TEMPERATURE_DELAY 10
|
||||
#define DS2438_VOLTAGE_CONVERSION_DELAY 8
|
||||
|
||||
#define DEFAULT_PAGE0(var) uint8_t var[8] { \
|
||||
0b00001011 /* X, ADB=0, NVB=0, TB=0, AD=1, EE=0, CA=1, IAD=1 */, \
|
||||
0, /* Temperatur */ \
|
||||
0, /* Temperatur */ \
|
||||
0, /* Voltage */ \
|
||||
0, /* Voltage */ \
|
||||
0, /* Current */ \
|
||||
0, /* Current */ \
|
||||
0 /* Threashold */ \
|
||||
}
|
||||
|
||||
typedef struct PageOne {
|
||||
uint8_t eleapsedTimerByte0; /**< LSB of timestamp */
|
||||
uint8_t eleapsedTimerByte1;
|
||||
uint8_t eleapsedTimerByte2;
|
||||
uint8_t eleapsedTimerByte3; /**< MSB of timestamp */
|
||||
uint8_t ICA; /**< Integrated Current Accumulator (current flowing into and out of the battery) */
|
||||
uint8_t offsetRegisterByte0; /**< Offset for ADC calibdation */
|
||||
uint8_t offsetRegisterByte1; /**< Offset for ADC calibdation */
|
||||
uint8_t reserved;
|
||||
} PageOne_t;
|
||||
|
||||
typedef struct PageSeven {
|
||||
uint8_t userByte0;
|
||||
uint8_t userByte1;
|
||||
uint8_t userByte2;
|
||||
uint8_t userByte3;
|
||||
uint8_t CCA0; /**< Charging Current Accumulator (CCA) */
|
||||
uint8_t CCA1; /**< Charging Current Accumulator (CCA) */
|
||||
uint8_t DCA0; /**< Discharge Current Accumulator (DCA) */
|
||||
uint8_t DCA1; /**< Discharge Current Accumulator (DCA) */
|
||||
} PageSeven_t;
|
||||
|
||||
typedef uint8_t DeviceAddress[8];
|
||||
|
||||
class DS2438 {
|
||||
public:
|
||||
DS2438(OneWire *ow, float currentShunt);
|
||||
DS2438(OneWire *ow, uint8_t *address);
|
||||
|
||||
void begin();
|
||||
void update();
|
||||
double getTemperature();
|
||||
float getVoltage(int channel=DS2438_CHA);
|
||||
float getCurrent();
|
||||
boolean isError();
|
||||
boolean isFound();
|
||||
private:
|
||||
bool validAddress(const uint8_t*);
|
||||
bool validFamily(const uint8_t* deviceAddress);
|
||||
|
||||
bool deviceFound = false;
|
||||
OneWire *_ow;
|
||||
DeviceAddress _address;
|
||||
uint8_t _mode;
|
||||
double _temperature;
|
||||
float _voltageA;
|
||||
float _voltageB;
|
||||
float _current;
|
||||
float _currentShunt;
|
||||
boolean _error;
|
||||
boolean startConversion(int channel, boolean doTemperature);
|
||||
boolean selectChannel(int channel);
|
||||
void writePage(int page, uint8_t *data);
|
||||
boolean readPage(int page, uint8_t *data);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -14,3 +14,4 @@ board = esp32doit-devkit-v1
|
||||
framework = arduino
|
||||
build_flags = -DPIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY
|
||||
lib_deps = OneWire
|
||||
DallasTemperature
|
||||
|
||||
@@ -1,105 +0,0 @@
|
||||
/**
|
||||
* @file DS18B20.cpp
|
||||
* @author your name (you@domain.com)
|
||||
* @brief
|
||||
* @version 0.1
|
||||
* @date 2020-06-09
|
||||
*
|
||||
* @copyright Copyright (c) 2020
|
||||
*
|
||||
*/
|
||||
|
||||
#include "DS18B20.h"
|
||||
|
||||
#define STARTCONV 0x44
|
||||
#define READSCRATCH 0xBE // Read EEPROM
|
||||
#define TEMP_LSB 0
|
||||
#define TEMP_MSB 1
|
||||
#define SCRATCHPADSIZE 9
|
||||
#define OFFSET_CRC8 8 /**< 9th byte has the CRC of the complete data */
|
||||
|
||||
//Printf debugging
|
||||
//#define DS_DEBUG
|
||||
|
||||
int Ds18B20::readDevices() {
|
||||
byte addr[8];
|
||||
|
||||
int amount = -1;
|
||||
while (this->mDs->search(addr)) {
|
||||
amount++;
|
||||
}
|
||||
this->mDs->reset_search();
|
||||
return amount;
|
||||
}
|
||||
|
||||
int Ds18B20::readAllTemperatures(float* pTemperatures, int maxTemperatures) {
|
||||
byte addr[8];
|
||||
uint8_t scratchPad[SCRATCHPADSIZE];
|
||||
int currentTemp = 0;
|
||||
|
||||
while (this->mDs->search(addr)) {
|
||||
#ifdef DS_DEBUG
|
||||
Serial.print(" ROM =");
|
||||
for (i = 0; i < 8; i++) {
|
||||
Serial.write(' ');
|
||||
Serial.print(addr[i], HEX);
|
||||
}
|
||||
#endif
|
||||
this->mDs->reset();
|
||||
this->mDs->select(addr);
|
||||
this->mDs->write(STARTCONV);
|
||||
this->mDs->reset();
|
||||
this->mDs->select(addr);
|
||||
this->mDs->write(READSCRATCH);
|
||||
|
||||
// Read all registers in a simple loop
|
||||
// byte 0: temperature LSB
|
||||
// byte 1: temperature MSB
|
||||
// byte 2: high alarm temp
|
||||
// byte 3: low alarm temp
|
||||
// byte 4: DS18S20: store for crc
|
||||
// DS18B20 & DS1822: configuration register
|
||||
// byte 5: internal use & crc
|
||||
// byte 6: DS18S20: COUNT_REMAIN
|
||||
// DS18B20 & DS1822: store for crc
|
||||
// byte 7: DS18S20: COUNT_PER_C
|
||||
// DS18B20 & DS1822: store for crc
|
||||
// byte 8: SCRATCHPAD_CRC
|
||||
#ifdef DS_DEBUG
|
||||
Serial.write("\r\nDATA:");
|
||||
for (uint8_t i = 0; i < 9; i++) {
|
||||
Serial.print(scratchPad[i], HEX);
|
||||
}
|
||||
#else
|
||||
delay(50);
|
||||
#endif
|
||||
for (uint8_t i = 0; i < 9; i++) {
|
||||
scratchPad[i] = this->mDs->read();
|
||||
}
|
||||
uint8_t crc8 = this->mDs->crc8(scratchPad, 8);
|
||||
|
||||
/* Only work an valid data */
|
||||
if (crc8 == scratchPad[OFFSET_CRC8]) {
|
||||
int16_t fpTemperature = (((int16_t) scratchPad[TEMP_MSB]) << 11)
|
||||
| (((int16_t) scratchPad[TEMP_LSB]) << 3);
|
||||
float celsius = (float) fpTemperature * 0.0078125;
|
||||
#ifdef DS_DEBUG
|
||||
Serial.printf("\r\nTemp%d %f °C (Raw: %d, %x =? %x)\r\n", (currentTemp+1), celsius, fpTemperature, crc8, scratchPad[8]);
|
||||
#endif
|
||||
/* check, if the buffer as some space for our data */
|
||||
if (currentTemp < maxTemperatures) {
|
||||
pTemperatures[currentTemp] = celsius;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
currentTemp++;
|
||||
}
|
||||
this->mDs->reset();
|
||||
#ifdef DS_DEBUG
|
||||
Serial.println(" No more addresses.");
|
||||
Serial.println();
|
||||
#endif
|
||||
|
||||
return currentTemp;
|
||||
}
|
||||
286
esp32test/Esp32DeepSleepTest/src/DS2438.cpp
Normal file
286
esp32test/Esp32DeepSleepTest/src/DS2438.cpp
Normal file
@@ -0,0 +1,286 @@
|
||||
/*
|
||||
* DS2438.cpp
|
||||
*
|
||||
* by Joe Bechter
|
||||
*
|
||||
* (C) 2012, bechter.com
|
||||
*
|
||||
* All files, software, schematics and designs are provided as-is with no warranty.
|
||||
* All files, software, schematics and designs are for experimental/hobby use.
|
||||
* Under no circumstances should any part be used for critical systems where safety,
|
||||
* life or property depends upon it. You are responsible for all use.
|
||||
* You are free to use, modify, derive or otherwise extend for your own non-commercial purposes provided
|
||||
* 1. No part of this software or design may be used to cause injury or death to humans or animals.
|
||||
* 2. Use is non-commercial.
|
||||
* 3. Credit is given to the author (i.e. portions © bechter.com), and provide a link to the original source.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "DS2438.h"
|
||||
|
||||
// DSROM FIELDS
|
||||
#define DSROM_FAMILY 0
|
||||
#define DSROM_CRC 7
|
||||
|
||||
#define DS2438MODEL 0x26
|
||||
|
||||
DS2438::DS2438(OneWire *ow, float currentShunt = 1.0f) {
|
||||
_ow = ow;
|
||||
_currentShunt = currentShunt;
|
||||
};
|
||||
|
||||
void DS2438::begin(){
|
||||
DeviceAddress searchDeviceAddress;
|
||||
|
||||
_ow->reset_search();
|
||||
memset(searchDeviceAddress,0, 8);
|
||||
_temperature = 0;
|
||||
_voltageA = 0.0;
|
||||
_voltageB = 0.0;
|
||||
_error = true;
|
||||
_mode = (DS2438_MODE_CHA | DS2438_MODE_CHB | DS2438_MODE_TEMPERATURE);
|
||||
|
||||
deviceFound = false; // Reset the number of devices when we enumerate wire devices
|
||||
|
||||
while (_ow->search(searchDeviceAddress)) {
|
||||
if (validAddress(searchDeviceAddress)) {
|
||||
if (validFamily(searchDeviceAddress)) {
|
||||
memcpy(_address,searchDeviceAddress,8);
|
||||
DEFAULT_PAGE0(defaultConfig);
|
||||
writePage(0, defaultConfig);
|
||||
deviceFound = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool DS2438::isFound(){
|
||||
return deviceFound;
|
||||
}
|
||||
|
||||
bool DS2438::validAddress(const uint8_t* deviceAddress) {
|
||||
return (_ow->crc8(deviceAddress, 7) == deviceAddress[DSROM_CRC]);
|
||||
}
|
||||
|
||||
bool DS2438::validFamily(const uint8_t* deviceAddress) {
|
||||
switch (deviceAddress[DSROM_FAMILY]) {
|
||||
case DS2438MODEL:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void DS2438::update() {
|
||||
uint8_t data[9];
|
||||
|
||||
_error = true;
|
||||
if(!isFound()){
|
||||
return;
|
||||
}
|
||||
|
||||
if (_mode & DS2438_MODE_CHA || _mode == DS2438_MODE_TEMPERATURE) {
|
||||
boolean doTemperature = _mode & DS2438_MODE_TEMPERATURE;
|
||||
if (!startConversion(DS2438_CHA, doTemperature)) {
|
||||
Serial.println("Error starting temp conversion ds2438 channel a");
|
||||
return;
|
||||
}
|
||||
if (!readPage(0, data)){
|
||||
|
||||
Serial.println("Error reading zero page ds2438 channel a");
|
||||
return;
|
||||
}
|
||||
Serial.print(data[0],16);
|
||||
Serial.print(" ");
|
||||
Serial.print(data[1],16);
|
||||
Serial.print(" ");
|
||||
Serial.print(data[2],16);
|
||||
Serial.print(" ");
|
||||
Serial.print(data[3],16);
|
||||
Serial.print(" ");
|
||||
Serial.print(data[4],16);
|
||||
Serial.print(" ");
|
||||
Serial.print(data[5],16);
|
||||
Serial.print(" ");
|
||||
Serial.print(data[6],16);
|
||||
Serial.print(" ");
|
||||
Serial.println(data[7],16);
|
||||
|
||||
|
||||
if (doTemperature) {
|
||||
_temperature = (double)(((((int16_t)data[2]) << 8) | (data[1] & 0x0ff)) >> 3) * 0.03125;
|
||||
}
|
||||
if (_mode & DS2438_MODE_CHA) {
|
||||
_voltageA = (((data[4] << 8) & 0x00300) | (data[3] & 0x0ff)) / 100.0;
|
||||
}
|
||||
}
|
||||
if (_mode & DS2438_MODE_CHB) {
|
||||
boolean doTemperature = _mode & DS2438_MODE_TEMPERATURE && !(_mode & DS2438_MODE_CHA);
|
||||
if (!startConversion(DS2438_CHB, doTemperature)) {
|
||||
Serial.println("Error starting temp conversion channel b ds2438");
|
||||
return;
|
||||
}
|
||||
if (!readPage(0, data)){
|
||||
Serial.println("Error reading zero page ds2438 channel b");
|
||||
return;
|
||||
}
|
||||
if (doTemperature) {
|
||||
int16_t upperByte = ((int16_t)data[2]) << 8;
|
||||
int16_t lowerByte = data[1] >> 3;
|
||||
int16_t fullByte = (upperByte | lowerByte);
|
||||
_temperature = ((double)fullByte) * 0.03125;
|
||||
}
|
||||
_voltageB = (((data[4] << 8) & 0x00300) | (data[3] & 0x0ff)) / 100.0;
|
||||
}
|
||||
|
||||
int16_t upperByte = ((int16_t)data[6]) << 8;
|
||||
int16_t lowerByte = data[5];
|
||||
int16_t fullByte = (int16_t)(upperByte | lowerByte);
|
||||
float fullByteb = fullByte;
|
||||
_current = (fullByteb) / ((4096.0f * _currentShunt));
|
||||
_error = false;
|
||||
Serial.print(data[0],16);
|
||||
Serial.print(" ");
|
||||
Serial.print(data[1],16);
|
||||
Serial.print(" ");
|
||||
Serial.print(data[2],16);
|
||||
Serial.print(" ");
|
||||
Serial.print(data[3],16);
|
||||
Serial.print(" ");
|
||||
Serial.print(data[4],16);
|
||||
Serial.print(" ");
|
||||
Serial.print(data[5],16);
|
||||
Serial.print(" ");
|
||||
Serial.print(data[6],16);
|
||||
Serial.print(" ");
|
||||
Serial.println(data[7],16);
|
||||
Serial.println("-");
|
||||
|
||||
|
||||
|
||||
uint16_t ICA = 0;
|
||||
if (readPage(1, data)){
|
||||
PageOne_t *pOne = (PageOne_t *) data;
|
||||
Serial.println(pOne->ICA);
|
||||
float Ah = pOne->ICA / (2048.0f * _currentShunt);
|
||||
Serial.print("Ah=");
|
||||
Serial.println(Ah);
|
||||
ICA = pOne->ICA;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (readPage(7, data)){
|
||||
PageSeven_t *pSeven = (PageSeven_t *) data;
|
||||
int16_t CCA = pSeven->CCA0 | ((int16_t) pSeven->CCA1) << 8;
|
||||
int16_t DCA = pSeven->DCA0 | ((int16_t) pSeven->DCA1) << 8;
|
||||
Serial.println("ICA, DCA, CCA");
|
||||
Serial.print(ICA);
|
||||
Serial.print(", ");
|
||||
Serial.print(DCA);
|
||||
Serial.print(", ");
|
||||
Serial.println(CCA);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
double DS2438::getTemperature() {
|
||||
return _temperature;
|
||||
}
|
||||
|
||||
float DS2438::getVoltage(int channel) {
|
||||
if (channel == DS2438_CHA) {
|
||||
return _voltageA;
|
||||
} else if (channel == DS2438_CHB) {
|
||||
return _voltageB;
|
||||
} else {
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
float DS2438::getCurrent() {
|
||||
return _current;
|
||||
}
|
||||
|
||||
boolean DS2438::isError() {
|
||||
return _error;
|
||||
}
|
||||
|
||||
boolean DS2438::startConversion(int channel, boolean doTemperature) {
|
||||
if(!isFound()){
|
||||
return false;
|
||||
}
|
||||
if (!selectChannel(channel)){
|
||||
return false;
|
||||
}
|
||||
_ow->reset();
|
||||
_ow->select(_address);
|
||||
if (doTemperature) {
|
||||
_ow->write(DS2438_TEMPERATURE_CONVERSION_COMMAND, 0);
|
||||
delay(DS2438_TEMPERATURE_DELAY);
|
||||
_ow->reset();
|
||||
_ow->select(_address);
|
||||
}
|
||||
_ow->write(DS2438_VOLTAGE_CONVERSION_COMMAND, 0);
|
||||
delay(DS2438_VOLTAGE_CONVERSION_DELAY);
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean DS2438::selectChannel(int channel) {
|
||||
if(!isFound()){
|
||||
return false;
|
||||
}
|
||||
uint8_t data[9];
|
||||
if (readPage(0, data)) {
|
||||
if (channel == DS2438_CHB){
|
||||
data[0] = data[0] | 0x08;
|
||||
}
|
||||
else {
|
||||
data[0] = data[0] & 0xf7;
|
||||
}
|
||||
writePage(0, data);
|
||||
return true;
|
||||
}
|
||||
Serial.println("Could not read page zero data");
|
||||
return false;
|
||||
}
|
||||
|
||||
void DS2438::writePage(int page, uint8_t *data) {
|
||||
_ow->reset();
|
||||
_ow->select(_address);
|
||||
_ow->write(DS2438_WRITE_SCRATCHPAD_COMMAND, 0);
|
||||
if ((page >= PAGE_MIN) && (page <= PAGE_MAX)) {
|
||||
_ow->write(page, 0);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < 8; i++){
|
||||
_ow->write(data[i], 0);
|
||||
}
|
||||
_ow->reset();
|
||||
_ow->select(_address);
|
||||
_ow->write(DS2438_COPY_SCRATCHPAD_COMMAND, 0);
|
||||
_ow->write(page, 0);
|
||||
}
|
||||
|
||||
boolean DS2438::readPage(int page, uint8_t *data) {
|
||||
//TODO if all data is 0 0 is a valid crc, but most likly not as intended
|
||||
_ow->reset();
|
||||
_ow->select(_address);
|
||||
_ow->write(DS2438_RECALL_MEMORY_COMMAND, 0);
|
||||
if ((page >= PAGE_MIN) && (page <= PAGE_MAX)) {
|
||||
_ow->write(page, 0);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
_ow->reset();
|
||||
_ow->select(_address);
|
||||
_ow->write(DS2438_READ_SCRATCHPAD_COMMAND, 0);
|
||||
_ow->write(page, 0);
|
||||
for (int i = 0; i < 9; i++){
|
||||
data[i] = _ow->read();
|
||||
}
|
||||
return _ow->crc8(data, 8) == data[8];
|
||||
}
|
||||
|
||||
@@ -1,23 +1,21 @@
|
||||
#include <Arduino.h>
|
||||
#include "esp_sleep.h"
|
||||
#include <DS18B20.h>
|
||||
#include "DallasTemperature.h"
|
||||
#include "DS2438.h"
|
||||
|
||||
#define uS_TO_S_FACTOR 1000000 /* Conversion factor for micro seconds to seconds */
|
||||
#define TIME_TO_SLEEP 5 /* Time ESP32 will go to sleep (in seconds) */
|
||||
|
||||
#define SENSOR_LIPO 34 /**< GPIO 34 (ADC1) */
|
||||
#define SENSOR_SOLAR 35 /**< GPIO 35 (ADC1) */
|
||||
|
||||
#define SENSOR_DS18B20 2 /**< GPIO 2 */
|
||||
|
||||
|
||||
#define OUTPUT_PUMP0 23 /**< GPIO 23 */
|
||||
#define OUTPUT_PUMP1 22 /**< GPIO 22 */
|
||||
#define OUTPUT_PUMP2 21 /**< GPIO 21 */
|
||||
#define OUTPUT_PUMP0 17 /**< GPIO 23 */
|
||||
#define OUTPUT_PUMP1 05 /**< GPIO 22 */
|
||||
#define OUTPUT_PUMP2 18 /**< GPIO 21 */
|
||||
#define OUTPUT_PUMP3 19 /**< GPIO 19 */
|
||||
#define OUTPUT_PUMP4 18 /**< GPIO 18 */
|
||||
#define OUTPUT_PUMP5 5 /**< GPIO 5 */
|
||||
#define OUTPUT_PUMP6 15 /**< GPIO 15 */
|
||||
#define OUTPUT_PUMP4 21 /**< GPIO 18 */
|
||||
#define OUTPUT_PUMP5 22 /**< GPIO 5 */
|
||||
#define OUTPUT_PUMP6 23 /**< GPIO 15 */
|
||||
|
||||
#define OUTPUT_SENSOR 16 /**< GPIO 16 - Enable Sensors */
|
||||
#define OUTPUT_PUMP 13 /**< GPIO 13 - Enable Pumps */
|
||||
@@ -36,7 +34,10 @@ RTC_DATA_ATTR int bootCount = 0;
|
||||
RTC_DATA_ATTR int pumpActive = 0;
|
||||
int secondBootCount = 0;
|
||||
|
||||
Ds18B20 ds(SENSOR_DS18B20);
|
||||
OneWire oneWire(SENSOR_DS18B20);
|
||||
DallasTemperature temp(&oneWire);
|
||||
DS2438 battery(&oneWire,0.1f);
|
||||
|
||||
|
||||
void print_wakeup_reason(){
|
||||
esp_sleep_wakeup_cause_t wakeup_reason;
|
||||
@@ -53,6 +54,8 @@ void print_wakeup_reason(){
|
||||
}
|
||||
}
|
||||
|
||||
bool whatever = true;
|
||||
|
||||
void setAll2Off() {
|
||||
digitalWrite(OUTPUT_PUMP0, LOW);
|
||||
digitalWrite(OUTPUT_PUMP1, LOW);
|
||||
@@ -77,13 +80,11 @@ void setup() {
|
||||
pinMode(OUTPUT_SENSOR, OUTPUT);
|
||||
pinMode(OUTPUT_PUMP, OUTPUT);
|
||||
|
||||
pinMode(SENSOR_LIPO, ANALOG);
|
||||
pinMode(SENSOR_SOLAR, ANALOG);
|
||||
pinMode(SENSOR_PLANT0, ANALOG);
|
||||
|
||||
setAll2Off();
|
||||
|
||||
Serial.begin(115200);
|
||||
Serial.begin(9600);
|
||||
|
||||
//Increment boot number and print it every reboot
|
||||
++bootCount;
|
||||
@@ -93,82 +94,48 @@ void setup() {
|
||||
//Print the wakeup reason for ESP32
|
||||
print_wakeup_reason();
|
||||
|
||||
/*
|
||||
First we configure the wake up source
|
||||
We set our ESP32 to wake up every 5 seconds
|
||||
*/
|
||||
esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR);
|
||||
Serial.println("Setup ESP32 to sleep for every " + String(TIME_TO_SLEEP) +
|
||||
" Seconds");
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_OFF);
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_SLOW_MEM, ESP_PD_OPTION_ON);
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_FAST_MEM, ESP_PD_OPTION_OFF);
|
||||
esp_sleep_pd_config(ESP_PD_DOMAIN_XTAL,ESP_PD_OPTION_ON);
|
||||
/* activate power pump and pump 0 */
|
||||
|
||||
|
||||
|
||||
pinMode(GPIO_NUM_32, ANALOG);
|
||||
digitalWrite(GPIO_NUM_32, HIGH);
|
||||
pinMode(GPIO_NUM_33, INPUT_PULLUP);
|
||||
digitalWrite(GPIO_NUM_33, HIGH);
|
||||
pinMode(GPIO_NUM_25, INPUT_PULLUP);
|
||||
digitalWrite(GPIO_NUM_25, HIGH);
|
||||
pinMode(GPIO_NUM_26, INPUT_PULLUP);
|
||||
pinMode(GPIO_NUM_27, INPUT_PULLUP);
|
||||
pinMode(GPIO_NUM_14, INPUT_PULLUP);
|
||||
pinMode(GPIO_NUM_12, INPUT_PULLUP);
|
||||
|
||||
|
||||
/* Sensor activieren */
|
||||
digitalWrite(OUTPUT_SENSOR, HIGH);
|
||||
|
||||
/* activate power pump and pump 0 */
|
||||
digitalWrite(OUTPUT_PUMP, HIGH);
|
||||
delay(1);
|
||||
|
||||
temp.begin();
|
||||
battery.begin();
|
||||
|
||||
Serial.print("Battery");
|
||||
Serial.print("\t");
|
||||
Serial.print("Solar");
|
||||
Serial.print("\t");
|
||||
Serial.print("Bat I");
|
||||
Serial.print("\t");
|
||||
Serial.println("Temp/10");
|
||||
}
|
||||
|
||||
void loop() {
|
||||
whatever = !whatever;
|
||||
digitalWrite(OUTPUT_PUMP, HIGH);
|
||||
delay(500);
|
||||
digitalWrite(OUTPUT_PUMP6, HIGH);
|
||||
|
||||
|
||||
void loop() {
|
||||
double value = analogRead(SENSOR_LIPO);
|
||||
|
||||
Serial.println(value);
|
||||
|
||||
float temp[2] = {0, 0};
|
||||
float* pFloat = temp;
|
||||
|
||||
Serial.print("DS18B20 sensors: ");
|
||||
Serial.println(ds.readDevices());
|
||||
delay(200);
|
||||
if (ds.readAllTemperatures(pFloat, 2) > 0) {
|
||||
Serial.println(temp[0]);
|
||||
Serial.println(temp[1]);
|
||||
for(int j=0; j < 5 && temp.getDeviceCount() == 0; j++) {
|
||||
delay(10);
|
||||
// Serial.println("Reset 1wire temp");
|
||||
temp.begin();
|
||||
}
|
||||
|
||||
|
||||
double volt = ADC_5V_TO_3V3(value);
|
||||
Serial.print("Lipo: ");
|
||||
Serial.println(volt);
|
||||
|
||||
pumpActive = (pumpActive + 1) % 2;
|
||||
if (pumpActive) {
|
||||
digitalWrite(OUTPUT_PUMP0, HIGH);
|
||||
} else {
|
||||
digitalWrite(OUTPUT_PUMP0, LOW);
|
||||
for(int j=0; j < 5 && (0 == battery.isFound()); j++) {
|
||||
delay(10);
|
||||
Serial.println("Reset 1wire bat");
|
||||
battery.begin();
|
||||
battery.update();
|
||||
}
|
||||
|
||||
double solarVal = analogRead(SENSOR_SOLAR);
|
||||
|
||||
Serial.println(solarVal);
|
||||
|
||||
double solarVolt = SOLAR_VOLT(solarVal);
|
||||
Serial.print("Solar: ");
|
||||
Serial.println(solarVolt);
|
||||
|
||||
Serial.print("Moist0: ");
|
||||
Serial.println(analogRead(SENSOR_PLANT0));
|
||||
|
||||
delay(1000);
|
||||
gpio_deep_sleep_hold_en();
|
||||
gpio_hold_en(GPIO_NUM_13);
|
||||
esp_deep_sleep_start();
|
||||
battery.update();
|
||||
Serial.print(battery.getVoltage(0)); //use define here, solar
|
||||
Serial.print("\t");
|
||||
Serial.print(battery.getVoltage(1)); //use define here, battery
|
||||
Serial.print("\t");
|
||||
Serial.print(battery.getCurrent());
|
||||
Serial.print("\t");
|
||||
Serial.println(battery.getTemperature()/10);
|
||||
}
|
||||
BIN
sheets/1810101017_Fortune-Semicon-DW01-G_C14213.pdf
Normal file
BIN
sheets/1810101017_Fortune-Semicon-DW01-G_C14213.pdf
Normal file
Binary file not shown.
Binary file not shown.
BIN
sheets/DS2438.pdf
Normal file
BIN
sheets/DS2438.pdf
Normal file
Binary file not shown.
BIN
sheets/DSE-CN61C.pdf
Normal file
BIN
sheets/DSE-CN61C.pdf
Normal file
Binary file not shown.
BIN
sheets/esp32s.png
Normal file
BIN
sheets/esp32s.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 624 KiB |
Reference in New Issue
Block a user