{"id":16360041,"url":"https://github.com/chrisb2/water-system","last_synced_at":"2025-03-23T01:32:26.506Z","repository":{"id":82040866,"uuid":"114441009","full_name":"chrisb2/water-system","owner":"chrisb2","description":"This project uses weather API's to determine if significant rain has fallen in the last day, or is forecast today, and if so disables the garden watering system to conserve water.","archived":false,"fork":false,"pushed_at":"2023-12-02T00:36:06.000Z","size":424,"stargazers_count":17,"open_issues_count":0,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-12T02:10:30.969Z","etag":null,"topics":["esp32","micropython","thingspeak"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chrisb2.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-12-16T07:00:40.000Z","updated_at":"2023-10-19T01:02:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"ef680923-7dc1-4d95-acdd-3a02f50aa643","html_url":"https://github.com/chrisb2/water-system","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisb2%2Fwater-system","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisb2%2Fwater-system/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisb2%2Fwater-system/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chrisb2%2Fwater-system/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chrisb2","download_url":"https://codeload.github.com/chrisb2/water-system/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221842109,"owners_count":16890109,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["esp32","micropython","thingspeak"],"created_at":"2024-10-11T02:10:21.522Z","updated_at":"2024-10-28T14:44:05.724Z","avatar_url":"https://github.com/chrisb2.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Garden Watering System Controller\n\nThis [MicroPython](http://micropython.org/) project on an [ESP32-C3](https://en.wikipedia.org/wiki/ESP32) ([SeeedStudio Xiao](https://www.seeedstudio.com/Seeed-XIAO-ESP32C3-p-5431.html)) uses weather API's to determine if significant rain has fallen in the last day, or is forecast today, and if so disables the garden watering system to conserve water. It reports the rainfall and system status to [ThingSpeak](https://thingspeak.com).\n\nThe project is run off a single 3.3V 1600mAh LiFePO4 battery (18650) and uses the\ndeep sleep mode of the ESP32-C3 to extend the battery life.\n\nThis controller is suitable for use with automatic watering systems which expose\nthe ability to disable the system by making a connection open circuit.\n\n## MicroPython\n\nThe current release of firmware for the ESP32-C3; v1.9.1, does not support deep sleep.\nI built my own firmware using v4.4.3 of the ESP-IDF and the v1.9.1 tag of the Micropython\nwith patch [esp32c3_wakeup_ext.patch](esp32c3_wakeup_ext.patch) (from [modmachine: Implemented GPIO wake-up for ESP32-C3](https://github.com/micropython/micropython/pull/9583)) applied.\n\n## Schematic\n\nIf the schematic appears to be missing details, download it and view it locally,\nor zoom the web page.\n\n![Circuit Schematic](./schematic-garden-watering-controller.svg)\n\n## Container\n\nI used a polycarbonate box with a build-in O-ring seal. A\n[PTFE breathable vent](https://www.aliexpress.com/store/1823522)\nwas fitted to allow air, but not water vapor in and out. The electrical\nconnections exiting the container to the watering system must be completely\nsealed.\n\n## Weather API's\n\nAll weather API calls and rain calculations are in _weather.py_, you will need\nto update the services called and the code used to extract data from the\nresponses.\n\n## Usage\n\nConfigure a ThingSpeak channel something like:\n\n![ThingSpeak channel](https://github.com/chrisb2/water-system/raw/master/thingspeak-settings.png \"ThingSpeak Channel Settings\")\n\nDownload the library:\n* [urtc](https://raw.githubusercontent.com/chrisb2/Adafruit-uRTC/master/urtc.py) real time clock (RTC) library.\n\nCreate a file called _secrets.py_ and fill in appropriate values:\n```python\n\"\"\"Secret values required to connect to services.\"\"\"\nWIFI_SSID = 'XXXXXX'\nWIFI_PASSPHRASE = 'XXXXXX'\nTHINGSPEAK_API_KEY = 'XXXXXX'\n\nHEADER = {'User-Agent': 'XXXX'}\nLOCATION = 'lat=-XX.XXX\u0026lon=YYY.YYY'\n```\nBy default the RTC will wake the ESP32-C3 from deep sleep at 5am GMT every day, if\nyou want a different time edit the value of the _RTC_ALARM_ constant in\n_config.py_.\n\nCopy all the python files to the ESP32-C3.\n\nSet the 'No Sleep' DIP switch to 'on', press the RST button to reset the ESP32-C3,\nthen connect using Putty or similar serial client and initialize the RTC by executing the following:\n```python\nimport wifi\nimport clock\n\nwifi.connect()\nclock.initialize_rtc_from_ntp()\n\n# Get date time, to verify setting.\nclock.timestamp()\n```\nSet the 'No Sleep' DIP switch to 'off', press the RST button to reset the ESP32-C3 and connect to your water system.\n\n## Retrieve System Log\nConnect using Putty or similar serial client:\n```\nimport water_system as w\nw.init_ftp()\n```\nThen retrieve the log file using the ip address from above:\n```\ncurl -v -O \"ftp://\u003cip address\u003e/system.log\"\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisb2%2Fwater-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchrisb2%2Fwater-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchrisb2%2Fwater-system/lists"}