only one hydroponic system per esp

This commit is contained in:
interfisch 2024-06-25 21:10:12 +02:00
parent e03fea6eb9
commit 3527b7ed99
11 changed files with 650 additions and 771 deletions

View File

@ -1,3 +1,6 @@
{
"cmake.configureOnOpen": false
"cmake.configureOnOpen": false,
"files.associations": {
"vl53l1x.h": "c"
}
}

View File

@ -288,67 +288,6 @@
)
)
)
(symbol "Connector_Generic:Conn_01x04" (pin_names (offset 1.016) hide) (in_bom yes) (on_board yes)
(property "Reference" "J" (id 0) (at 0 5.08 0)
(effects (font (size 1.27 1.27)))
)
(property "Value" "Conn_01x04" (id 1) (at 0 -7.62 0)
(effects (font (size 1.27 1.27)))
)
(property "Footprint" "" (id 2) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_keywords" "connector" (id 4) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_description" "Generic connector, single row, 01x04, script generated (kicad-library-utils/schlib/autogen/connector/)" (id 5) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "ki_fp_filters" "Connector*:*_1x??_*" (id 6) (at 0 0 0)
(effects (font (size 1.27 1.27)) hide)
)
(symbol "Conn_01x04_1_1"
(rectangle (start -1.27 -4.953) (end 0 -5.207)
(stroke (width 0.1524) (type default) (color 0 0 0 0))
(fill (type none))
)
(rectangle (start -1.27 -2.413) (end 0 -2.667)
(stroke (width 0.1524) (type default) (color 0 0 0 0))
(fill (type none))
)
(rectangle (start -1.27 0.127) (end 0 -0.127)
(stroke (width 0.1524) (type default) (color 0 0 0 0))
(fill (type none))
)
(rectangle (start -1.27 2.667) (end 0 2.413)
(stroke (width 0.1524) (type default) (color 0 0 0 0))
(fill (type none))
)
(rectangle (start -1.27 3.81) (end 1.27 -6.35)
(stroke (width 0.254) (type default) (color 0 0 0 0))
(fill (type background))
)
(pin passive line (at -5.08 2.54 0) (length 3.81)
(name "Pin_1" (effects (font (size 1.27 1.27))))
(number "1" (effects (font (size 1.27 1.27))))
)
(pin passive line (at -5.08 0 0) (length 3.81)
(name "Pin_2" (effects (font (size 1.27 1.27))))
(number "2" (effects (font (size 1.27 1.27))))
)
(pin passive line (at -5.08 -2.54 0) (length 3.81)
(name "Pin_3" (effects (font (size 1.27 1.27))))
(number "3" (effects (font (size 1.27 1.27))))
)
(pin passive line (at -5.08 -5.08 0) (length 3.81)
(name "Pin_4" (effects (font (size 1.27 1.27))))
(number "4" (effects (font (size 1.27 1.27))))
)
)
)
(symbol "Connector_Generic:Conn_01x06" (pin_names (offset 1.016) hide) (in_bom yes) (on_board yes)
(property "Reference" "J" (id 0) (at 0 7.62 0)
(effects (font (size 1.27 1.27)))
@ -1545,6 +1484,9 @@
(junction (at 250.19 30.48) (diameter 0) (color 0 0 0 0)
(uuid 6685ca70-8a38-4493-b748-2e06f7eb3947)
)
(junction (at 141.605 165.735) (diameter 0) (color 0 0 0 0)
(uuid 7a99b804-a08e-4da8-a8aa-74e8537c0b53)
)
(junction (at 189.865 99.695) (diameter 0) (color 0 0 0 0)
(uuid 9f136350-5714-4f3b-9752-ac9a2088891f)
)
@ -1557,6 +1499,9 @@
(junction (at 245.11 50.165) (diameter 0) (color 0 0 0 0)
(uuid b07991cb-dc2a-4245-9adc-66145eaa2a9f)
)
(junction (at 141.605 144.78) (diameter 0) (color 0 0 0 0)
(uuid b43a9ee7-eddf-417f-92b9-c980818a502c)
)
(junction (at 238.125 19.05) (diameter 0) (color 0 0 0 0)
(uuid bd89ee73-9ec2-4f03-b6e4-70d8733ef6be)
)
@ -1576,7 +1521,7 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 005ebc8d-bf01-410d-b056-93ea35231e3b)
)
(polyline (pts (xy 216.535 142.24) (xy 216.535 152.4))
(polyline (pts (xy 166.37 142.24) (xy 166.37 152.4))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 01a43c3e-2fc4-4074-a0bf-68aea9830525)
)
@ -1598,6 +1543,15 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 0360af81-66f0-40ad-a3a5-6ae55ea9f135)
)
(wire (pts (xy 178.435 137.795) (xy 178.435 107.315))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 04c5df30-ff0a-401a-8585-d3e2dfe10c17)
)
(wire (pts (xy 183.515 158.115) (xy 191.135 158.115))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 05872310-e030-47fc-9501-71ad3428e39c)
)
(polyline (pts (xy 218.44 25.4) (xy 218.44 35.56))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 05eb46ed-00ff-4b14-8815-4363e47739a0)
@ -1607,6 +1561,10 @@
(uuid 0789939c-e116-448c-a80e-ab64e57b951e)
)
(wire (pts (xy 179.705 158.115) (xy 179.705 104.775))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 07c26d7d-cff7-4db6-b7ca-360fbbbea064)
)
(wire (pts (xy 267.97 13.97) (xy 238.125 13.97))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 08303348-6b99-4ad1-bacb-78cd3a2280a8)
@ -1647,6 +1605,10 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 129ecdf4-9002-4f02-9f05-25d3666f5d70)
)
(wire (pts (xy 141.605 165.735) (xy 140.335 165.735))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 14dde8ae-a538-4f88-97c8-2cb5fa558b24)
)
(wire (pts (xy 91.44 34.925) (xy 93.345 34.925))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 15ab9d1d-1508-43be-bba4-55c3d1cf1f25)
@ -1656,6 +1618,14 @@
(uuid 178de00b-7dd4-40c2-9d99-c276a856712e)
)
(wire (pts (xy 141.605 165.735) (xy 141.605 158.115))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 17a082be-1175-455c-92c8-87cc864c467d)
)
(wire (pts (xy 191.135 147.955) (xy 189.23 147.955))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 18b6ce96-2f97-4177-8daf-8988302fc121)
)
(wire (pts (xy 262.89 22.86) (xy 267.97 22.86))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 1ad6e480-a6ad-40b9-b52b-d5e2a8551da9)
@ -1685,6 +1655,19 @@
(uuid 1fcfb4da-97b6-4b40-a9b9-75715a4e5e20)
)
(wire (pts (xy 187.96 117.475) (xy 187.96 129.54))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 22a91fee-6f93-42c9-bddd-ead57b093191)
)
(polyline (pts (xy 216.535 161.29) (xy 196.215 161.29))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 24f1a834-dbc3-49ab-94ae-5710ba7eca9b)
)
(polyline (pts (xy 166.37 173.355) (xy 146.685 173.355))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 259fbdda-1575-4c23-980f-52925896a8dd)
)
(wire (pts (xy 193.675 47.625) (xy 192.405 47.625))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 26211c60-d85f-481d-a4ff-7d2df030da4e)
@ -1697,6 +1680,10 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 2a64c995-db2f-4f28-bd3e-b4a059655a9c)
)
(wire (pts (xy 186.69 125.095) (xy 191.135 125.095))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 2a86147e-7540-4e58-9d95-edf030f44f00)
)
(polyline (pts (xy 35.56 33.02) (xy 48.895 33.02))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 2b2e2e78-76c8-4e04-a659-cf2062dfbd4f)
@ -1710,15 +1697,19 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 2d396b01-5473-4132-9779-951811675124)
)
(polyline (pts (xy 196.85 142.24) (xy 216.535 142.24))
(wire (pts (xy 141.605 158.115) (xy 179.705 158.115))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 2d8c7c2e-105e-4866-a4af-49af71bcb5ae)
)
(polyline (pts (xy 146.685 142.24) (xy 166.37 142.24))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 2f33f0a7-79d7-41e0-9ef6-8f4eac103a57)
)
(wire (pts (xy 187.96 120.65) (xy 191.135 120.65))
(polyline (pts (xy 166.37 163.195) (xy 166.37 173.355))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 2fecd610-2419-4350-831d-7c36889a1ef3)
(uuid 2fb870a7-724f-402b-a0f0-acb2084cb03b)
)
(wire (pts (xy 234.95 68.58) (xy 234.95 76.835))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 313a079f-1660-4c03-97a7-7ec968d80f37)
@ -1727,6 +1718,11 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 327b242d-9ec5-4435-b85c-9e53dd3e3cf1)
)
(polyline (pts (xy 216.535 142.875) (xy 216.535 161.29))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 34c89b9f-7c18-4f1e-8264-127776f7a1a0)
)
(wire (pts (xy 240.03 16.51) (xy 238.125 16.51))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 34e1dc47-a10e-4053-ac01-1b4d29711a4a)
@ -1747,11 +1743,23 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 3b26d51c-20a3-4e07-8f73-67c85521bde5)
)
(wire (pts (xy 178.435 107.315) (xy 172.085 107.315))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 3fdadac7-f54c-406d-af4a-5e95f555cd53)
)
(polyline (pts (xy 252.095 99.06) (xy 252.095 109.22))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 40ac92ef-483c-4a0a-b0f5-8f80f0cf378b)
)
(wire (pts (xy 186.69 150.495) (xy 191.135 150.495))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 4103c4ad-5c1b-4073-92b5-fe701316446b)
)
(wire (pts (xy 191.135 120.015) (xy 189.23 120.015))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 4229ecc0-7329-4ec9-b021-ce272cbea0ea)
)
(wire (pts (xy 186.69 50.165) (xy 193.675 50.165))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 42a8c003-55c6-4cef-9f49-5fc53e4840fe)
@ -1781,11 +1789,11 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 4c658ecf-d550-4517-84b5-3462362826e6)
)
(wire (pts (xy 191.77 149.86) (xy 187.325 149.86))
(wire (pts (xy 141.605 149.86) (xy 137.16 149.86))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 4d05bc3a-4510-44fd-a4e1-37d5a8933c74)
)
(polyline (pts (xy 196.85 142.24) (xy 196.85 152.4))
(polyline (pts (xy 146.685 142.24) (xy 146.685 152.4))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 4ddadd10-d0e8-48c6-b2b0-2d65ab8faf64)
)
@ -1794,10 +1802,6 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 4f5a833c-60da-4c08-8a62-4e80a1a782a1)
)
(wire (pts (xy 191.77 147.32) (xy 178.435 147.32))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 527535bb-c397-4731-9236-ad8b90a513de)
)
(wire (pts (xy 64.77 34.925) (xy 66.675 34.925))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 5332c1b9-2953-4282-9b51-22a203fdddd0)
@ -1806,6 +1810,10 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 53bbb223-c227-47fd-8b36-d4effca39472)
)
(wire (pts (xy 141.605 168.275) (xy 141.605 165.735))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 56b38d15-0ff1-4169-920b-89435a942ff6)
)
(wire (pts (xy 192.405 27.94) (xy 192.405 34.29))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 57d6fcea-3a61-43bb-8326-6a41e9a95e23)
@ -1818,6 +1826,10 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 587d676a-1c8d-4cee-acf6-0a1abe69e135)
)
(wire (pts (xy 140.335 165.735) (xy 140.335 172.085))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 5a6073e0-e949-47ab-86a0-80967b3808cf)
)
(wire (pts (xy 193.675 27.94) (xy 192.405 27.94))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 5a7fba48-631c-48ee-835b-252803d65a63)
@ -1834,10 +1846,6 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 5d55eb00-517a-4a8d-9715-04ff6e82b188)
)
(wire (pts (xy 187.96 129.54) (xy 187.96 120.65))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 5d99135e-3d1b-4f1b-a335-abaabfab8dfd)
)
(polyline (pts (xy 287.655 56.515) (xy 287.655 11.43))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 600535a7-5c0f-4233-999f-46ded6168531)
@ -1867,10 +1875,14 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 68ce270a-d034-46bc-9580-78aca985eef8)
)
(wire (pts (xy 187.325 149.86) (xy 187.325 142.875))
(wire (pts (xy 137.16 149.86) (xy 137.16 142.875))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 6a581b72-cb27-4650-bbf1-b725f4461183)
)
(wire (pts (xy 191.135 130.175) (xy 188.595 130.175))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 6a6c3a43-87d3-47b4-9160-cf02dd3add09)
)
(wire (pts (xy 224.79 -22.225) (xy 247.015 -22.225))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 6cefbf8f-08a9-4ac9-8b56-33c9b9d97ec3)
@ -1905,6 +1917,19 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 766d1576-9f15-47f4-98ea-bf3d473e67b6)
)
(polyline (pts (xy 146.685 163.195) (xy 146.685 173.355))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 76703f4f-6f5d-49e9-bf2f-bb3490f5a5fe)
)
(wire (pts (xy 186.69 153.035) (xy 191.135 153.035))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 77713d61-5d06-4411-a9de-fca24076d65e)
)
(wire (pts (xy 189.23 147.955) (xy 189.23 142.875))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 78d796b2-40a0-4a17-8cc9-6e30480f32db)
)
(polyline (pts (xy 278.765 -15.875) (xy 252.095 -15.875))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 7c786554-023e-43d4-aea3-38d4a9790738)
@ -1923,10 +1948,6 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 7fbea0f9-8bbd-489f-bc83-e3bbdd98b93a)
)
(wire (pts (xy 189.23 128.27) (xy 191.135 128.27))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 8017705b-c16b-4b2c-828f-4dc41e875b71)
)
(polyline (pts (xy 252.095 120.65) (xy 278.13 120.65))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 8094e9a0-f317-45e3-8801-3f6e90bb03f9)
@ -1962,11 +1983,20 @@
(uuid 83e3846b-9cc5-4127-a2eb-ff24fa7e9321)
)
(wire (pts (xy 188.595 130.175) (xy 188.595 97.155))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 84e61d05-5d40-414b-82f3-1cd7e5efe402)
)
(polyline (pts (xy 196.215 142.875) (xy 196.215 161.29))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 850db559-f714-4254-ae8b-0724c88df23c)
)
(wire (pts (xy 102.235 114.935) (xy 125.095 114.935))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 8531ff29-fc66-4c3f-88df-81b2dcb088d2)
)
(wire (pts (xy 191.77 144.78) (xy 190.5 144.78))
(wire (pts (xy 141.605 144.78) (xy 140.335 144.78))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 866ff215-5a1e-48ab-a28c-a44fd9e4796a)
)
@ -1978,6 +2008,10 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 888ea59e-6997-4c36-84ce-22d97248d780)
)
(wire (pts (xy 187.96 117.475) (xy 191.135 117.475))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 894634c1-6ff0-4da1-8b03-fb59487852d4)
)
(polyline (pts (xy 252.095 69.215) (xy 252.095 87.63))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 8a74fbe1-61f4-4aed-8878-a5e6e3e88868)
@ -2003,15 +2037,15 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 8fee0a26-a054-4c55-8b57-23dda5494d0f)
)
(polyline (pts (xy 196.215 142.875) (xy 216.535 142.875))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 943f3e3e-4ec1-45dd-864a-ea7d228fe8f6)
)
(polyline (pts (xy 278.13 109.22) (xy 252.095 109.22))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 9468ad6b-291d-409b-ac7c-2757eaa1d14f)
)
(wire (pts (xy 178.435 147.32) (xy 178.435 97.155))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 9b44493a-beb1-4bb7-81f4-9ab55e308c8c)
)
(wire (pts (xy 243.84 -40.005) (xy 247.015 -40.005))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid 9b8fc674-0fa3-4ad5-bb80-69be2a2aca72)
@ -2033,6 +2067,10 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid a1aba52f-a70b-4a61-9ce9-a0a4f19128c7)
)
(wire (pts (xy 187.96 145.415) (xy 187.96 157.48))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid a1bee5dc-88f6-436a-80f5-a6d7651e4e9f)
)
(wire (pts (xy 251.46 50.165) (xy 251.46 50.8))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid a32a2e95-9914-442f-8838-09134b8a249b)
@ -2079,9 +2117,9 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid aa4e7dc7-dfe8-4ad1-ad41-cc5037054d1f)
)
(wire (pts (xy 189.23 114.935) (xy 189.23 128.27))
(wire (pts (xy 141.605 147.32) (xy 141.605 144.78))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid ab26ed0f-1f12-413f-b4fa-17311c490ba9)
(uuid ac4b071d-d395-4924-b48c-ed96dbdca65c)
)
(wire (pts (xy 222.885 125.73) (xy 222.885 -19.685))
(stroke (width 0) (type default) (color 0 0 0 0))
@ -2108,10 +2146,6 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid b4df9aab-bf44-4482-a268-7630a055a327)
)
(wire (pts (xy 186.69 125.73) (xy 191.135 125.73))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid b5671454-4981-4d9f-bb65-c2fefb0a2f53)
)
(polyline (pts (xy 218.44 55.245) (xy 198.755 55.245))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid b708e88d-6b5c-477b-b576-8771e57f06db)
@ -2129,11 +2163,19 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid bb4efc20-7f53-4eb5-a472-3306b322a899)
)
(wire (pts (xy 172.085 97.155) (xy 188.595 97.155))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid bbc2922d-6906-4fc6-93d2-5f4aa7e41ea4)
)
(wire (pts (xy 125.095 127.635) (xy 111.76 127.635))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid bdb09452-b544-4059-b7a8-ea5c877d3ac5)
)
(wire (pts (xy 190.5 144.78) (xy 190.5 151.13))
(wire (pts (xy 186.69 122.555) (xy 191.135 122.555))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid bf3d581f-915a-42be-a794-7219c5d17a6f)
)
(wire (pts (xy 140.335 144.78) (xy 140.335 151.13))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid c0447185-9314-4035-b91d-55909a334e32)
)
@ -2150,10 +2192,18 @@
(uuid c2ceb4b3-97b6-4ae9-ba17-d0df094a7bcc)
)
(wire (pts (xy 183.515 158.115) (xy 183.515 84.455))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid c479c5a0-bebb-461b-abc9-f6fe15a14cb1)
)
(wire (pts (xy 247.015 128.27) (xy 242.57 128.27))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid c535be1b-494b-4285-bc2b-18a5a43e54be)
)
(wire (pts (xy 137.16 170.815) (xy 137.16 163.83))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid c65f04b1-e014-4948-af87-ca5d4f45883f)
)
(wire (pts (xy 245.745 101.6) (xy 245.745 107.95))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid c7b11a81-f21a-4ef6-9446-24f2c5f34416)
@ -2180,10 +2230,6 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid cc027dd4-e5bf-404d-aaa1-983a5a486764)
)
(wire (pts (xy 186.69 123.19) (xy 191.135 123.19))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid cca262c4-2d94-43d3-9f55-a0fe39747d11)
)
(wire (pts (xy 93.345 42.545) (xy 93.345 43.18))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid cd91ef9c-3543-461c-bb96-57fe0b6975db)
@ -2192,7 +2238,7 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid cddf58dd-be33-4a27-994c-099f812886e4)
)
(polyline (pts (xy 216.535 152.4) (xy 196.85 152.4))
(polyline (pts (xy 166.37 152.4) (xy 146.685 152.4))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid cddf6873-1950-4b4b-8c83-b18e148efde9)
)
@ -2205,6 +2251,10 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid cf6a39f5-dc75-47cc-89fd-635113fb1767)
)
(wire (pts (xy 189.23 120.015) (xy 189.23 114.935))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid d0eb12a3-d9c6-4662-bb77-8556e920ca9d)
)
(wire (pts (xy 250.19 22.86) (xy 255.27 22.86))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid d2a25ceb-7d62-4206-92f5-a66090f4c974)
@ -2230,9 +2280,9 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid d96467a4-491d-4110-8bfe-b39495e90c6a)
)
(wire (pts (xy 178.435 97.155) (xy 172.085 97.155))
(wire (pts (xy 141.605 170.815) (xy 137.16 170.815))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid db7496d5-7b09-4254-8955-f60f54c981c0)
(uuid d9860e0c-cbde-4cdb-804b-784ec86b53f3)
)
(wire (pts (xy 247.015 81.915) (xy 185.42 81.915))
(stroke (width 0) (type default) (color 0 0 0 0))
@ -2250,6 +2300,10 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid dc961d1f-cc88-4186-885e-fc69bb040311)
)
(polyline (pts (xy 146.685 163.195) (xy 166.37 163.195))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid dcd640a5-01a2-444a-9dc6-be10c9154c8d)
)
(polyline (pts (xy 233.68 56.515) (xy 287.655 56.515))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid deb138ba-23d8-467c-b1f9-72fca85c802b)
@ -2259,6 +2313,10 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid df52d889-cffb-4e87-a43d-9f89d3ec69f6)
)
(wire (pts (xy 141.605 137.795) (xy 178.435 137.795))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid e2a4a9e5-0fb4-43be-813c-4db42d5b3985)
)
(polyline (pts (xy 198.755 45.085) (xy 198.755 55.245))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid e3c10976-0e58-4b4d-83d8-cc80ef9eac3a)
@ -2271,11 +2329,20 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid e5ccea02-215c-4543-b16e-efee5f2e6d18)
)
(wire (pts (xy 141.605 144.78) (xy 141.605 137.795))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid e5ef5687-1e17-48b7-9198-b455f3dfb20d)
)
(polyline (pts (xy 278.13 151.765) (xy 252.095 151.765))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid ea011c48-8d15-453d-ab14-6c6075e754dc)
)
(wire (pts (xy 172.085 104.775) (xy 179.705 104.775))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid eab982bc-9277-49b0-952e-3f1690a07093)
)
(wire (pts (xy 245.745 74.295) (xy 247.015 74.295))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid f06f1584-7e76-4e0c-8c70-eac5457c39b7)
@ -2297,6 +2364,10 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid f2db2e93-38ef-4f2e-8859-e3266416192d)
)
(wire (pts (xy 187.96 145.415) (xy 191.135 145.415))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid f2e9fa78-d9af-428c-9ea6-f75a6baf5419)
)
(wire (pts (xy 189.23 33.02) (xy 189.23 26.035))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid f3c6a8d2-f746-49cf-a3a9-034844900871)
@ -2335,6 +2406,10 @@
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid f6fdbb5c-e27a-4795-9d20-42c1c7e7f74a)
)
(wire (pts (xy 183.515 84.455) (xy 172.085 84.455))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid f7ee1a98-6c4c-4bba-882e-b754d2615ab6)
)
(wire (pts (xy 135.89 33.655) (xy 139.065 33.655))
(stroke (width 0) (type default) (color 0 0 0 0))
(uuid f89beaf3-c3ce-4bf2-a28b-e2657433efc0)
@ -2380,7 +2455,7 @@
(effects (font (size 1.55 1.55)) (justify left bottom))
(uuid 242dce60-78d5-453d-9ac5-926f69203eef)
)
(text "GND\nSCL\nSDA\nVcc" (at 197.485 129.54 0)
(text "GND\nVCC\nSCL\nSDA\nGPIO\nXSHUT" (at 197.485 131.445 0)
(effects (font (size 1.55 1.55)) (justify left bottom))
(uuid 2e757b8f-25db-45fd-9581-455812bcf27a)
)
@ -2388,7 +2463,11 @@
(effects (font (size 1.55 1.55)) (justify left bottom))
(uuid 34172fca-9bca-4ca7-bd25-099be88f98d1)
)
(text "VL6180X\nToF\nDistance\nSensor" (at 206.375 128.27 0)
(text "GND\nOut\n5V" (at 147.955 172.085 0)
(effects (font (size 1.55 1.55)) (justify left bottom))
(uuid 3f34cfdf-75ae-4e41-b0de-e2b06976f75e)
)
(text "VL53L0X\nToF\nDistance\nSensor" (at 206.375 128.27 0)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid 601e999f-d182-499e-a6ca-51b198770314)
)
@ -2428,18 +2507,30 @@
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid ae8912df-466b-4b6d-90f8-ef188bb35a22)
)
(text "GND\nOut\n5V" (at 198.12 151.13 0)
(text "GND\nOut\n5V" (at 147.955 151.13 0)
(effects (font (size 1.55 1.55)) (justify left bottom))
(uuid bc58c3ce-4ac8-422b-ab9d-ee1f3daaadbe)
)
(text "YF-S201" (at 206.375 147.955 0)
(text "YF-S201" (at 156.21 147.955 0)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid dc089059-5779-4b52-a7c7-33fed8b51d9d)
)
(text "YF-S201" (at 156.21 168.91 0)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid deb4e8d1-af63-463d-9655-cec5e3558df4)
)
(text "VL53L0X\nToF\nDistance\nSensor" (at 206.375 156.21 0)
(effects (font (size 1.27 1.27)) (justify left bottom))
(uuid e041101e-d73f-4ba5-8af7-c492bc72bc7c)
)
(text "GND\nOut\n5V" (at 253.365 107.95 0)
(effects (font (size 1.55 1.55)) (justify left bottom))
(uuid f21b4f43-3192-4fd7-b9f6-7b8a26e64afa)
)
(text "GND\nVCC\nSCL\nSDA\nGPIO\nXSHUT" (at 197.485 159.385 0)
(effects (font (size 1.55 1.55)) (justify left bottom))
(uuid ffa0a84a-7807-49e5-9a8b-1c0691fbb2ba)
)
(label "12V" (at 36.195 34.925 0)
(effects (font (size 1.27 1.27)) (justify left bottom))
@ -2450,10 +2541,10 @@
(uuid f5b845d6-6d84-43eb-b692-4c8dc095ffc4)
)
(global_label "SCL" (shape input) (at 186.69 123.19 180) (fields_autoplaced)
(global_label "SCL" (shape input) (at 186.69 122.555 180) (fields_autoplaced)
(effects (font (size 1.27 1.27)) (justify right))
(uuid 0d7e513c-15c4-4496-a1e7-fd7947e0d520)
(property "Intersheet References" "${INTERSHEET_REFS}" (id 0) (at 180.7693 123.1106 0)
(property "Intersheet References" "${INTERSHEET_REFS}" (id 0) (at 180.7693 122.4756 0)
(effects (font (size 1.27 1.27)) (justify right) hide)
)
)
@ -2499,10 +2590,24 @@
(effects (font (size 1.27 1.27)) (justify right) hide)
)
)
(global_label "SDA" (shape input) (at 186.69 125.73 180) (fields_autoplaced)
(global_label "SDA" (shape input) (at 186.69 125.095 180) (fields_autoplaced)
(effects (font (size 1.27 1.27)) (justify right))
(uuid 608dd77b-1365-4a3d-9afd-1c112437a0aa)
(property "Intersheet References" "${INTERSHEET_REFS}" (id 0) (at 180.7088 125.6506 0)
(property "Intersheet References" "${INTERSHEET_REFS}" (id 0) (at 180.7088 125.0156 0)
(effects (font (size 1.27 1.27)) (justify right) hide)
)
)
(global_label "SCL" (shape input) (at 186.69 150.495 180) (fields_autoplaced)
(effects (font (size 1.27 1.27)) (justify right))
(uuid 8424cb96-c803-4758-9462-123b35ab96a8)
(property "Intersheet References" "${INTERSHEET_REFS}" (id 0) (at 180.7693 150.4156 0)
(effects (font (size 1.27 1.27)) (justify right) hide)
)
)
(global_label "SDA" (shape input) (at 186.69 153.035 180) (fields_autoplaced)
(effects (font (size 1.27 1.27)) (justify right))
(uuid 97408f7f-8dfd-456e-b439-a7cc5a67d1ad)
(property "Intersheet References" "${INTERSHEET_REFS}" (id 0) (at 180.7088 152.9556 0)
(effects (font (size 1.27 1.27)) (justify right) hide)
)
)
@ -2602,6 +2707,22 @@
(pin "2" (uuid f3038d06-2a03-47f4-b946-437fc091bc37))
)
(symbol (lib_id "power:GND") (at 140.335 172.085 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 103255ac-3e68-40aa-8071-3a37ea76c453)
(property "Reference" "#PWR?" (id 0) (at 140.335 178.435 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "GND" (id 1) (at 140.335 177.165 0))
(property "Footprint" "" (id 2) (at 140.335 172.085 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 140.335 172.085 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid ece83a93-ff24-48a6-913c-4d0b1f9452df))
)
(symbol (lib_id "Device:C_Polarized") (at 156.845 37.465 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 107c0f31-ae89-4160-bccb-0c7df08de912)
@ -2672,17 +2793,17 @@
(pin "3" (uuid 923e4642-a9c1-40de-b053-33a25f74ed20))
)
(symbol (lib_id "power:GND") (at 190.5 151.13 0) (unit 1)
(symbol (lib_id "power:GND") (at 140.335 151.13 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 1a81cac8-4966-4048-9e1c-6f30d3e3365b)
(property "Reference" "#PWR?" (id 0) (at 190.5 157.48 0)
(property "Reference" "#PWR?" (id 0) (at 140.335 157.48 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "GND" (id 1) (at 190.5 156.21 0))
(property "Footprint" "" (id 2) (at 190.5 151.13 0)
(property "Value" "GND" (id 1) (at 140.335 156.21 0))
(property "Footprint" "" (id 2) (at 140.335 151.13 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 190.5 151.13 0)
(property "Datasheet" "" (id 3) (at 140.335 151.13 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 4bc7bfb1-3680-4f24-9234-0fa0ee06eff4))
@ -2781,17 +2902,17 @@
(pin "1" (uuid 01ecbcca-b791-4eeb-9027-2ce99f64e9b9))
)
(symbol (lib_id "power:+5V") (at 187.325 142.875 0) (unit 1)
(symbol (lib_id "power:+5V") (at 137.16 142.875 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 2c93eb7c-facb-4883-8e42-043be7dbb19d)
(property "Reference" "#PWR?" (id 0) (at 187.325 146.685 0)
(property "Reference" "#PWR?" (id 0) (at 137.16 146.685 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "+5V" (id 1) (at 187.325 137.795 0))
(property "Footprint" "" (id 2) (at 187.325 142.875 0)
(property "Value" "+5V" (id 1) (at 137.16 137.795 0))
(property "Footprint" "" (id 2) (at 137.16 142.875 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 187.325 142.875 0)
(property "Datasheet" "" (id 3) (at 137.16 142.875 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid d83f4ebc-cc56-41ab-a290-03c38df69dd3))
@ -2831,6 +2952,29 @@
(pin "2" (uuid f78e6043-16db-4fef-94dd-5958d2d5cb6c))
)
(symbol (lib_id "Connector_Generic:Conn_01x06") (at 196.215 122.555 0) (unit 1)
(in_bom yes) (on_board yes)
(uuid 3d95254f-4cdd-4081-99f9-782d0d7c58ee)
(property "Reference" "J?" (id 0) (at 194.945 113.03 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "WaterlevelA" (id 1) (at 193.04 114.3 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "" (id 2) (at 196.215 122.555 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 196.215 122.555 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 1662552d-36a3-4d96-8451-b12aee75c20f))
(pin "2" (uuid e9317438-c7ef-4bd0-911d-f77edf062069))
(pin "3" (uuid bc9e8379-b7e4-413a-90a7-387bec4e6264))
(pin "4" (uuid f68debc8-4388-4ceb-a935-72ee3ab8b43c))
(pin "5" (uuid d42c04b1-9af8-4115-aa5f-9790b5e0ac4d))
(pin "6" (uuid 67f52d28-73b0-44af-852e-ec9cd34ec8c1))
)
(symbol (lib_id "power:+5V") (at 234.95 68.58 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 3f46ae9c-b86c-4e80-82e5-b49cc1de72dd)
@ -3238,27 +3382,6 @@
(pin "1" (uuid 6f8a1c81-c22f-4862-a52a-a42524be9fa6))
)
(symbol (lib_id "Connector_Generic:Conn_01x04") (at 196.215 123.19 0) (unit 1)
(in_bom yes) (on_board yes)
(uuid 88e824d2-5db4-4eff-8b9f-713b03f28cb6)
(property "Reference" "J?" (id 0) (at 194.945 115.57 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "Conn_01x04" (id 1) (at 190.5 117.475 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "" (id 2) (at 196.215 123.19 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 196.215 123.19 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid d847fd9c-d0c5-4dc1-9034-c024842b0fcb))
(pin "2" (uuid 04be0de6-e01f-46ec-b484-ce02d56e930a))
(pin "3" (uuid dccbd544-3fae-4e2b-8786-73139108db44))
(pin "4" (uuid 717ff7c1-ccaa-4609-af39-296a5095221d))
)
(symbol (lib_id "power:GND") (at 85.725 132.08 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 8a54bb4f-f96d-4fe1-a82d-f35d2581c379)
@ -3377,6 +3500,38 @@
(pin "2" (uuid 4556175c-a9f9-4425-8161-22d724c222b4))
)
(symbol (lib_id "power:+5V") (at 137.16 163.83 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid 96389d16-9231-45dc-ac3b-46e90d8d2fe2)
(property "Reference" "#PWR?" (id 0) (at 137.16 167.64 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "+5V" (id 1) (at 137.16 158.75 0))
(property "Footprint" "" (id 2) (at 137.16 163.83 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 137.16 163.83 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid b7acfa3f-61df-47cb-b371-94c9b6b06b95))
)
(symbol (lib_id "power:GND") (at 187.96 157.48 0) (unit 1)
(in_bom yes) (on_board yes)
(uuid 9bf716ac-6235-41af-9d7f-2e836725d1bc)
(property "Reference" "#PWR?" (id 0) (at 187.96 163.83 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "GND" (id 1) (at 187.96 161.29 0))
(property "Footprint" "" (id 2) (at 187.96 157.48 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 187.96 157.48 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid bd55c48f-4ba8-44cc-8756-36366039c13f))
)
(symbol (lib_id "power:GND") (at 146.685 43.18 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid a80c5f47-0c3d-47be-9ba8-8baba7a70db7)
@ -3492,19 +3647,39 @@
(pin "1" (uuid fbee685c-c696-4cda-88c8-721ccbcb542d))
)
(symbol (lib_id "Connector_Generic:Conn_01x03") (at 196.85 147.32 0) (unit 1)
(symbol (lib_id "Connector_Generic:Conn_01x03") (at 146.685 168.275 0) (unit 1)
(in_bom yes) (on_board yes)
(uuid caff71ed-53ee-4d75-9aae-b13bbc22ffea)
(property "Reference" "J?" (id 0) (at 195.58 138.43 0)
(uuid bfcd556b-3f51-4c5c-ad8e-48cde0575403)
(property "Reference" "J?" (id 0) (at 145.415 159.385 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "Flow" (id 1) (at 193.04 140.97 0)
(property "Value" "FlowB" (id 1) (at 142.875 161.925 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "" (id 2) (at 196.85 147.32 0)
(property "Footprint" "" (id 2) (at 146.685 168.275 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 196.85 147.32 0)
(property "Datasheet" "~" (id 3) (at 146.685 168.275 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 9801dfd7-10c1-4963-8919-9bd98edf9a48))
(pin "2" (uuid 3c7bd806-4067-445c-ac7a-bd10cb498654))
(pin "3" (uuid be38396c-1bc3-4328-a1a5-3a2e5fc5520f))
)
(symbol (lib_id "Connector_Generic:Conn_01x03") (at 146.685 147.32 0) (unit 1)
(in_bom yes) (on_board yes)
(uuid caff71ed-53ee-4d75-9aae-b13bbc22ffea)
(property "Reference" "J?" (id 0) (at 145.415 138.43 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "FlowA" (id 1) (at 142.875 140.97 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "" (id 2) (at 146.685 147.32 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 146.685 147.32 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 2e3f04ae-4994-4312-84cd-801811195ba1))
@ -3612,6 +3787,29 @@
(pin "1" (uuid 8a77e51d-875d-4623-a75c-0c930364edc5))
)
(symbol (lib_id "Connector_Generic:Conn_01x06") (at 196.215 150.495 0) (unit 1)
(in_bom yes) (on_board yes)
(uuid dbbdc8d0-715d-4edd-b0ba-f1e442377325)
(property "Reference" "J?" (id 0) (at 194.945 140.97 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Value" "WaterlevelB" (id 1) (at 193.04 142.24 0)
(effects (font (size 1.27 1.27)) (justify left))
)
(property "Footprint" "" (id 2) (at 196.215 150.495 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "~" (id 3) (at 196.215 150.495 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 72f51130-24f2-4bb3-abb5-d959bcc838f4))
(pin "2" (uuid 8eeab9a0-844d-4912-8112-bfdd68a48640))
(pin "3" (uuid 8d5b0326-322b-4c3f-af8c-280b9a1e68ef))
(pin "4" (uuid a7b2469b-ade5-43c3-a768-4888182a86fa))
(pin "5" (uuid c711ae19-97f8-4de1-a025-dfab9527063e))
(pin "6" (uuid 9bf5e0c7-6f90-4bd2-91e5-328e8d076830))
)
(symbol (lib_id "Connector_Generic:Conn_01x02") (at 240.03 50.165 180) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid dd5339fd-d4b2-46a2-9282-6b3c61f986c2)
@ -3663,6 +3861,22 @@
(pin "3" (uuid ca06a64e-6449-410b-a26b-c1a02c74b05f))
)
(symbol (lib_id "power:+5V") (at 189.23 142.875 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid ebab1bf2-be7c-4498-b712-2771a8eb39a6)
(property "Reference" "#PWR?" (id 0) (at 189.23 146.685 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Value" "+5V" (id 1) (at 189.23 137.795 0))
(property "Footprint" "" (id 2) (at 189.23 142.875 0)
(effects (font (size 1.27 1.27)) hide)
)
(property "Datasheet" "" (id 3) (at 189.23 142.875 0)
(effects (font (size 1.27 1.27)) hide)
)
(pin "1" (uuid 2eacb6b5-8ba6-4857-ae29-9bd037e8021d))
)
(symbol (lib_id "Device:R") (at 93.345 38.735 0) (unit 1)
(in_bom yes) (on_board yes) (fields_autoplaced)
(uuid ed7ae94a-e454-49ed-b1cc-f33a121d8732)
@ -3690,6 +3904,9 @@
(path "/08882ad5-f088-4ddf-88fc-95cf6d167cce"
(reference "#PWR?") (unit 1) (value "+5V") (footprint "")
)
(path "/103255ac-3e68-40aa-8071-3a37ea76c453"
(reference "#PWR?") (unit 1) (value "GND") (footprint "")
)
(path "/14e1624d-1343-4c28-8333-5cbe2fa47b7f"
(reference "#PWR?") (unit 1) (value "+5V") (footprint "")
)
@ -3753,6 +3970,12 @@
(path "/8a54bb4f-f96d-4fe1-a82d-f35d2581c379"
(reference "#PWR?") (unit 1) (value "GND") (footprint "")
)
(path "/96389d16-9231-45dc-ac3b-46e90d8d2fe2"
(reference "#PWR?") (unit 1) (value "+5V") (footprint "")
)
(path "/9bf716ac-6235-41af-9d7f-2e836725d1bc"
(reference "#PWR?") (unit 1) (value "GND") (footprint "")
)
(path "/a80c5f47-0c3d-47be-9ba8-8baba7a70db7"
(reference "#PWR?") (unit 1) (value "GND") (footprint "")
)
@ -3783,6 +4006,9 @@
(path "/e9492f6c-6406-45f3-9cd7-5ba4789120e7"
(reference "#PWR?") (unit 1) (value "+5V") (footprint "")
)
(path "/ebab1bf2-be7c-4498-b712-2771a8eb39a6"
(reference "#PWR?") (unit 1) (value "+5V") (footprint "")
)
(path "/107c0f31-ae89-4160-bccb-0c7df08de912"
(reference "C?") (unit 1) (value "100uF") (footprint "")
)
@ -3813,6 +4039,9 @@
(path "/25db92da-e33b-4811-8aee-180ed90d643e"
(reference "J?") (unit 1) (value "EC_Sensor") (footprint "")
)
(path "/3d95254f-4cdd-4081-99f9-782d0d7c58ee"
(reference "J?") (unit 1) (value "WaterlevelA") (footprint "")
)
(path "/52fcea3f-2d19-4b28-8cb5-7429d27114e8"
(reference "J?") (unit 1) (value "EC_Probe") (footprint "")
)
@ -3828,21 +4057,24 @@
(path "/78b0af65-351c-45b0-9849-6ddc2941ca62"
(reference "J?") (unit 1) (value "ADS1115") (footprint "")
)
(path "/88e824d2-5db4-4eff-8b9f-713b03f28cb6"
(reference "J?") (unit 1) (value "Conn_01x04") (footprint "")
)
(path "/92d1ac2e-235c-4a3b-b1c6-000fa41ba508"
(reference "J?") (unit 1) (value "12V In") (footprint "")
)
(path "/b99f3d7f-19ab-4542-9b4d-dcb32f0f7fe3"
(reference "J?") (unit 1) (value "Soil_Moisture") (footprint "")
)
(path "/bfcd556b-3f51-4c5c-ad8e-48cde0575403"
(reference "J?") (unit 1) (value "FlowB") (footprint "")
)
(path "/caff71ed-53ee-4d75-9aae-b13bbc22ffea"
(reference "J?") (unit 1) (value "Flow") (footprint "")
(reference "J?") (unit 1) (value "FlowA") (footprint "")
)
(path "/cd91459e-68c7-412a-b592-1864faa83740"
(reference "J?") (unit 1) (value "Soil_Moisture") (footprint "")
)
(path "/dbbdc8d0-715d-4edd-b0ba-f1e442377325"
(reference "J?") (unit 1) (value "WaterlevelB") (footprint "")
)
(path "/dd5339fd-d4b2-46a2-9282-6b3c61f986c2"
(reference "J?") (unit 1) (value "EC_Probe") (footprint "")
)

View File

@ -18,13 +18,12 @@ bool ec_flag_measurement_available=false;
#define EC_UNAVAILABLE -1
#define EC_PIN_RELAY_PROBE 27
#define EC_PIN_RELAY_PROBESELECT 26
//#define EC_PIN_RELAY_PROBE 27 //moved to platformio.ini
//#define EC_PIN_ADC 4
#define EC_ADS_CHANNEL 0
#define EC_PIN_FREQ 5
//#define EC_PIN_FREQ 5 //move to platformio.ini
#define EC_PWM_CH 0
#define EC_RESOLUTION 8
#define EC_FREQUENCY 5000
@ -51,22 +50,16 @@ unsigned long ec_last_change_relay=0; //millis of last relay change
enum ECState{IDLE,MEASURE};
uint8_t probeselect=0;
const uint8_t num_probes=2;
ECState ecstate=IDLE;
float ec_calib_adc;
float ec_adc_A;
float ec_adc_adjusted_A; //adjusted for reference resistor
float ec_A; //ec value after adjustment for reference (at current temperature)
float ec25_A; //ec value but temperature adjusted for 25 degC
float ec_adc_B;
float ec_adc_adjusted_B; //adjusted for reference resistor
float ec_B; //ec value after adjustment for reference (at current temperature)
float ec25_B; //ec value but temperature adjusted for 25 degC
float ec_adc;
float ec_adc_adjusted; //adjusted for reference resistor
float ec; //ec value after adjustment for reference (at current temperature)
float ec25; //ec value but temperature adjusted for 25 degC
float ec_tempadjust_alpa=0.02;
float ec_reference_adc=6016.88; //adc reference value for the calibration resistor measurement.
@ -78,21 +71,28 @@ float ec_reference_adc=6016.88; //adc reference value for the calibration resist
//float ec_calibration_polynom[]={1033.928052655456,-3.8909104921922895,0.005627541436014758,-4.103988840997024e-06,1.7231981870816133e-09,-4.433707707721975e-13,7.203892111369395e-17,-7.406549810844244e-21,4.667420606439905e-25,-1.6439457516812463e-29,2.477292190335455e-34}; //20220505
//float ec_calibration_polynom[]={-323.68589929771457,0.5836096440900665,-0.000279737392438965,5.98673062873e-08,-5.4460235093798435e-12,1.8535134644431135e-16}; //20230509
//float ec_calibration_polynom[]={212.6826331524675,-0.6043878865263305,0.000571551634082491,-1.827897106718841e-07,2.682337041246909e-11,-1.8368511021965982e-15,4.8269168538877025e-20}; //20230509 manuell
float ec_calibration_polynom_A[]={8.718380956513695,-0.026463423062356713,3.425216464107108e-05,-4.069826379094172e-09,2.478900495960682e-13}; //20240423, graphite electrodes
float ec_calibration_linearize_below_adc_A=2000; //use linear approximation below this adc value. 0=disable
float ec_calibration_linear_lowADC_A=728; //x0
float ec_calibration_linear_lowEC_A=0; //y0
//float ec_calibration_polynom[]={8.718380956513695,-0.026463423062356713,3.425216464107108e-05,-4.069826379094172e-09,2.478900495960682e-13}; //20240423, graphite electrodes
// 20240423, graphite electrodes DB {8.718380956513695,-0.026463423062356713,3.425216464107108e-05,-4.069826379094172e-09,2.478900495960682e-13}
// 20240423, graphite electrodes NFT {18.785904241636743,-0.04069178351449846,3.528797358514823e-05,-4.214254847500995e-09,2.543662736303669e-13}
float ec_calibration_polynom[]=EC_CALIBRATION_POLYNOM;
float ec_calibration_linearize_below_adc=EC_CALIBRATION_LINEARIZE_BELOW_ADC; //use linear approximation below this adc value. 0=disable
float ec_calibration_linear_lowADC=EC_CALIBRATION_LINEAR_LOWADC; //x0
float ec_calibration_linear_lowEC=EC_CALIBRATION_LINEAR_LOWEC; //y0
/*
float ec_calibration_polynom_B[]={18.785904241636743,-0.04069178351449846,3.528797358514823e-05,-4.214254847500995e-09,2.543662736303669e-13}; //20240423, graphite electrodes
float ec_calibration_linearize_below_adc_B=2000; //use linear approximation below this adc value. 0=disable
float ec_calibration_linear_lowADC_B=728; //x0
float ec_calibration_linear_lowEC_B=0; //y0
*/
bool ec_measurementReady();
void ec_startMeasurement();
void ec_setRange(uint8_t range);
void ec_connectProbe(bool, uint8_t);
void ec_connectProbe(bool);
void ec_releaseRelay();
float ec_getECfromADC(float adc, float ec_calibration_polynom[], size_t len_ec_calibration_polynom, float ec_calibration_linearize_below_adc, float ec_calibration_linear_lowADC, float ec_calibration_linear_lowEC);
float ec_calculateEC25(float pEC,float pTemp);
@ -131,7 +131,6 @@ void ec_setup() {
ledcWrite(EC_PWM_CH, 127); //50% duty cycle
pinMode(EC_PIN_RELAY_PROBE,OUTPUT); //LOW=Calibration/idle, HIGH=Probe connected
pinMode(EC_PIN_RELAY_PROBESELECT,OUTPUT); //LOW=Probe A, HIGH=Probe B
ec_releaseRelay();
}
@ -149,7 +148,7 @@ void ec_loop(unsigned long loopmillis) {
last_measurement_ec=loopmillis;
force_ec_measurement=false;
ec_startMeasurement();
ec_connectProbe(true,0); //Probe A
ec_connectProbe(true);
ecstate=MEASURE;
@ -169,13 +168,10 @@ void ec_loop(unsigned long loopmillis) {
if (isValueArrayOK(ec_calib_array,EC_CALIB_ARRAY_SIZE,EC_ADC_UNAVAILABLE)){
ec_calib_adc=getMean(ec_calib_array,EC_CALIB_ARRAY_SIZE);
ec_adc_adjusted=mapf(ec_adc,0,ec_calib_adc,0,ec_reference_adc);
if (probeselect==0) {
ec=ec_getECfromADC(ec_adc_adjusted, ec_calibration_polynom_A, sizeof(ec_calibration_polynom_A), ec_calibration_linearize_below_adc_A, ec_calibration_linear_lowADC_A, ec_calibration_linear_lowEC_A);
ec25=ec_calculateEC25(ec,tempC_reservoir_a);
}else if (probeselect==1) {
ec=ec_getECfromADC(ec_adc_adjusted, ec_calibration_polynom_B, sizeof(ec_calibration_polynom_B), ec_calibration_linearize_below_adc_B, ec_calibration_linear_lowADC_B, ec_calibration_linear_lowEC_B);
ec25=ec_calculateEC25(ec,tempC_reservoir_b);
}
ec=ec_getECfromADC(ec_adc_adjusted, ec_calibration_polynom, sizeof(ec_calibration_polynom), ec_calibration_linearize_below_adc, ec_calibration_linear_lowADC, ec_calibration_linear_lowEC);
ec25=ec_calculateEC25(ec,tempC_reservoir);
//Serial.println("DEBUG: EC OK");
}else{
@ -185,32 +181,10 @@ void ec_loop(unsigned long loopmillis) {
ec25=EC_UNAVAILABLE;
//Serial.println("DEBUG: EC unavailable");
}
if (probeselect==0) {
//Serial.println("DEBUG: Assigning to A");
ec_adc_A=ec_adc;
ec_adc_adjusted_A=ec_adc_adjusted;
ec_A=ec;
ec25_A=ec25;
last_measurement_ec=loopmillis;
force_ec_measurement=false;
ec_startMeasurement();
probeselect=1; //Select Probe B
ec_connectProbe(true,probeselect); //Probe B
ecstate=MEASURE;
}else if(probeselect==1) {
//Serial.println("DEBUG: Assigning to B");
ec_adc_B=ec_adc;
ec_adc_adjusted_B=ec_adc_adjusted;
ec_B=ec;
ec25_B=ec25;
probeselect=0; //Reset to Probe A
ec_flag_measurement_available=true;
ecstate=IDLE;
}
ec_flag_measurement_available=true;
ecstate=IDLE;
}
@ -273,29 +247,17 @@ bool ec_measurementReady(){
}
void ec_connectProbe(bool relay, uint8_t probeselect) {
void ec_connectProbe(bool relay) {
bool val=digitalRead(EC_PIN_RELAY_PROBE);
bool valsel=digitalRead(EC_PIN_RELAY_PROBESELECT);
if (val!=relay) { //write only if different
digitalWrite(EC_PIN_RELAY_PROBE,relay);
//Serial.print("DEBUG: Set Relay to "); Serial.println(relay);
ec_last_change_relay=millis();
}
if (valsel!=probeselect) { //write only if different
if (probeselect==0) {
digitalWrite(EC_PIN_RELAY_PROBESELECT,false);
//Serial.println("DEBUG: Selected Probe A");
}else if (probeselect==1) {
digitalWrite(EC_PIN_RELAY_PROBESELECT,true);
//Serial.println("DEBUG: Selected Probe B");
}
ec_last_change_relay=millis();
}
}
void ec_releaseRelay() {
digitalWrite(EC_PIN_RELAY_PROBE,LOW);
digitalWrite(EC_PIN_RELAY_PROBESELECT,LOW);
//Serial.println("DEBUG: Released Relays");
ec_last_change_relay=millis();
}

View File

@ -1,73 +1,53 @@
#ifndef _FLOW_H_
#define _FLOW_H_
mqttValueTiming timing_flow_a;
mqttValueTiming timing_flow_b;
mqttValueTiming timing_flow;
#define FLOW_A_PIN 16
#define FLOW_B_PIN 17
uint16_t flow_a_counter=0; //maximum counts/s measured with Eden 128 Pump was 171
uint16_t flow_b_counter=0; //maximum counts/s measured with Eden 128 Pump was 171
void IRAM_ATTR isr_flow_a();
void IRAM_ATTR isr_flow_b();
unsigned long last_read_flow_a=0;
unsigned long last_read_flow_b=0;
//#define FLOW_PIN 16 //move to platformio.ini
uint16_t flow_counter=0; //maximum counts/s measured with Eden 128 Pump was 171
void IRAM_ATTR isr_flow();
unsigned long last_read_flow=0;
#define READINTERVAL_FLOW 10000
float flow_factor=7.5; //F=7.5*flowrate[L/min]
float flow_a;
float flow_b;
float flow;
uint32_t flow_counter_sum=0;
uint32_t flow_a_counter_sum=0;
uint32_t flow_b_counter_sum=0;
void flow_setup() {
timing_flow_a.minchange=0.0;
timing_flow_a.maxchange=0.3;
timing_flow_a.mintime=10*1000;
timing_flow_a.maxtime=30*60*1000;
timing_flow.minchange=0.0;
timing_flow.maxchange=0.3;
timing_flow.mintime=10*1000;
timing_flow.maxtime=30*60*1000;
timing_flow_b.minchange=0.0;
timing_flow_b.maxchange=0.3;
timing_flow_b.mintime=10*1000;
timing_flow_b.maxtime=30*60*1000;
pinMode(FLOW_A_PIN, INPUT_PULLUP);
pinMode(FLOW_B_PIN, INPUT_PULLUP);
attachInterrupt(FLOW_A_PIN, isr_flow_a, CHANGE);
attachInterrupt(FLOW_B_PIN, isr_flow_b, CHANGE);
pinMode(FLOW_PIN, INPUT_PULLUP);
attachInterrupt(FLOW_PIN, isr_flow, CHANGE);
}
void flow_loop(unsigned long loopmillis) {
if (loopmillis>=last_read_flow_a+READINTERVAL_FLOW) {
flow_a=flow_a_counter*1000.0/(loopmillis-last_read_flow_a)/2.0; //Frequency [Hz]
flow_a/=flow_factor; //[L/min]
if (loopmillis>=last_read_flow+READINTERVAL_FLOW) {
flow=flow_counter*1000.0/(loopmillis-last_read_flow)/2.0; //Frequency [Hz]
flow/=flow_factor; //[L/min]
flow_a_counter=0;
last_read_flow_a=loopmillis;
flow_counter=0;
last_read_flow=loopmillis;
}
if (loopmillis>=last_read_flow_b+READINTERVAL_FLOW) {
flow_b=flow_b_counter*1000.0/(loopmillis-last_read_flow_b)/2.0; //Frequency [Hz]
flow_b/=flow_factor; //[L/min]
flow_b_counter=0;
last_read_flow_b=loopmillis;
}
}
void IRAM_ATTR isr_flow_a() {
flow_a_counter++;
flow_a_counter_sum++;
void IRAM_ATTR isr_flow() {
flow_counter++;
flow_counter_sum++;
}
void IRAM_ATTR isr_flow_b() {
flow_b_counter++;
flow_b_counter_sum++;
}
#endif

View File

@ -2,8 +2,7 @@
#define _TEMPERATURE_H_
mqttValueTiming timing_temperature_reservoir_a;
mqttValueTiming timing_temperature_reservoir_b;
mqttValueTiming timing_temperature_reservoir;
mqttValueTiming timing_temperature_case;
#include <OneWire.h>
@ -14,12 +13,12 @@ void printAddress(DeviceAddress deviceAddress);
//first address: 28FF6C1C7216058B
//second address:
#define ONE_WIRE_BUS 18 //GPIO pin
//#define ONE_WIRE_BUS_PIN 18 //GPIO pin moved to platformio.ini
#define TEMPERATURE_PRECISION 12 //max is 12
#define READINTERVAL_DS18B20 1000 //ms
// Setup a oneWire instance to communicate with any OneWire devices (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
OneWire oneWire(ONE_WIRE_BUS_PIN);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
@ -28,21 +27,17 @@ DallasTemperature sensors(&oneWire);
#define TEMPMEAN_SIZE 16
uint16_t tempCmean_pos=0;
// arrays to hold device addresses
DeviceAddress thermometerReservoirA={0x28,0xFF,0x6F,0x19,0x72,0x16,0x05,0x44};
float tempC_reservoir_a; //last reading
float tempCmean_reservoir_a_array[TEMPMEAN_SIZE];
float tempCmean_reservoir_a=DEVICE_DISCONNECTED_C;
//DeviceAddress thermometerAir={0x28,0xFF,0x6C,0x1C,0x72,0x16,0x05,0x8B};
//DeviceAddress thermometerReservoirA={0x28,0xFF,0x6F,0x19,0x72,0x16,0x05,0x44}; //NFT
//DeviceAddress thermometerReservoirB={0x28,0xFF,0x30,0xBA,0x85,0x16,0x03,0xB5}; //DB
DeviceAddress thermometerReservoir=THERMOMETER_ADDR_RESERVOIR;
float tempC_reservoir; //last reading
float tempCmean_reservoir_array[TEMPMEAN_SIZE];
float tempCmean_reservoir=DEVICE_DISCONNECTED_C;
DeviceAddress thermometerReservoirB={0x28,0xFF,0x30,0xBA,0x85,0x16,0x03,0xB5};
float tempC_reservoir_b; //last reading
float tempCmean_reservoir_b_array[TEMPMEAN_SIZE];
float tempCmean_reservoir_b=DEVICE_DISCONNECTED_C;
DeviceAddress thermometerCase={0x10,0x7E,0x22,0x99,0x01,0x08,0x00,0xA4};
DeviceAddress thermometerCase=THERMOMETER_ADDR_CASE;
float tempC_case; //last reading
float tempCmean_case_array[TEMPMEAN_SIZE];
float tempCmean_case=DEVICE_DISCONNECTED_C;
@ -51,15 +46,10 @@ float tempCmean_case=DEVICE_DISCONNECTED_C;
void temperature_setup() {
timing_temperature_reservoir_a.minchange=0.0;
timing_temperature_reservoir_a.maxchange=0.5;
timing_temperature_reservoir_a.mintime=2*1000;
timing_temperature_reservoir_a.maxtime=60*60*1000;
timing_temperature_reservoir_b.minchange=0.0;
timing_temperature_reservoir_b.maxchange=0.5;
timing_temperature_reservoir_b.mintime=2*1000;
timing_temperature_reservoir_b.maxtime=60*60*1000;
timing_temperature_reservoir.minchange=0.0;
timing_temperature_reservoir.maxchange=0.5;
timing_temperature_reservoir.mintime=2*1000;
timing_temperature_reservoir.maxtime=60*60*1000;
timing_temperature_case.minchange=0.0;
@ -69,8 +59,7 @@ void temperature_setup() {
//initialize mean array
for (uint16_t i=0;i<TEMPMEAN_SIZE;i++) {
tempCmean_reservoir_a_array[i]=-127;
tempCmean_reservoir_b_array[i]=-127;
tempCmean_reservoir_array[i]=-127;
tempCmean_case_array[i]=-127;
}
@ -110,8 +99,7 @@ void temperature_setup() {
}
sensors.setResolution(thermometerReservoirA, TEMPERATURE_PRECISION);
sensors.setResolution(thermometerReservoirB, TEMPERATURE_PRECISION);
sensors.setResolution(thermometerReservoir, TEMPERATURE_PRECISION);
sensors.setResolution(thermometerCase, TEMPERATURE_PRECISION);
}
@ -134,35 +122,21 @@ void temperature_loop(unsigned long loopmillis) {
flag_requestTemperatures=false;
last_read_ds18b20=loopmillis;
tempC_reservoir_a = sensors.getTempC(thermometerReservoirA);
if (tempC_reservoir_a == DEVICE_DISCONNECTED_C)
tempC_reservoir = sensors.getTempC(thermometerReservoir);
if (tempC_reservoir == DEVICE_DISCONNECTED_C)
{
Serial.print(" Error reading: "); printAddress(thermometerReservoirA);
publishInfo("error/temperature","Error reading thermometerReservoirA");
Serial.print(" Error reading: "); printAddress(thermometerReservoir); Serial.println();
publishInfo("error/temperature","Error reading thermometerReservoir");
}else{
tempCmean_reservoir_a_array[tempCmean_pos]=tempC_reservoir_a;
if (isValueArrayOKf(tempCmean_reservoir_a_array,TEMPMEAN_SIZE,DEVICE_DISCONNECTED_C)) {
tempCmean_reservoir_a=getMeanf(tempCmean_reservoir_a_array,TEMPMEAN_SIZE);
tempCmean_reservoir_array[tempCmean_pos]=tempC_reservoir;
if (isValueArrayOKf(tempCmean_reservoir_array,TEMPMEAN_SIZE,DEVICE_DISCONNECTED_C)) {
tempCmean_reservoir=getMeanf(tempCmean_reservoir_array,TEMPMEAN_SIZE);
}else{
tempCmean_reservoir_a=DEVICE_DISCONNECTED_C;
tempCmean_reservoir=DEVICE_DISCONNECTED_C;
}
}
tempC_reservoir_b = sensors.getTempC(thermometerReservoirB);
if (tempC_reservoir_b == DEVICE_DISCONNECTED_C)
{
Serial.print(" Error reading: "); printAddress(thermometerReservoirB);
publishInfo("error/temperature","Error reading thermometerReservoirB");
}else{
tempCmean_reservoir_b_array[tempCmean_pos]=tempC_reservoir_b;
if (isValueArrayOKf(tempCmean_reservoir_b_array,TEMPMEAN_SIZE,DEVICE_DISCONNECTED_C)) {
tempCmean_reservoir_b=getMeanf(tempCmean_reservoir_b_array,TEMPMEAN_SIZE);
}else{
tempCmean_reservoir_b=DEVICE_DISCONNECTED_C;
}
}
tempC_case = sensors.getTempC(thermometerCase);
if (tempC_case == DEVICE_DISCONNECTED_C)
{

View File

@ -19,8 +19,8 @@
// +++++++++++++++ VL53L0X +++++++++++++++
VL53L0X sensorA;
#define PIN_VL53L0X_XSHUT_A 19
VL53L0X tofsensor;
// Uncomment this line to use long range mode. This
// increases the sensitivity of the sensor and extends its
// potential range, but increases the likelihood of getting
@ -40,94 +40,32 @@ VL53L0X sensorA;
float waterlevelAMean_array[WATERLEVELMEAN_SIZE];
uint16_t waterlevelAMean_array_pos=0;
float waterlevelA=WATERLEVEL_UNAVAILABLE;
float watervolumeA=WATERLEVEL_UNAVAILABLE;
float waterlevelMean_array[WATERLEVELMEAN_SIZE];
uint16_t waterlevelMean_array_pos=0;
float waterlevel=WATERLEVEL_UNAVAILABLE;
float watervolume=WATERLEVEL_UNAVAILABLE;
//Calibration
float waterlevelA_calib_offset=500.0; //c
float waterlevelA_calib_factor=-1.0; //m
float waterlevel_calib_offset=500.0; //c
float waterlevel_calib_factor=-1.0; //m
float waterlevelA_calib_reservoirArea=20*20*3.1416; //area in cm^2. barrel diameter inside is 400mm
float waterlevel_calib_reservoirArea=20*20*3.1416; //area in cm^2. barrel diameter inside is 400mm
uint16_t distanceA_unsuccessful_count=0;
// +++++++++++++++ VL53L0X +++++++++++++++
VL53L0X sensorB;
#define PIN_VL53L0X_XSHUT_B 23
// Uncomment this line to use long range mode. This
// increases the sensitivity of the sensor and extends its
// potential range, but increases the likelihood of getting
// an inaccurate reading because of reflections from objects
// other than the intended target. It works best in dark
// conditions.
//#define LONG_RANGE
// Uncomment ONE of these two lines to get
// - higher speed at the cost of lower accuracy OR
// - higher accuracy at the cost of lower speed
//#define HIGH_SPEED
#define HIGH_ACCURACY
uint16_t distance_unsuccessful_count=0;
float waterlevelBMean_array[WATERLEVELMEAN_SIZE];
uint16_t waterlevelBMean_array_pos=0;
float waterlevelB=WATERLEVEL_UNAVAILABLE; //distance from floor to water surface [mm]
float watervolumeB=WATERLEVEL_UNAVAILABLE; //calculated Volume in Reservoir
float waterlevel_heightToVolume(float distance);
//Calibration
float waterlevelB_calib_offset=273.0; //c
float waterlevelB_calib_factor=-1.0; //m
float waterlevelB_calib_reservoirArea=56.5*36.5; //area in cm^2
uint16_t distanceB_unsuccessful_count=0;
float waterlevelA_heightToVolume(float distance);
float waterlevelB_heightToVolume(float distance);
mqttValueTiming timing_waterlevelA;
mqttValueTiming timing_waterlevelB;
void waterlevel_shutdownSensors() {
pinMode(PIN_VL53L0X_XSHUT_A, OUTPUT);
digitalWrite(PIN_VL53L0X_XSHUT_A, LOW); //pull to GND
pinMode(PIN_VL53L0X_XSHUT_B, OUTPUT);
digitalWrite(PIN_VL53L0X_XSHUT_B, LOW); //pull to GND
}
void waterlevel_enableSensor(uint8_t sensorid) {
switch (sensorid){
case 0:
pinMode(PIN_VL53L0X_XSHUT_A, INPUT); //Enable Sensor A
break;
case 1:
pinMode(PIN_VL53L0X_XSHUT_B, INPUT); //Enable Sensor B
break;
}
}
mqttValueTiming timing_waterlevel;
void waterlevel_setup() {
waterlevel_shutdownSensors();
delay(100);
/*
Wire.begin();
@ -170,71 +108,25 @@ void waterlevel_setup() {
timing_waterlevelA.minchange=0.0;
timing_waterlevelA.maxchange=7.0;
timing_waterlevelA.mintime=30*000;
timing_waterlevelA.maxtime=60*60*1000;
timing_waterlevel.minchange=0.0;
timing_waterlevel.maxchange=7.0;
timing_waterlevel.mintime=30*000;
timing_waterlevel.maxtime=60*60*1000;
timing_waterlevelB.minchange=0.0;
timing_waterlevelB.maxchange=3.0;
timing_waterlevelB.mintime=10*000;
timing_waterlevelB.maxtime=60*60*1000;
waterlevel_enableSensor(1); //1==B //Enable Sensor B first, to change its address
delay(50);
Wire.begin(21,22);
Wire.begin(PIN_SDA,PIN_SCL);
Serial.print("I2C Clock Speed=");
Serial.println(Wire.getClock());
delay(100);
//Initialize SensorB first
sensorB.setTimeout(2000);
if (!sensorB.init())
tofsensor.setTimeout(2000);
if (!tofsensor.init())
{
Serial.println("Failed to detect and initialize sensorB!");
publishInfo("error/waterlevel","Failed to detect and initialize sensorB");
delay(1000);
}
Serial.println("set addr 0x2A");
sensorB.setAddress(0x2A); //change address
Serial.println("conf Default");
#if defined LONG_RANGE
// lower the return signal rate limit (default is 0.25 MCPS)
sensorB.setSignalRateLimit(0.1);
// increase laser pulse periods (defaults are 14 and 10 PCLKs)
sensorB.setVcselPulsePeriod(VL53L0X::VcselPeriodPreRange, 18);
sensorB.setVcselPulsePeriod(VL53L0X::VcselPeriodFinalRange, 14);
#endif
#if defined HIGH_SPEED
// reduce timing budget to 20 ms (default is about 33 ms)
sensorB.setMeasurementTimingBudget(20000);
#elif defined HIGH_ACCURACY
// increase timing budget to 200 ms
sensorB.setMeasurementTimingBudget(200000);
#endif
// Stop driving this sensor's XSHUT low. This should allow the carrier
// board to pull it high. (We do NOT want to drive XSHUT high since it is
// not level shifted.) Then wait a bit for the sensor to start up.
waterlevel_enableSensor(0);
delay(50);
//Initialize Sensor A after SensorB's address was changed
sensorA.setTimeout(2000);
if (!sensorA.init())
{
Serial.println("Failed to detect and initialize sensorA!");
publishInfo("error/waterlevel","Failed to detect and initialize sensorA");
Serial.println("Failed to detect and initialize tofsensor!");
publishInfo("error/waterlevel","Failed to detect and initialize tofsensor");
delay(1000);
}
@ -242,145 +134,81 @@ void waterlevel_setup() {
#if defined LONG_RANGE
// lower the return signal rate limit (default is 0.25 MCPS)
sensorA.setSignalRateLimit(0.1);
tofsensor.setSignalRateLimit(0.1);
// increase laser pulse periods (defaults are 14 and 10 PCLKs)
sensorA.setVcselPulsePeriod(VL53L0X::VcselPeriodPreRange, 18);
sensorA.setVcselPulsePeriod(VL53L0X::VcselPeriodFinalRange, 14);
tofsensor.setVcselPulsePeriod(VL53L0X::VcselPeriodPreRange, 18);
tofsensor.setVcselPulsePeriod(VL53L0X::VcselPeriodFinalRange, 14);
#endif
#if defined HIGH_SPEED
// reduce timing budget to 20 ms (default is about 33 ms)
sensorA.setMeasurementTimingBudget(20000);
tofsensor.setMeasurementTimingBudget(20000);
#elif defined HIGH_ACCURACY
// increase timing budget to 200 ms
sensorA.setMeasurementTimingBudget(200000);
tofsensor.setMeasurementTimingBudget(200000);
#endif
for (uint16_t i=0;i<WATERLEVELMEAN_SIZE;i++) {
waterlevelAMean_array[i]=WATERLEVEL_UNAVAILABLE; //-1 is also timeout value
waterlevelBMean_array[i]=WATERLEVEL_UNAVAILABLE; //-1 is also timeout value
waterlevelMean_array[i]=WATERLEVEL_UNAVAILABLE; //-1 is also timeout value
}
}
void waterlevel_loop(unsigned long loopmillis) {
static uint8_t waterlevel_loop_select=0;
switch(waterlevel_loop_select)
{
case 0:
// ############ A
static unsigned long last_read_waterlevelA;
if (loopmillis>=last_read_waterlevelA+READINTERVAL_WATERLEVEL) {
last_read_waterlevelA=loopmillis;
uint16_t distance=sensorA.readRangeSingleMillimeters(); //error=65535
//Serial.print("Distance reading A="); Serial.print(distance);Serial.println();
if (distance!=WATERLEVEL_UNAVAILABLE && distance!=65535) { //successful
waterlevelAMean_array[waterlevelAMean_array_pos]=distance;
waterlevelAMean_array_pos++;
waterlevelAMean_array_pos%=WATERLEVELMEAN_SIZE;
distanceA_unsuccessful_count=0;
}else{
distanceA_unsuccessful_count++;
if (distanceA_unsuccessful_count%20==0) {
String _text="Distance A unsuccessful count=";
_text.concat(distanceA_unsuccessful_count);
_text.concat(" distance=");
_text.concat(distance);
publishInfo("error/waterlevel",_text);
}
}
if (isValueArrayOKf(waterlevelAMean_array,WATERLEVELMEAN_SIZE,WATERLEVEL_UNAVAILABLE)){
float _filteredDistance=getFilteredf(waterlevelAMean_array,WATERLEVELMEAN_SIZE,WATERLEVELMEAN_FILTER_CUTOFF);
//Serial.print("Filtered reading A="); Serial.print(_filteredDistance);Serial.println();
static unsigned long last_read_waterlevelB;
if (loopmillis>=last_read_waterlevelB+READINTERVAL_WATERLEVEL) {
last_read_waterlevelB=loopmillis;
uint16_t distance=tofsensor.readRangeSingleMillimeters(); //out of range =255
//Serial.print("Distance reading B="); Serial.print(distance);Serial.println();
//Invert distance and offset
waterlevelA=constrain(waterlevelA_calib_offset+waterlevelA_calib_factor*_filteredDistance,0,1000);
watervolumeA=waterlevelA_heightToVolume(waterlevelA);
//float _meanWaterlevel=getMeanf(waterlevelMean,WATERLEVELMEAN_SIZE);
//Serial.print("\t Dist="); Serial.print(_filteredWaterlevel); Serial.print("mm"); Serial.print("(+- "); Serial.print((getMaxf(waterlevelMean,WATERLEVELMEAN_SIZE)-getMinf(waterlevelMean,WATERLEVELMEAN_SIZE))/2.0); Serial.print(")"); Serial.print(" [mean="); Serial.print(_meanWaterlevel); Serial.print("]");
}else{
waterlevelA=WATERLEVEL_UNAVAILABLE;
if (distance!=WATERLEVEL_UNAVAILABLE && distance!=65535) { //successful
waterlevelMean_array[waterlevelMean_array_pos]=distance;
waterlevelMean_array_pos++;
waterlevelMean_array_pos%=WATERLEVELMEAN_SIZE;
distance_unsuccessful_count=0;
}else{
distance_unsuccessful_count++;
if (distance_unsuccessful_count%20==0) {
String _text="Distance unsuccessful count=";
_text.concat(distance_unsuccessful_count);
_text.concat(" distance=");
_text.concat(distance);
publishInfo("error/waterlevel",_text);
}
}
waterlevel_loop_select++;
break;
case 1:
// ############ B
static unsigned long last_read_waterlevelB;
if (loopmillis>=last_read_waterlevelB+READINTERVAL_WATERLEVEL) {
last_read_waterlevelB=loopmillis;
if (isValueArrayOKf(waterlevelMean_array,WATERLEVELMEAN_SIZE,WATERLEVEL_UNAVAILABLE)){
float _filteredDistance=getFilteredf(waterlevelMean_array,WATERLEVELMEAN_SIZE,WATERLEVELMEAN_FILTER_CUTOFF);
uint16_t distance=sensorB.readRangeSingleMillimeters(); //out of range =255
//Serial.print("Distance reading B="); Serial.print(distance);Serial.println();
//Invert distance and offset
waterlevel=constrain(waterlevel_calib_offset+waterlevel_calib_factor*_filteredDistance,0,1000);
watervolume=waterlevel_heightToVolume(waterlevel);
//Serial.print("Filtered reading B="); Serial.print(_filteredDistance); Serial.print(" fixed="); Serial.println(waterlevelB); Serial.println();
if (distance!=WATERLEVEL_UNAVAILABLE && distance!=65535) { //successful
waterlevelBMean_array[waterlevelBMean_array_pos]=distance;
waterlevelBMean_array_pos++;
waterlevelBMean_array_pos%=WATERLEVELMEAN_SIZE;
distanceB_unsuccessful_count=0;
}else{
distanceB_unsuccessful_count++;
if (distanceB_unsuccessful_count%20==0) {
String _text="Distance B unsuccessful count=";
_text.concat(distanceB_unsuccessful_count);
_text.concat(" distance=");
_text.concat(distance);
publishInfo("error/waterlevel",_text);
}
}
if (isValueArrayOKf(waterlevelBMean_array,WATERLEVELMEAN_SIZE,WATERLEVEL_UNAVAILABLE)){
float _filteredDistance=getFilteredf(waterlevelBMean_array,WATERLEVELMEAN_SIZE,WATERLEVELMEAN_FILTER_CUTOFF);
//Invert distance and offset
waterlevelB=constrain(waterlevelB_calib_offset+waterlevelB_calib_factor*_filteredDistance,0,1000);
watervolumeB=waterlevelB_heightToVolume(waterlevelB);
//Serial.print("Filtered reading B="); Serial.print(_filteredDistance); Serial.print(" fixed="); Serial.println(waterlevelB); Serial.println();
//float _meanWaterlevel=getMeanf(waterlevelMean,WATERLEVELMEAN_SIZE);
//Serial.print("\t Dist="); Serial.print(_filteredWaterlevel); Serial.print("mm"); Serial.print("(+- "); Serial.print((getMaxf(waterlevelMean,WATERLEVELMEAN_SIZE)-getMinf(waterlevelMean,WATERLEVELMEAN_SIZE))/2.0); Serial.print(")"); Serial.print(" [mean="); Serial.print(_meanWaterlevel); Serial.print("]");
}else{
waterlevelB=WATERLEVEL_UNAVAILABLE;
}
waterlevel_loop_select=0;
break;
//float _meanWaterlevel=getMeanf(waterlevelMean,WATERLEVELMEAN_SIZE);
//Serial.print("\t Dist="); Serial.print(_filteredWaterlevel); Serial.print("mm"); Serial.print("(+- "); Serial.print((getMaxf(waterlevelMean,WATERLEVELMEAN_SIZE)-getMinf(waterlevelMean,WATERLEVELMEAN_SIZE))/2.0); Serial.print(")"); Serial.print(" [mean="); Serial.print(_meanWaterlevel); Serial.print("]");
}else{
waterlevel=WATERLEVEL_UNAVAILABLE;
}
}
}
float waterlevelA_heightToVolume(float distance){
return waterlevelA_calib_reservoirArea/100 * distance/100; //area[cm^2] in dm^2 * height in dm = dm^3= L
float waterlevel_heightToVolume(float distance){
return waterlevel_calib_reservoirArea/100 * distance/100; //area[cm^2] in dm^2 * height in dm = dm^3= L
}
float waterlevelB_heightToVolume(float distance){
return waterlevelB_calib_reservoirArea/100 * distance/100; //area[cm^2] in dm^2 * height in dm = dm^3= L
}
#endif

View File

@ -1,99 +0,0 @@
#ifndef _WATERLEVEL_H_
#define _WATERLEVEL_H_
#include <HCSR04.h>
#define HCSR04_PIN_ECHO 17
#define HCSR04_PIN_TRIGGER 16
#define HCSR04_TIMEOUT 5000 //default is 100000 (uS)
#define READINTERVAL_HCSR04 200
#define WATERLEVELMEAN_SIZE 32
#define WATERLEVELMEAN_FILTER_CUTOFF 8 //max value is around WATERLEVELMEAN_SIZE/2
float waterlevelMean_array[WATERLEVELMEAN_SIZE];
uint16_t waterlevelMean_array_pos=0;
#define WATERLEVEL_UNAVAILABLE -1
float waterlevel=WATERLEVEL_UNAVAILABLE; //distance from floor to water surface [mm]
float watervolume=WATERLEVEL_UNAVAILABLE; //calculated Volume in Reservoir
uint16_t waterlevel_failcounter=0;
#define WATERLEVEL_MAXFAILS 15 //maximum counter value
#define WATERLEVEL_FAILTHRESHOLD 10 //if failcounter is greater or equal this value waterlevel will not be valid
//Calibration
float waterlevel_calib_offset_measured=0; //Sollwert
float waterlevel_calib_offset_sensor=178.67; //Istwert
float waterlevel_calib_reservoirArea=27*36.5; //area in cm^2
float waterlevel_heightToVolume(float distance);
void waterlevel_setup() {
//HCSR04.begin(HCSR04_PIN_TRIGGER, HCSR04_PIN_ECHO);
HCSR04.begin(HCSR04_PIN_TRIGGER, HCSR04_PIN_ECHO,HCSR04_TIMEOUT, HCSR04.eUltraSonicUnlock_t::unlockSkip);
for (uint16_t i=0;i<WATERLEVELMEAN_SIZE;i++) {
waterlevelMean_array[i]=-1; //-1 is also timeout value
}
}
void waterlevel_loop(unsigned long loopmillis) {
static unsigned long last_read_hcsr04;
if (loopmillis>=last_read_hcsr04+READINTERVAL_HCSR04) {
last_read_hcsr04=loopmillis;
float temperature=20.0;
if (tempCmean_air!=DEVICE_DISCONNECTED_C) { //sensor ok
temperature=tempCmean_air;
}
double* distances = HCSR04.measureDistanceMm(temperature);
double distance=distances[0];
//Serial.print("Distance reading:"); Serial.println(distance);
if (distance!=WATERLEVEL_UNAVAILABLE) { //successful
waterlevelMean_array[waterlevelMean_array_pos]=distance;
waterlevelMean_array_pos++;
waterlevelMean_array_pos%=WATERLEVELMEAN_SIZE;
if (waterlevel_failcounter>0) { //reduce failcounter if sucessfull
waterlevel_failcounter--;
}
}else{
if (waterlevel_failcounter<WATERLEVEL_MAXFAILS) {
waterlevel_failcounter++;
}
}
if (isValueArrayOKf(waterlevelMean_array,WATERLEVELMEAN_SIZE,WATERLEVEL_UNAVAILABLE)){
//float _distance=getFilteredf(waterlevelMean_array,WATERLEVELMEAN_SIZE,WATERLEVELMEAN_FILTER_CUTOFF);
float _distance=getMaxf(waterlevelMean_array,WATERLEVELMEAN_SIZE);
//Invert distance and offset
waterlevel=distance-(waterlevel_calib_offset_sensor+waterlevel_calib_offset_measured);
watervolume=waterlevel_heightToVolume(_distance);
//float _meanWaterlevel=getMeanf(waterlevelMean,WATERLEVELMEAN_SIZE);
//Serial.print("\t Dist="); Serial.print(_filteredWaterlevel); Serial.print("mm"); Serial.print("(+- "); Serial.print((getMaxf(waterlevelMean,WATERLEVELMEAN_SIZE)-getMinf(waterlevelMean,WATERLEVELMEAN_SIZE))/2.0); Serial.print(")"); Serial.print(" [mean="); Serial.print(_meanWaterlevel); Serial.print("]");
}
if (waterlevel_failcounter>=WATERLEVEL_FAILTHRESHOLD) { //too many failed readings
waterlevel=WATERLEVEL_UNAVAILABLE;
watervolume=WATERLEVEL_UNAVAILABLE;
/*if (debug) {
Serial.print("Waterlevel Failcounter="); Serial.println(waterlevel_failcounter);
}*/
}
}
}
float waterlevel_heightToVolume(float distance){
return waterlevel_calib_reservoirArea/100 * distance/100; //area[cm^2] in dm^2 * height in dm = dm^3= L
}
#endif

View File

@ -3,4 +3,4 @@ const char ssid[] = "fischnetziot";
const char pass[] = "LiMkJ1sVcEAU68MPEgJ";
const char mqtt_host[] = "10.0.0.1";
const char client_id[] = "hydroponic";
const char client_id[] = CLIENT_ID;

View File

@ -15,21 +15,31 @@ data = read_csv("20240423_EC_Calibration.csv")
# converting column data to list
solutionAdded = data['solutionAdded'].tolist() #in ml
tempReservoir = data['tempReservoir'].tolist() #in C
adc = data['ECadcAdjusted_B'].tolist() #adc reading
adc = data['ECadcAdjusted_A'].tolist() #adc reading
#solutionConcentration=5924.8 #mg/L NaCl
solutionConcentration=5690 #mg/L NaCl
#solutionEC=5924.8 #mg/L NaCl
solutionEC=5690 #mg/L NaCl
startWaterAmount=300 #mL (same unit as solutionAded)
ppmToECfactor=1/0.46
## EC Calutation
'''
concentration = [x*solutionConcentration/(startWaterAmount+x) for x in solutionAdded]
ECcalculated = [x*ppmToECfactor for x in concentration] #uS/cm
'''
### OR
## EC of solution given
ECcalculated = [x*solutionEC/(startWaterAmount+x) for x in solutionAdded] #uS/cm
#ECmeasured = data['ecMeasured'].tolist() #in C
print("Concentration")
print(concentration)
#print("Concentration")
#print(concentration)
print("")
print("ECcalculated")
print(ECcalculated)

View File

@ -8,16 +8,72 @@
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:esp32doit-devkit-v1]
[env:esp32doit-devkit-v1_NFT]
platform = espressif32
board = esp32doit-devkit-v1
framework = arduino
monitor_speed = 115200
monitor_port = /dev/ttyUSB0
build_flags=
'-D CLIENT_ID="hydroponic-NFT"'
-D PIN_BUTTON=12
-D PIN_LED=13
-D EC_PIN_RELAY_PROBE=27
-D EC_PIN_FREQ=5
-D EC_CALIBRATION_POLYNOM={18.785904241636743,-0.04069178351449846,3.528797358514823e-05,-4.214254847500995e-09,2.543662736303669e-13}
-D EC_CALIBRATION_LINEARIZE_BELOW_ADC=2000
-D EC_CALIBRATION_LINEAR_LOWADC=728
-D EC_CALIBRATION_LINEAR_LOWEC=0
-D FLOW_PIN=16
-D ONE_WIRE_BUS_PIN=18
-D THERMOMETER_ADDR_RESERVOIR={0x28,0xFF,0x6F,0x19,0x72,0x16,0x05,0x44}
-D THERMOMETER_ADDR_CASE={0x10,0x7E,0x22,0x99,0x01,0x08,0x00,0xA4}
-D PIN_SDA=21
-D PIN_SCL=22
lib_deps =
https://github.com/milesburton/Arduino-Temperature-Control-Library/
https://github.com/emilv/ArduinoSort/
robtillaart/ADS1X15@^0.3.9
256dpi/MQTT@^2.5.1
pololu/VL53L0X@^1.3.1
[env:esp32-s3-devkitm-1_DB]
platform = platformio/espressif32@^6.7
board = esp32-s3-devkitm-1
framework = arduino
monitor_speed = 115200
build_flags=
'-D CLIENT_ID="hydroponic-DB"'
-D PIN_BUTTON
-D EC_PIN_RELAY_PROBE
-D EC_PIN_FREQ
-D EC_CALIBRATION_POLYNOM={8.718380956513695,-0.026463423062356713,3.425216464107108e-05,-4.069826379094172e-09,2.478900495960682e-13}
-D EC_CALIBRATION_LINEARIZE_BELOW_ADC=2000
-D EC_CALIBRATION_LINEAR_LOWADC=728
-D EC_CALIBRATION_LINEAR_LOWEC=0
-D FLOW_PIN
-D ONE_WIRE_BUS_PIN
-D THERMOMETER_ADDR_RESERVOIR={0x28,0xFF,0x30,0xBA,0x85,0x16,0x03,0xB5}
-D THERMOMETER_ADDR_CASE
-D PIN_SDA
-D PIN_SCL
lib_deps =
https://github.com/milesburton/Arduino-Temperature-Control-Library/
https://github.com/emilv/ArduinoSort/
robtillaart/ADS1X15@^0.3.9
256dpi/MQTT@^2.5.2
pololu/VL53L0X@^1.3.1

View File

@ -51,9 +51,6 @@ ADS1115 ADS(0x48);
#define PIN_BUTTON 12
#define PIN_LED 13
void setup() {
pinMode(PIN_BUTTON,INPUT_PULLUP);
@ -69,7 +66,7 @@ void setup() {
Serial.println("Setup Waterlevel");
waterlevel_setup();
//waterlevel_setup(); //Temporarily disabled
//init ADS1115
@ -101,12 +98,12 @@ void setup() {
//Test adc to ec function output
if (eccalibrationoutput) {
Serial.println();
Serial.print("adc"); Serial.print(","); Serial.print("ecA"); Serial.print(","); Serial.print("ecB"); Serial.println();
Serial.print("adc"); Serial.print(","); Serial.print("ec"); Serial.println();
for (int i=728;i<14000;i+=100) {
//float _ec=ec_getECfromADC(i);
float _ecA=ec_getECfromADC(i, ec_calibration_polynom_A, sizeof(ec_calibration_polynom_A), ec_calibration_linearize_below_adc_A, ec_calibration_linear_lowADC_A, ec_calibration_linear_lowEC_A);
float _ecB=ec_getECfromADC(i, ec_calibration_polynom_B, sizeof(ec_calibration_polynom_B), ec_calibration_linearize_below_adc_B, ec_calibration_linear_lowADC_B, ec_calibration_linear_lowEC_B);
Serial.print(i); Serial.print(","); Serial.print(_ecA); Serial.print(","); Serial.print(_ecB); Serial.println();
float _ec=ec_getECfromADC(i, ec_calibration_polynom, sizeof(ec_calibration_polynom), ec_calibration_linearize_below_adc, ec_calibration_linear_lowADC, ec_calibration_linear_lowEC);
Serial.print(i); Serial.print(","); Serial.print(_ec); Serial.println();
}
delay(100000);
}
@ -130,7 +127,7 @@ void loop() {
temperature_loop(loopmillis);
if (!ec_measurementRunning()){ //skip tof read when ec measurement running, because vlxx sensor reading takes quite long per cycle
waterlevel_loop(loopmillis);
//Temporarily disabled waterlevel_loop(loopmillis);
}
flow_loop(loopmillis);
@ -185,13 +182,10 @@ void loop() {
getReading=false;
digitalWrite(PIN_LED,LOW);
Serial.print(loopmillis); Serial.print(",");
Serial.print(tempCmean_reservoir_a); Serial.print(",");
Serial.print(tempCmean_reservoir_b); Serial.print(",");
Serial.print(tempCmean_reservoir); Serial.print(",");
Serial.print(ec_calib_adc); Serial.print(",");
Serial.print(ec_adc_A); Serial.print(",");
Serial.print(ec_adc_adjusted_A); Serial.print(",");
Serial.print(ec_adc_B); Serial.print(",");
Serial.print(ec_adc_adjusted_B);
Serial.print(ec_adc); Serial.print(",");
Serial.print(ec_adc_adjusted); Serial.print(",");
Serial.println();
}
@ -202,15 +196,11 @@ void loop() {
bool _noErrorsDuringLoop=true;
if (tempCmean_reservoir_a==DEVICE_DISCONNECTED_C || tempCmean_reservoir_b==DEVICE_DISCONNECTED_C || tempCmean_case==DEVICE_DISCONNECTED_C) {
if (tempCmean_reservoir==DEVICE_DISCONNECTED_C || tempCmean_case==DEVICE_DISCONNECTED_C) {
if (!valueError && valuesStabilized) { //error just appeared
if (tempCmean_reservoir_a==DEVICE_DISCONNECTED_C) {
Serial.println("valueError tempCmean_reservoir_a");
publishInfo("error/temperature","valueError tempCmean_reservoir_a");
}
if (tempCmean_reservoir_b==DEVICE_DISCONNECTED_C) {
Serial.println("valueError tempCmean_reservoir_b");
publishInfo("error/temperature","valueError tempCmean_reservoir_b");
if (tempCmean_reservoir==DEVICE_DISCONNECTED_C) {
Serial.println("valueError tempCmean_reservoir");
publishInfo("error/temperature","valueError tempCmean_reservoir");
}
if (tempCmean_case==DEVICE_DISCONNECTED_C) {
Serial.println("valueError tempCmean_case");
@ -227,15 +217,11 @@ void loop() {
if (sm_mean1==SM_DISCONNECTED || sm_mean2==SM_DISCONNECTED) {
valueError=true;
}*/
if (ec_A==EC_UNAVAILABLE || ec_B==EC_UNAVAILABLE){
if (ec==EC_UNAVAILABLE){
if (!valueError && valuesStabilized) { //error just appeared
if (ec_A==EC_UNAVAILABLE){
Serial.println("valueError ecA");
publishInfo("error/ec","valueError ecA");
}
if (ec_B==EC_UNAVAILABLE){
Serial.println("valueError ecB");
publishInfo("error/ec","valueError ecB");
if (ec==EC_UNAVAILABLE){
Serial.println("valueError ec");
publishInfo("error/ec","valueError ec");
}
}
valueError=true;
@ -244,18 +230,10 @@ void loop() {
if (distanceA_unsuccessful_count>20) {
if (distance_unsuccessful_count>20) {
if (!valueError && valuesStabilized) { //error just appeared
Serial.println("valueError distanceA");
publishInfo("error/waterlevel","valueError distanceA");
}
valueError=true;
_noErrorsDuringLoop=false;
}
if (distanceB_unsuccessful_count>20) {
if (!valueError && valuesStabilized) { //error just appeared
Serial.println("valueError distanceB");
publishInfo("error/waterlevel","valueError distanceB");
Serial.println("valueError distance");
publishInfo("error/waterlevel","valueError distance");
}
valueError=true;
_noErrorsDuringLoop=false;
@ -273,8 +251,8 @@ void loop() {
Serial.println("_______________________");
Serial.print(millis()/1000.0,2); Serial.println(":");
Serial.print("temperature reservoir_a,reservoir_b = ");
Serial.print(tempCmean_reservoir_a); Serial.print(","); Serial.print(tempCmean_reservoir_b);
Serial.print("temperature reservoir = ");
Serial.print(tempCmean_reservoir);
Serial.println();
@ -306,37 +284,24 @@ void loop() {
//Serial.print(getMax(sm_mean3array,SM_SIZE)); Serial.println();
*/
Serial.print("Flow a= "); Serial.print(flow_a);
Serial.print(", b= "); Serial.print(flow_b);
Serial.print("Flow = "); Serial.print(flow);
Serial.println();
Serial.print("EC ec_calib_adc,ec_adc_A,ec_adc_adjusted_A = ");
Serial.print("EC ec_calib_adc,ec_adc,ec_adc_adjusted = ");
Serial.print(ec_calib_adc); Serial.print(",");
Serial.print(ec_adc_A); Serial.print(",");
Serial.print(ec_adc_adjusted_A);
Serial.print(ec_adc); Serial.print(",");
Serial.print(ec_adc_adjusted);
Serial.println();
Serial.print("EC ec_A,ec25_A = ");
Serial.print(ec_A); Serial.print(",");
Serial.print(ec25_A);
Serial.print("EC ec,ec25 = ");
Serial.print(ec); Serial.print(",");
Serial.print(ec25);
Serial.println();
Serial.print("EC ec_calib_adc,ec_adc_B,ec_adc_adjusted_B = ");
Serial.print(ec_calib_adc); Serial.print(",");
Serial.print(ec_adc_B); Serial.print(",");
Serial.print(ec_adc_adjusted_B);
Serial.println();
Serial.print("EC ec_B,ec25_B = ");
Serial.print(ec_B); Serial.print(",");
Serial.print(ec25_B);
Serial.println();
Serial.print("A Waterlevel,Volume = ");
Serial.print(waterlevelA); Serial.print(",");
Serial.print(watervolumeA); Serial.println();
Serial.print("B Waterlevel,Volume = ");
Serial.print(waterlevelB); Serial.print(",");
Serial.print(watervolumeB);
Serial.print("Waterlevel,Volume = ");
Serial.print(waterlevel); Serial.print(",");
Serial.print(watervolume); Serial.println();
Serial.println();
@ -351,11 +316,8 @@ void loop() {
enableTiming=false;
}
if (tempCmean_reservoir_a!=DEVICE_DISCONNECTED_C) {
publishValueTimed("nft/temperature/reservoir",tempCmean_reservoir_a,2,timing_temperature_reservoir_a,loopmillis);
}
if (tempCmean_reservoir_b!=DEVICE_DISCONNECTED_C) {
publishValueTimed("db/temperature/reservoir",tempCmean_reservoir_b,2,timing_temperature_reservoir_b,loopmillis);
if (tempCmean_reservoir!=DEVICE_DISCONNECTED_C) {
publishValueTimed("temperature/reservoir",tempCmean_reservoir,2,timing_temperature_reservoir,loopmillis);
}
if (tempCmean_case!=DEVICE_DISCONNECTED_C) {
publishValueTimed("case/temperature",tempCmean_case,2,timing_temperature_case,loopmillis);
@ -374,42 +336,25 @@ void loop() {
static float last_flow_a=0;
static float last_flow=0;
if (valuesStabilized){
if (flow_a==0.0 && last_flow_a!=flow_a) {
publishValueTimedOverride("nft/flow",flow_a,2,timing_flow_a,loopmillis); //publish without waiting if flow is 0
if (flow==0.0 && last_flow!=flow) {
publishValueTimedOverride("flow",flow,2,timing_flow,loopmillis); //publish without waiting if flow is 0
}else{
publishValueTimed("nft/flow",flow_a,2,timing_flow_a,loopmillis);
publishValueTimed("flow",flow,2,timing_flow,loopmillis);
}
last_flow_a=flow_a;
}
static float last_flow_b=0;
if (valuesStabilized){
if (flow_b==0.0 && last_flow_b!=flow_b) {
publishValueTimedOverride("db/flow",flow_b,2,timing_flow_b,loopmillis); //publish without waiting if flow is 0
}else{
publishValueTimed("db/flow",flow_b,2,timing_flow_b,loopmillis);
}
last_flow_b=flow_b;
last_flow=flow;
}
if (waterlevelA!=WATERLEVEL_UNAVAILABLE) {
bool _published=publishValueTimed("nft/waterlevel/height",waterlevelA,2,timing_waterlevelA,loopmillis);
if (waterlevel!=WATERLEVEL_UNAVAILABLE) {
bool _published=publishValueTimed("waterlevel/height",waterlevel,2,timing_waterlevel,loopmillis);
if (_published) { //use height for timing. send calculated volume with it
publishValue("nft/waterlevel/volume",watervolumeA,2);
publishValue("waterlevel/volume",watervolume,2);
}
}
if (waterlevelB!=WATERLEVEL_UNAVAILABLE) {
bool _published=publishValueTimed("db/waterlevel/height",waterlevelB,2,timing_waterlevelB,loopmillis);
if (_published) { //use height for timing. send calculated volume with it
publishValue("db/waterlevel/volume",watervolumeB,2);
}
}
if (ec_flag_measurement_available){
ec_flag_measurement_available=false;
@ -419,30 +364,18 @@ void loop() {
}
//Probe A
if (ec_adc_A!=0) {
publishValue("db/ec/adc",ec_adc_A,0);
if (ec_adc!=0) {
publishValue("ec/adc",ec_adc,0);
}
if (ec_adc_adjusted_A!=0) {
publishValue("db/ec/adcadjusted",ec_adc_adjusted_A,0);
if (ec_adc_adjusted!=0) {
publishValue("ec/adcadjusted",ec_adc_adjusted,0);
}
if (ec_A!=EC_UNAVAILABLE){
publishValue("db/ec/ec",ec_A,0);
publishValue("db/ec/sc",ec25_A,0);
if (ec!=EC_UNAVAILABLE){
publishValue("ec/ec",ec,0);
publishValue("ec/sc",ec25,0);
}
//Probe B
if (ec_adc_B!=0) {
publishValue("nft/ec/adc",ec_adc_B,0);
}
if (ec_adc_adjusted_B!=0) {
publishValue("nft/ec/adcadjusted",ec_adc_adjusted_B,0);
}
if (ec_B!=EC_UNAVAILABLE){
publishValue("nft/ec/ec",ec_B,0);
publishValue("nft/ec/sc",ec25_B,0);
}
}