{"id":22807950,"url":"https://github.com/pawcijo/pigarden","last_synced_at":"2026-04-30T10:38:13.308Z","repository":{"id":265151283,"uuid":"895285105","full_name":"pawcijo/PiGarden","owner":"pawcijo","description":"Example IoT sensor reading script integrated with a full-stack web server to visualize the data.","archived":false,"fork":false,"pushed_at":"2025-03-03T05:12:53.000Z","size":8454,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T20:51:58.870Z","etag":null,"topics":["http","http-server","iot","python","raspberry-pi"],"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/pawcijo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-27T23:10:59.000Z","updated_at":"2025-03-03T05:12:57.000Z","dependencies_parsed_at":"2024-11-28T00:25:50.236Z","dependency_job_id":"959119ab-c304-4b1e-a289-568a8123398f","html_url":"https://github.com/pawcijo/PiGarden","commit_stats":null,"previous_names":["pawcijo/pigarden"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pawcijo%2FPiGarden","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pawcijo%2FPiGarden/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pawcijo%2FPiGarden/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pawcijo%2FPiGarden/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pawcijo","download_url":"https://codeload.github.com/pawcijo/PiGarden/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246379385,"owners_count":20767696,"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":["http","http-server","iot","python","raspberry-pi"],"created_at":"2024-12-12T11:07:19.167Z","updated_at":"2026-04-30T10:38:13.268Z","avatar_url":"https://github.com/pawcijo.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PiGarden\n\nPiGarden is a simple web-based application that allows you to monitor environmental data from various sensors, including temperature, humidity, and soil moisture, using a Raspberry Pi. The application stores the sensor readings in an SQLite database and provides real-time data visualization through interactive charts.\n\n## Features\n- Real-time sensor data monitoring: Collects temperature, humidity, soil moisture, CPU temperature, and ambient light data.\n- Modular services:\n\n    - Light control: Manages garden lighting based on predefined schedules.\n    - Irrigation system: Controls the water pump using GPIO relays.\n    - Sensor service: Collects sensor data and updates the database.\n    - Web service: Provides a dashboard for real-time monitoring and historical data visualization.\n\n- Flexible operation: Run each service individually or simultaneously - using a control script.\n- SQLite database: Stores the collected data with timestamps.\n- Dark mode: User-friendly toggle to switch between light and dark themes.\n\n#  Components\n- Raspberry Pi: The main platform that reads sensor data via I2C.\n- SHT31-D Sensor: Measures temperature and humidity.\n- SEN0193 Soil Moisture Sensor: An analog sensor that measures the moisture level of the soil.\n- ADS7830 ADC Converter: Converts the analog signal from the SEN0193 sensor into a digital value readable via I2C (address 0x48).\n- VEML7700 Sensor: Measures lux (light intensity) for plant growth monitoring.\n- 230V Lamp: Used to simulate garden lighting. The lamp is controlled by a GPIO relay module.\n- Water Pump: Used for irrigation, controlled by GPIO relays. It can be a 12V DC water pump and should have a flow rate of at least 240 liters per hou\n- Flask: A lightweight Python web framework used to display the data in a web browser.\n- Chart.js: A JavaScript library used to create interactive line charts for visualizing the data.\n\n## Installation\n\n1. Set up your Raspberry Pi\nEnsure your Raspberry Pi is running Raspberry Pi OS and has I2C enabled. You can enable I2C through the Raspberry Pi configuration tool:\nsudo raspi-config\nUnder \"Interfacing Options\", select \"I2C\" and enable it.\n\n2. Install Dependencies\nClone the repository to your Raspberry Pi:\n```\ngit clone https://github.com/pawcijo/PiGarden.git\ncd PiGarden\n```\n\nInstall the required Python packages:\n```\npip install -r requirements.txt\n```\n\n3. Set up the Database\nRun the script to initialize the SQLite database and create the table that will store sensor data.\n```\npython init_db.py\n```\nThis will create a sensor_data.db file with the necessary structure.\n\n4. Connect Sensors\nConnect the SHT31-D sensor and SEN0193 soil moisture sensor to your Raspberry Pi.\n\n##### SHT31-D Sensor:\n\n    I2C address: 0x44\n    Ensure the wiring is correct:\n    \n        SDA to GPIO 2 (pin 3)\n        SCL to GPIO 3 (pin 5)\n        VCC to 3.3V\n        GND to GND\n    \nSEN0193 Soil Moisture Sensor with ADS7830:\n\nThe SEN0193 sensor outputs an analog voltage proportional to the soil moisture level.\n\nUse the ADS7830 ADC to convert the analog signal into a digital value for the Raspberry Pi.\n\nADS7830 wiring:\n ```\n- VCC to 3.3V or 5V.\n- GND to GND.\n- SDA to GPIO 2 (pin 3).\n- SCL to GPIO 3 (pin 5).\n```\n\nSEN0193 wiring:\n```\n- VCC to 3.3V.\n- GND to GND.\n- Signal (analog output) to one of the ADC input channels on the ADS7830 (e.g., CH0)\n```\nEnsure the wiring is correct:\n```\n- SDA to GPIO 2 (pins 3 or line)\n- SCL to GPIO 3 (pins 5 or line)\n- VCC to 3.3V\n- GND to GND\n```\n\n###### Soil Moisture Sensor Calibration\n\n⚠️⚠️⚠️ Soil sensor should be calibrated, more instructions in [Sensor Calibration](https://github.com/pawcijo/PiGarden/tree/main/helper_script/soil_sensor_calibration.md)\n\n5. Start the System \nYou can start all the services together using the provided start_server.sh script: \n```\n./start_server.sh\n```\n\nTo stop all services, use: \n```\n./stop_server.sh\n```\nAlternatively, you can run each service individually:\n\n\nSensor Service:\n``` \npython3 SensorServer/data_update.py\n```\nLight Control: \n```\nsudo python3 SensorServer/light_control.py\n```\nIrrigation System:\n``` \nsudo python3 SensorServer/irrigation_system.py\n```\nWeb Service: \n```\n    sudo python3 SensorServer/web_server.py\n```\n 6. Access the Web Dashboard \n \n Once the web service is running, open a web browser and navigate to your Raspberry Pi’s IP address on port 5000: \n ```\n http://\u003cyour-pi-ip\u003e:5000\n ``` \n You will see real-time temperature, humidity, soil moisture, and lux readings, as well as graphs showing historical data.\n \n\n# Usage\n\n## Data Collection\nReal-Time Data Monitoring: The app collects data from sensors and monitors:\n\n    Temperature\n    Humidity\n    Soil moisture\n    Ambient light (lux)\n    Irrigation system status\n    CPU temperature\n\n## Light Control \n\nThe lights are automatically controlled based on predefined time settings. The light control is handled by a separate process that ensures the lights are turned off when the control script ends. If the control process is killed (e.g., via pkill), the lights will be turned off automatically.\n\n## Data Visualization\nThe web interface presents the following charts:\n- Temperature Chart: Displays readings from the SHT31-D sensor and CPU temperature.\n- Humidity Chart: Displays humidity levels.\n- Soil Moisture Chart: Displays soil moisture levels.\n- Light Level Chart: Displays ambient light (lux).\n\nThe charts are updated in every hour as new data is collected.\n\n## Dark Mode\nThe app includes a dark mode toggle, which can be activated by clicking the button in the top-right corner.\n\n## Database Schema\nThe SQLite database `sensor_data.db` contains a table called `sensor_readings` with the following columns:\n- id: Auto-incremented primary key.\n- timestamp: Date and time of the sensor reading.\n- temperature: Temperature value from the SHT31-D sensor.\n- humidity: Humidity value from the SHT31-D sensor.\n- soil_moisture: Soil moisture level in percentage.\n- cpu_temperature: CPU temperature of the Raspberry Pi.\n- lux: Ambient light intensity measured by the VEML7700 sensor, stored as a real number.\n\n\n## Troubleshooting\n- I2C Communication Error: Make sure I2C is enabled on your Raspberry Pi and that your sensors are correctly connected.\n- Web Interface Not Loading: Ensure Flask is running and accessible from your browser. Check for any errors in the terminal where Flask is running.\n\n## License\nThis project is open source and available under the MIT License. See the LICENSE file for more details.\n\n## Contributing\nFeel free to fork the repository and submit pull requests. Contributions are always welcome!\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpawcijo%2Fpigarden","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpawcijo%2Fpigarden","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpawcijo%2Fpigarden/lists"}