- Overview
- Features
- Technologies Used
- Setup and Installation
- Usage
- Project Structure
- Contributing
- License
- Acknowledgements
This project consisted of developing a smart irrigation control system prototype that optimises water usage based on real-time weather forecasts and sensor data. The system integrates with the OpenWeatherMap API to fetch weather data and triggers actions, such as delaying irrigation, based on upcoming rain events. Commands are sent to an external arduino hardware
The system sends UDP commands through an ESP connection to an external Arduino hardware, which manages the pumps. This setup ensures that the irrigation system is responsive and can effectively save water by not watering the crops when rain is imminent.
- Real-Time Weather Data Integration: Utilised the OpenWeatherMap API to fetch and process weather forecasts.
- Automated Decision-Making: Implemented logic to delay irrigation based on rain predictions, optimising water usage.
- Full-Stack Development: Built with Node.js and Express on the backend, Pug templates and JavaScript on the frontend.
- Database Management: Stored and retrieved weather and sensor data using MongoDB.
- Data Visualisation: Created interactive charts using Chart.js to visualise weather data and rain events.
- Error Handling: Ensured robust error handling and resilience in data fetching and processing.
- Scheduled Tasks: Scheduled hourly checks for upcoming rain events to automate irrigation control.
- Hardware Integration: Sends UDP commands to Arduino hardware to control pumps.
- Deployed on Heroku: The application is live and can be accessed here.
- Backend: Node.js, Express
- Database: MongoDB
- Frontend: Pug (formerly Jade), JavaScript (ES6)
- APIs: OpenWeatherMap API
- Charting: Chart.js
- Hardware Communication: UDP, ESP, Arduino
- Deployment: Heroku
- Clone the repository
git clone https://github.com/robinrai1349/smart_irrigation_app.git cd smart_irrigation_app
- Install dependencies
npm install
- Setup an environment variables
Create a
.env
file in the root directory and add your MongoDB URI and OpenWeatherMap API key:MONGODB_URI=your_mongodb_uri OPENWEATHERMAP_API_KEY=your_openweathermap_api_key
- Start the application
npm start
- Access the application at
http://localhost:3000
. - View real-time weather data and sensor information on the dashboard.
- The system will automatically delay the pumps if rain is predicted within the next hour.
.
├── controllers
│ ├── sensorController.js
│ └── weatherService.js
├── models
│ ├── sensor.js
│ ├── weather.js
│ └── rainEvent.js
├── routes
│ ├── index.js
│ └── users.js
├── views
│ ├── index.pug
│ └── layout.pug
├── .env
├── app.js
├── package.json
└── README.md
Contributions are welcome! Please create a pull request or open an issue to discuss any changes.
This project is licensed under the MIT License.
- OpenWeatherMap for providing the weather data API.
- Chart.js for the charting library.
- Heroku for providing a deployment platform.
- All contributors and supporters of this project.