- Environmental Sensors: Temperature, Humidity, Soil Moisture, Light intensity
- Live Dashboard: Real-time data visualization with charts and graphs
- Historical Analytics: Track trends and patterns over time
- WebSocket Integration: Instant updates without page refresh
- AI-Powered Control: Machine learning models for optimal device control
- Automatic Mode: Intelligent responses based on sensor readings
- Scheduled Control: Time-based automation with custom schedules
- Manual Override: Complete manual control when needed
- LED Control: Smart lighting with intensity adjustment (0-100%)
- Fan Control: Ventilation management with variable speed (0-100%)
- Water Pump: Automated irrigation system with flow control (0-100%)
- Threshold Monitoring: Custom alerts for sensor values
- Reminder System: Scheduled notifications and maintenance reminders
- Alert History: Track all notifications and system events
- Runtime: Node.js with Express.js
- Database: PostgreSQL with connection pooling
- Real-time: WebSocket (ws library)
- IoT Platform: Adafruit IO with MQTT
- Authentication: JWT tokens
- Environment: dotenv configuration
- Framework: React Native with Expo
- Language: TypeScript
- UI Library: React Native Paper
- Navigation: Expo Router
- State Management: React Query
- Charts: React Native Chart Kit & Gifted Charts
- Language: Python 3.x
- Framework: Scikit-learn
- Algorithm: Random Forest Classifier
- Features: Environmental sensor data processing
- Devices: LED, Fan, Water Pump control prediction
- Deployment: Render.com (Backend), Expo (Frontend)
- Version Control: Git
- Package Management: npm (Node.js), pip (Python)
git clone https://github.com/bawfng04/DADN-SmartGreenhouseSystem.git
cd DADN-SmartGreenhouseSystem-
Install PostgreSQL and create a database.
-
Import database schema:
- Navigate to
backend/src/database/create.sql - Copy the SQL content and execute it in your PostgreSQL database
- Or run:
psql -U postgres -d <database name> -f backend/src/database/create.sql
- Navigate to
-
Navigate to the backend directory:
cd backend -
Install the dependencies:
pip install -r requirements.txt && npm install -
Configure the environment variables:
- Create a
.envfile in thebackenddirectory with the following content:
# Port to run the server on PORT = <yours> # Postgres connection - For local database POSTGRES_HOST=localhost POSTGRES_PORT=5432 POSTGRES_DB=<yours> POSTGRES_USER=<yours> POSTGRES_PASSWORD=<yours> # Postgres connection - For hosted database (comment out when running locally) # POSTGRES_HOST=<yours> # POSTGRES_PORT=<yours> # POSTGRES_DB=<yours> # POSTGRES_USER=<yours> # POSTGRES_PASSWORD=<yours> # DB_SSLMODE=require # POSTGRES_EXTERNAL_URL=<yours>?ssl=tr # Secret key for encrypting password SECRET_KEY=<yours> # Secret key for token JWT_SECRET_KEY=<yours> # Adafruit IO configuration ADAFRUIT_IO_USERNAME=<yours> ADAFRUIT_IO_KEY=<yours> # Frontend URL FRONTEND_URL=<yours> - Create a
-
Start the backend server:
npm run dev
For complete API documentation, see backend/README.md.
- Navigate to the frontend directory:
cd frontend - Install the dependencies:
npm install
- Configure the environment variables:
- Create a
.envfile in thefrontenddirectory with the following content:API_URL = <yours> WEBSOCKET_URL = <yours>
- Create a
- Start the frontend application:
npx expo start
DADN-SmartGreenhouseSystem/
├── backend/ # Node.js Backend
│ ├── src/
│ │ ├── controllers/ # API route handlers
│ │ ├── models/ # Database models
│ │ ├── services/ # Business logic
│ │ ├── repository/ # Data access layer
│ │ ├── routes/ # Route definitions
│ │ ├── utils/ # Utilities (MQTT, etc.)
│ │ ├── database/ # Database configuration
│ │ └── GreenhouseModel/ # AI prediction models
│ ├── .env # Environment variables
│ ├── server.js # Entry point
│ └── package.json
│
├── frontend/ # React Native Frontend
│ ├── app/ # App screens (Expo Router)
│ ├── components/ # Reusable components
│ ├── constants/ # App constants
│ ├── contexts/ # React contexts
│ ├── hooks/ # Custom React hooks
│ ├── utils/ # Utility functions
│ ├── assets/ # Static assets
│ ├── .env # Environment variables
│ └── package.json
│
├── Machine learning model/ # Python ML Models
│ ├── fan_control/ # Fan control model
│ ├── led_control/ # LED control model
│ ├── pump_control/ # Pump control model
│ └── README.md
│
└── README.md # This file