A full-stack IoT project that monitors plant moisture levels using Raspberry Pi Pico sensors and displays the data through a modern web interface. The system provides real-time moisture tracking and historical data visualization for your plants.
The project consists of four main components:
-
Moisture Sensors (Raspberry Pi Pico)
- Reads moisture levels using capacitive soil sensors
- Connects via WiFi for data transmission
- Reports readings through MQTT
- Includes LED status indicators for diagnostics
-
MQTT Broker
- Handles communication between sensors and database
- Processes incoming sensor data
- Ensures reliable data transmission
-
Database (PostgreSQL)
- Stores historical moisture readings
- Manages plant and sensor relationships
- Enables data analysis and trending
-
Web Interface (Next.js)
- Modern, paper-styled UI for data visualization
- Real-time moisture level displays
- Historical data charts
- Plant management interface
-
Real-time Monitoring
- Live moisture level readings
- Multiple sensor support per plant
- Visual status indicators
-
Data Visualization
- Interactive charts showing moisture trends
- Historical data analysis
- Easy-to-read moisture levels
-
Plant Management
- Add and manage multiple plants
- Configure sensors for each plant
- Track plant health over time
- Raspberry Pi Pico W
- Capacitive Soil Moisture Sensor v2.0
- Built-in LED for status indication
-
Frontend:
- Next.js 13+ (App Router)
- TypeScript
- TailwindCSS
- Chart.js for data visualization
-
Backend:
- PostgreSQL database
- MQTT for sensor communication
- MicroPython (Raspberry Pi Pico)
-
Development:
- Turborepo for monorepo management
- ESLint for code quality
- TypeScript for type safety
-
Set up the Raspberry Pi Pico with required components:
- Raspberry Pi Pico W
- Capacitive Soil Moisture Sensor
- Power supply
-
Flash the MicroPython code to the Pico:
- Upload all required files
- Configure WiFi and MQTT settings
-
Clone the repository:
git clone [repository-url] cd plant-reader
-
Install dependencies:
npm install
-
Configure environment variables:
cp .env.example .env
Edit .env with your database and MQTT settings
-
Start the development server:
npm dev
plant-reader/
├── packages/
│ ├── services/
│ │ └── plant-reader-app/ # Next.js web application
│ ├── db/ # Database schemas and types
│ └── mqtt/ # MQTT client and handlers
└── docs/ # Documentation
The Pico's onboard LED indicates different states:
- Fast blinking (0.1s): Time sync in progress
- Medium blinking (0.5s): WiFi connecting
- Slow blinking (1.0s): MQTT connecting
- LED off: Normal operation
Sensors publish data in the following JSON format:
{
"plant_reader_id": "sensor_id",
"created_at": [
"year",
"month",
"day",
"hour",
"minute",
"second",
"weekday",
0
],
"moisture_level": "percentage",
"meta_data": {}
}
Contributions are welcome! Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.
This project is licensed under the MIT License - see the LICENSE file for details.
- Built with Turborepo
- Powered by Next.js
- Hardware powered by Raspberry Pi Pico