An IoT soil moisture monitoring system for my aloe plant, hosted on a Raspberry Pi Zero WH. The system reads soil moisture levels every minute and sends personalized Discord messages with the plant's "personality" based on its hydration needs.
- Real-time Monitoring: Reads soil moisture every minute using an analog sensor via SPI
- Plant Personality: The plant communicates through Discord with different moods and comments based on moisture levels
- Data Collection: Stores both raw readings and hourly summaries in CSV format
- Automated Updates: Daily Discord reports at midnight with 24-hour moisture averages
- Auto-deployment: Automatic git pulls and service restarts when code changes are detected
- Rarity System: Comments have different rarity levels (Common, Uncommon, Rare) for variety
- Raspberry Pi Zero WH
- Analog soil moisture sensor
- MCP3008 ADC (Analog-to-Digital Converter)
- Jumper wires
- Breadboard (optional)
The soil moisture sensor connects to the Raspberry Pi via SPI through an MCP3008 ADC:
- Sensor analog output → MCP3008 CH0
- MCP3008 → Raspberry Pi SPI pins
- Python 3.x
- Required packages (install with
pip install -r requirements.txt):spidev- For SPI communicationrequests- For Discord webhook integration
-
Clone the repository:
git clone https://github.com/ToBeAss/piprojects.git cd piprojects -
Install dependencies:
pip install -r requirements.txt
-
Set up Discord webhooks:
- Create Discord webhooks for your channels
- Update
my_secrets/webhooks.pywith your webhook URLs
-
Configure sensor calibration:
- Adjust
DRYandWETvalues inaloe/sensor.pybased on your sensor - Test in completely dry soil and fully saturated soil
- Adjust
-
Set up as a system service (optional):
sudo systemctl enable myscript.service sudo systemctl start myscript.service -
Enable auto-deployment (optional):
- Set up a cron job to run
auto_pull_and_restart.shperiodically - Automatically pulls updates from GitHub and restarts the service
- Set up a cron job to run
- Minute-by-minute: Collects soil moisture data every minute
- Hourly summaries: At the top of each hour, calculates median moisture and stores summary
- Daily reports: At midnight, sends a Discord message with personality-based comments and emojis
- Continuous monitoring: Runs 24/7, storing all data in CSV files for later analysis
The aloe plant has different moods based on soil moisture levels:
- Very Dry (< 20%): Desperate, dramatic comments 🏜️
- Dry (20-40%): Polite requests for water 🌵
- Just Right (40-60%): Content and happy 😊
- Wet (60-80%): Grateful but getting concerned 💧
- Very Wet (> 80%): Worried about overwatering ☔
Each category has multiple comment variations with different rarity levels to keep interactions fresh and entertaining!
piprojects/
├── main.py # Main application entry point
├── requirements.txt # Python dependencies
├── auto_pull_and_restart.sh # Auto-deployment script
├── aloe/ # Plant-specific modules
│ ├── sensor.py # Sensor reading and data storage
│ ├── message.py # Discord message generation
│ ├── data/ # CSV data storage
│ └── personality/ # Plant personality system
│ ├── comments.py # Mood-based comments
│ └── emojis.py # Matching emojis
├── src/ # General utilities
│ ├── discord.py # Discord webhook integration
│ └── timeout.py # Timing utilities
└── my_secrets/ # Private configuration
└── webhooks.py # Discord webhook URLs
- readings.csv: Raw sensor data with timestamps
- hourly_summary.csv: Hourly moisture summaries and statistics
Feel free to fork this project and adapt it for your own plants! Ideas for improvements:
- Support for multiple sensors/plants
- Web dashboard for data visualization
- Mobile app notifications
- Integration with home automation systems
This project is open source - feel free to use and modify as needed!
Made with ❤️ for my thirsty aloe plant