Note: This project is designed to run on Google Colab for optimal performance and cloud integration.
SmartPlant is a comprehensive cloud-based plant monitoring system that combines IoT sensors, AI-powered plant disease detection, and gamification to help users maintain healthy plants. The system integrates real-time sensor data from AdaFruit IO with Google's Gemini AI for intelligent plant care recommendations.
- Real-time Monitoring: Track temperature, humidity, soil moisture, and light levels
- AI Plant Assistant: RAG-powered chatbot using Google Gemini for plant care advice
- Disease Detection: Computer vision model for plant disease identification from photos
- Gamification: Points, badges, challenges, and leaderboards to encourage plant care
- Historical Analytics: View trends and patterns in sensor data over time
- Social Features: Connect with friends, compete on leaderboards
- Multi-plant Management: Monitor multiple plants simultaneously
- Google Account with Colab access
- API Keys (see Configuration section)
- AdaFruit IO Account (for sensor data)
- Firebase Project (for database)
-
Upload Project to Google Drive
- Upload the entire `smartplant` folder to your Google Drive - Note the path to your project folder -
Open in Google Colab
# Mount Google Drive from google.colab import drive drive.mount('/content/drive') # Navigate to project directory %cd /content/drive/MyDrive/smartplant
-
Install Dependencies
!pip install -r requirements.txt
-
Configure API Keys
- Edit
SmartPlant_backend/keys.jsonwith your credentials:
{ "ADAFRUIT": { "username": "your_username", "aio_key": "your_aio_key" }, "NGROK": "your_ngrok_token", "TREFLET": "your_trefle_api_key", "GEMINI": "your_gemini_api_key", "FIREBASE": "firebase-credentials" } - Edit
-
Run the Application
# Run main.py in Colab %run main.py
-
Access the Web Interface
- The ngrok tunnel URL will be displayed in the output
- Copy the URL and open it in your browser
- Example:
https://your-tunnel.ngrok-free.app
| Service | Purpose | Get Key From |
|---|---|---|
| AdaFruit IO | IoT sensor data | io.adafruit.com |
| Ngrok | Public tunnel for web access | ngrok.com |
| Trefle.io | Plant species database | trefle.io |
| Google Gemini | AI chatbot (RAG) | ai.google.dev |
| Firebase | Database & authentication | console.firebase.google.com |
- Create a new Firebase project
- Enable Firestore Database
- Download service account credentials JSON
- Place in
SmartPlant_backend/directory - Update path in
keys.json
- Create feeds for:
temperature,humidity,soil-moisture,light - Configure MQTT or HTTP integration
- Add credentials to
keys.json
smartplant/
โโโ main.py # Main entry point (run in Colab)
โโโ requirements.txt # Python dependencies
โโโ DATABASE_SCHEMA.md # Database design documentation
โโโ SmartPlant_backend/
โ โโโ BackendManager.py # Central service coordinator
โ โโโ NgrokManager.py # Flask server + ngrok tunnel
โ โโโ FirebaseManager.py # Database operations
โ โโโ AdaFruitManager.py # IoT sensor integration
โ โโโ RAG.py # Retrieval-Augmented Generation
โ โโโ GEM.py # Google Gemini AI wrapper
โ โโโ DetectionManager.py # Plant disease detection
โ โโโ TrefletManager.py # Plant species API
โ โโโ SearchEngine.py # Knowledge base search
โ โโโ Helpers.py # Utility functions
โ โโโ fakes.py # Mock data generators
โ โโโ ngrokConfig.json # Route configuration
โ โโโ ApiConfig.json # API endpoint mapping
โ โโโ backendConfig.json # Backend settings
โ โโโ keys.json # API credentials (NOT in git)
โโโ SmartPlant_frontend/
โโโ index.html # Landing page
โโโ dashboard.html # Main plant dashboard
โโโ chat.html # AI assistant chat
โโโ status.html # Historical data & charts
โโโ my_garden.html # Gamification & social
โโโ app.js # Frontend application logic
โโโ api.js # API client
โโโ style.css # Styling
โโโ smartplanticon.svg # Logo/favicon
POST /api/login- User login validation
GET /api/sensor/data- Get current/historical sensor readingsGET /api/sensor/thresholds- Get alert thresholdsPOST /api/sensor/thresholds- Update alert thresholds
GET /api/plants?user_id=<id>- Get user's plantsPOST /api/plants- Add new plant
POST /api/rag/query- Chat with AI (text + optional image)
GET /api/tasks- Get daily/weekly tasksPOST /api/tasks/toggle- Complete a taskGET /api/badges?user_id=<id>- Get user badgesGET /api/challenges- Get available challengesGET /api/garden/summary- Get user stats summary
GET /api/friends- Get friends listGET /api/leaderboard- Get ranked users
- Python 3.8+ - Core language
- Flask - Web framework
- Firebase Firestore - NoSQL database
- Google Gemini - AI language model
- Transformers - Plant disease detection
- NLTK - Natural language processing
- Paho MQTT - IoT communication
- BeautifulSoup - Web scraping for knowledge base
- Vanilla JavaScript - No frameworks
- Chart.js - Data visualization
- Lucide Icons - UI icons
- CSS Variables - Dark/light theme
- Google Colab - Cloud compute environment
- Ngrok - Public tunneling
- AdaFruit IO - IoT platform
- Firebase - Cloud database
See DATABASE_SCHEMA.md for detailed collection structures.
Main Collections:
users- User accounts & statsplants- Plant metadata & current readingssensorreadings- Time-series sensor historytasks/usertasks- Daily/weekly challengesbadges/userbadges- Achievementsqueries- Chat historyfriends- Social connectionsleaderboard- Ranked user stats
- Create an account on the landing page
- Add your first plant from the dashboard
- Configure sensor thresholds in the Status page
- Connect IoT sensors to AdaFruit IO feeds
- Start monitoring and complete challenges!
- Check dashboard for plant health status
- Review sensor readings and charts
- Use AI chat for plant care questions
- Upload plant photos for disease detection
- Complete daily challenges for points
- Earn points by completing tasks
- Unlock badges for achievements
- Compete with friends on leaderboards
- Maintain streaks for daily logins
# Kill existing tunnels
!pkill ngrok
# Restart the application
%run main.py- Verify credentials JSON path
- Check Firebase project permissions
- Ensure Firestore is enabled
- Check AdaFruit IO feed status
- Verify MQTT credentials
- Test sensor hardware connections
- Verify Gemini API key
- Check API quota limits
- Review error messages in console
This is an academic project. For questions or suggestions, contact the development team.
Academic project - Braude College of Engineering Cloud Computing Course - Semester 7
Braude College Software Engineering Students Cloud Computing Course - 2025
- AdaFruit - IoT platform and sensors
- Google Gemini - AI language model
- Trefle.io - Plant database API
- Firebase - Cloud infrastructure
- Ngrok - Tunneling service
- Colab sessions timeout after 12 hours of inactivity
- Save your work frequently to Google Drive
- Ngrok tunnel URL changes on each restart
- Use GPU runtime for faster ML model inference
- Cache frequently accessed data in memory
- Minimize file I/O operations
- Never commit
keys.jsonto version control - Use environment variables for production
- Rotate API keys regularly
- Keep Firebase credentials secure
- Colab has memory and compute limits
- Optimize large dataset processing
- Consider upgrading to Colab Pro for extended sessions
Ready to grow? ๐ฟ Start monitoring your plants with SmartPlant!