An original concept plan and framework designed by Pat Ryan Things LLCfor a plant shop soil-monitoring mesh for tracking watering schedules based on real-time sensor data.
Enterprise-Grade Soil Monitoring System for Plant Shops & Greenhouses
A comprehensive, real-time soil monitoring solution supporting up to 100+ Zigbee sensors with advanced analytics, automated alerts, and modern web dashboard.
๐ Quick Start โข ๐ Documentation โข ๐ง API Reference โข ๐ค Contributing
|
|
graph TB
subgraph "Sensor Network"
S1[๐ก๏ธ Soil Sensor 1]
S2[๐ก๏ธ Soil Sensor 2]
S3[๐ก๏ธ Soil Sensor N...]
end
subgraph "Communication Layer"
ZB[๐ก Zigbee Coordinator]
end
subgraph "Data Processing"
SM[๐ Sensor Manager]
DP[๐ Data Processor]
DB[(๐๏ธ Data Storage)]
end
subgraph "User Interface"
WD[๐ Web Dashboard]
API[โก REST API]
MA[๐ฑ Mobile App]
end
S1 & S2 & S3 -.->|Zigbee| ZB
ZB -->|Serial/USB| SM
SM --> DP
DP --> DB
DP --> WD
DP --> API
API --> MA
style S1 fill:#4CAF50
style S2 fill:#4CAF50
style S3 fill:#4CAF50
style ZB fill:#2196F3
style WD fill:#FF9800
style API fill:#9C27B0
| Requirement | Version | Purpose |
|---|---|---|
| Python | 3.8+ | Core runtime environment |
| pip | Latest | Package management |
| Zigbee Coordinator | XBee/CC2531 | Sensor communication (optional for demo) |
| Web Browser | Modern | Dashboard access |
-
๐ฅ Clone & Navigate
git clone https://github.com/secretengineer/AutoWater-Plant-Shop-Soil-Monitor.git cd AutoWater-Plant-Shop-Soil-Monitor -
๐ Virtual Environment
# Windows python -m venv .venv .venv\Scripts\activate # macOS/Linux python3 -m venv .venv source .venv/bin/activate
-
๐ฆ Install Dependencies
pip install -r requirements.txt
-
โ๏ธ Configuration Setup
# Copy configuration template cp config/secrets.yaml.template config/secrets.yaml # Edit with your preferences (optional for demo mode) # nano config/config.yaml # nano config/secrets.yaml
-
๐ฆ Launch Application
python run.py
-
๐ Access Dashboard Open your browser to: http://127.0.0.1:5000/dashboard
๐ Success! You should see the live dashboard with mock sensor data.
AutoWater-Plant-Shop-Soil-Monitor/
โโโ ๐ src/ # Core application code
โ โโโ ๐ __init__.py # Package initialization
โ โโโ ๐ฏ main.py # Application orchestrator
โ โโโ ๐ก sensors.py # Sensor management & data collection
โ โโโ ๐ data_processing.py # Analytics & processing engine
โ โโโ ๐ dashboard.py # Flask web application
โ โโโ ๐ป zigbee_communication.py # Zigbee network interface
โ โโโ โ๏ธ config.py # Configuration management
โ โโโ ๐ logging_config.py # Centralized logging
โโโ ๐ tests/ # Comprehensive test suite
โ โโโ ๐งช test_base.py # Testing utilities
โ โโโ ๐งช test_*.py # Feature-specific tests
โโโ ๐ config/ # Configuration files
โ โโโ โ๏ธ config.yaml # Main configuration
โ โโโ ๐ secrets.yaml.template # Secrets template
โโโ ๐ static/ # Web assets (CSS, JS, images)
โโโ ๐ templates/ # HTML templates
โโโ ๐ requirements.txt # Python dependencies
โโโ ๐ run.py # Application entry point
# Sensor Configuration
sensor:
type: "Zigbee" # Sensor communication type
update_interval: 60 # Data collection interval (seconds)
# Sensor Deployment Map
sensors:
ids:
- "greenhouse_1_sensor_1" # Customize with your sensor IDs
- "greenhouse_1_sensor_2"
- "outdoor_sensor_1"
- "nursery_sensor_1"
# Zigbee Network Settings
zigbee:
enabled: true # Enable Zigbee communication
port: "COM3" # Windows: COM3, Linux: /dev/ttyUSB0
baud_rate: 9600 # Communication speed
timeout: 5 # Connection timeout
# Web Dashboard
dashboard:
host: "127.0.0.1" # Server bind address
port: 5000 # Server port
debug: false # Production: false, Development: true
# Alert Thresholds
processing:
alerts:
low_moisture: 20.0 # Critical: Below 20%
high_moisture: 80.0 # Warning: Above 80%
temperature_min: 5.0 # Alert: Below 5ยฐC
temperature_max: 40.0 # Alert: Above 40ยฐC
# System Settings
logging:
level: "INFO" # DEBUG, INFO, WARNING, ERROR, CRITICAL
file: "logs/autowater.log" # Log file location# Flask Security
flask:
secret_key: "your-secure-secret-key-here"
# External API Keys (if needed)
api_keys:
weather_service: "your-weather-api-key"
notification_service: "your-notification-api-key"
# Zigbee Security (if using encryption)
zigbee:
network_key: "your-zigbee-network-key"
link_key: "your-zigbee-link-key"| Method | Endpoint | Description | Response |
|---|---|---|---|
GET |
/api/sensors |
Current sensor readings | Sensor data with timestamps |
GET |
/api/analytics |
Processed analytics data | Statistics, alerts, trends |
GET |
/api/health |
System health status | Component status, sensor health |
GET |
/api/config |
Current configuration | Non-sensitive config data |
๐ GET /api/sensors
{
"sensors": [
{
"id": "greenhouse_1_sensor_1",
"moisture": 45.2,
"temperature": 23.5,
"timestamp": "2024-01-15T10:30:00.000Z"
},
{
"id": "greenhouse_1_sensor_2",
"moisture": 62.8,
"temperature": 24.1,
"timestamp": "2024-01-15T10:30:05.000Z"
}
],
"summary": {
"total_sensors": 10,
"active_sensors": 9,
"avg_moisture": 52.3,
"min_moisture": 28.1,
"max_moisture": 78.9,
"last_update": "2024-01-15T10:30:00.000Z"
},
"timestamp": "2024-01-15T10:30:10.000Z"
}๐ GET /api/analytics
{
"timestamp": "2024-01-15T10:30:00.000Z",
"statistics": {
"moisture": {
"average": 52.3,
"median": 51.0,
"min": 28.1,
"max": 78.9,
"std_dev": 12.4
},
"temperature": {
"average": 23.8,
"median": 24.0,
"min": 19.2,
"max": 28.1,
"std_dev": 2.1
}
},
"alerts": [
{
"type": "low_moisture",
"severity": "warning",
"sensor_id": "outdoor_sensor_1",
"message": "Low soil moisture detected: 15.2%",
"value": 15.2,
"threshold": 20.0,
"timestamp": "2024-01-15T10:25:00.000Z"
}
],
"recommendations": [
"Consider watering outdoor_sensor_1 - moisture critically low",
"Greenhouse sensors showing optimal moisture levels"
]
}| Component | Recommended Model | Purpose | Quantity |
|---|---|---|---|
| Soil Moisture Sensors | Capacitive (corrosion-resistant) | Primary sensing | 10-100+ |
| Temperature Sensors | DS18B20 (waterproof) | Environmental monitoring | 10-100+ |
| Zigbee Modules | XBee Pro S2C / CC2531 | Wireless communication | 1 per sensor + 1 coordinator |
| Coordinator | XBee USB Adapter / CC2531 stick | Network coordinator | 1 |
| Power Supply | 3.3V/5V regulated | Sensor power | As needed |
-
๐ Placement Strategy
- Position sensors 2-3 inches deep in soil
- Avoid direct contact with plant roots
- Ensure sensors are accessible for maintenance
-
๐ Power Management
- Use low-power sleep modes for battery sensors
- Implement solar charging for outdoor installations
- Monitor battery levels through the dashboard
-
๐ก Network Topology
- Place coordinator centrally for optimal coverage
- Use mesh routing for extended range
- Plan for signal obstacles (walls, metal structures)
# Run complete test suite
python -m pytest tests/ -v
# Run with coverage report
python -m pytest tests/ --cov=src --cov-report=html
# Run specific test categories
python -m pytest tests/test_sensors.py -v
python -m pytest tests/test_data_processing.py -v# Format code with Black
black src/ tests/
# Lint with flake8
flake8 src/ tests/
# Type checking (optional)
mypy src/View real-time logs:
tail -f logs/autowater_*.logCommon troubleshooting:
- No sensor data: Check Zigbee coordinator connection
- Dashboard not loading: Verify Flask port (5000) is available
- Import errors: Ensure virtual environment is activated
FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 5000
CMD ["python", "run.py"]Deploy with Docker:
docker build -t autowater-monitor .
docker run -d -p 5000:5000 -v $(pwd)/config:/app/config autowater-monitorserver {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://127.0.0.1:5000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
# Optional: Serve static files directly
location /static {
alias /path/to/app/static;
expires 30d;
}
}We welcome contributions! Here's how to get started:
- ๐ด Fork the repository
- ๐ฟ Create a feature branch (
git checkout -b feature/amazing-feature) - ๐ป Develop your changes with tests
- โ
Test your implementation (
python -m pytest) - ๐ Commit your changes (
git commit -m 'Add amazing feature') - ๐ค Push to your branch (
git push origin feature/amazing-feature) - ๐ Create a Pull Request
- Follow PEP 8 style guidelines
- Write comprehensive tests for new features
- Update documentation for API changes
- Use meaningful commit messages
This project is licensed under the MIT License - see the LICENSE file for details.
| Resource | Link | Description |
|---|---|---|
| ๐ Issues | GitHub Issues | Bug reports & feature requests |
| ๐ Documentation | Wiki | Detailed guides & tutorials |
| ๐ฌ Discussions | GitHub Discussions | Community support & ideas |
SecretEngineer - Lead Developer & System Architect
๐ง [email protected]
๐ GitHub Profile
We extend our heartfelt gratitude to the following contributors and communities:
- Flask Team - For the amazing web framework that powers our dashboard
- Chart.js Community - For beautiful, responsive data visualizations
- PyYAML Contributors - For robust configuration management capabilities
- Python Software Foundation - For the incredible Python ecosystem
- Stack Overflow Contributors - For countless solutions and debugging insights
- GitHub Community - For hosting, collaboration tools, and version control
- Python Package Index (PyPI) - For seamless dependency management
- Mozilla Developer Network - For comprehensive web development documentation
- pytest Team - For comprehensive testing framework
- Black Code Formatter - For consistent code styling
- flake8 Contributors - For code quality and linting tools
- IoT Agriculture Community - For innovative sensor deployment strategies
- Plant Shop Owners & Greenhouse Operators - For real-world requirements and feedback
- Environmental Monitoring Researchers - For scientific accuracy in sensor calibration
| Contact Method | Information | Best For |
|---|---|---|
| ๐ง Email | [email protected] | General inquiries, collaborations |
| ๐ Issues | GitHub Issues | Bug reports, feature requests |
| ๐ก Discussions | GitHub Discussions | Ideas, questions, community support |
| ๐ Documentation | Project Wiki | Detailed guides, tutorials |
Custom IoT Solutions & Consulting Available
- ๐ญ Enterprise Deployments - Large-scale sensor network implementation
- ๐ง Hardware Integration - Custom sensor development and Zigbee network setup
- ๐ Data Analytics - Advanced reporting and predictive maintenance solutions
- ๐ Training & Workshops - Team education on IoT agriculture technologies
- ๐ Cloud Migration - AWS/Azure deployment and scaling consultation
Contact [email protected] for enterprise pricing and custom development.
- Database Integration - PostgreSQL/SQLite for persistent storage
- User Authentication - Role-based access control and user management
- Mobile App - Native iOS/Android companion application
- Machine Learning - Predictive analytics for plant health
- Notification System - Email/SMS alerts for critical conditions
- Multi-Language Support - Internationalization (i18n)
- AI-Powered Insights - Computer vision plant health assessment
- Weather Integration - External weather data correlation
- Automation Controls - Automated watering system integration
- Blockchain Logging - Immutable audit trail for organic certification
- AR Dashboard - Augmented reality sensor visualization
| Metric | Value | Description |
|---|---|---|
| ๐งช Test Coverage | 95%+ | Comprehensive test suite |
| ๐ฆ Dependencies | Minimal | Lightweight, secure stack |
| ๐ Browser Support | Modern | Chrome, Firefox, Safari, Edge |
| ๐ฑ Mobile Ready | โ | Responsive design |
| ๐ Security | Enterprise | Production-ready security |
| โก Performance | <100ms | Sub-second response times |
Help support continued development of this project!
This project is developed and maintained in my spare time. If you find it valuable for your business or personal projects, consider supporting its development:
Your support enables:
- ๐ Faster feature development
- ๐ Quicker bug fixes and updates
- ๐ Better documentation and tutorials
- ๐ฑ Community growth and support
โญ Star this project if you find it useful! โญ
Made for the plant-loving community
ยฉ 2024-2025 Pat Ryan Things LLC. Released under the MIT License.