A comprehensive IoT soil monitoring and irrigation management platform that enables real-time tracking of soil moisture levels through distributed sensor networks with LoRaWAN wireless communication.
SoilSense is a full-stack agricultural monitoring solution combining embedded LoRaWAN sensors, a Django REST backend, and a modern React frontend. The system allows farmers and agricultural professionals to remotely monitor soil conditions, analyze historical data, and control irrigation systems from anywhere.
- Real-time Monitoring: Track soil moisture levels from multiple sensor nodes in real-time
- Historical Analytics: View and analyze soil data across configurable time periods (hour, day, week, month, year)
- Multi-site Management: Organize monitoring across multiple central stations and nodes
- Data Visualization: Interactive charts and dashboards for trend analysis
- Irrigation Control: Remote irrigation activation through sensor nodes
- User Management: Secure authentication with JWT tokens and user profiles
- Wireless Communication: Long-range LoRaWAN connectivity for distributed sensor networks
- Responsive Interface: Modern Material-UI web application accessible from any device
SoilSense is a monorepo containing three main components:
soilsense/
├── frontend/ # React web application
├── backend/ # Django REST API server
└── FreeRTOS_LoRaWAN/ # Embedded firmware for STM32 hardware
Soil Sensors (Analog) → STM32 ADC → FreeRTOS Processing → LoRaWAN Transmission
↓
User Dashboard ← React Frontend ← Django REST API ← Wireless Gateway
- Users → Own multiple Central Stations
- Central Stations → Contain multiple Nodes
- Nodes → Generate soil moisture readings over time
- React 18.2.0 with TypeScript
- Vite (build tool)
- Material-UI (MUI) components
- Chart.js for data visualization
- Mapbox GL for mapping
- React Router for navigation
- React Hook Form with Yup validation
- Axios for API communication
- Django 5.0.4
- Django REST Framework
- Simple JWT authentication
- Django CORS headers
- SQLite3 database
- STM32WLE5JCIX microcontroller
- FreeRTOS real-time OS
- LoRaWAN protocol stack
- Cayenne LPP data encoding
- STM32CubeIDE development environment
- Node.js (v16 or higher)
- Python 3.8+
- pip
- Git
- STM32CubeIDE (for firmware development)
- Navigate to the backend directory:
cd backend- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Run migrations:
python manage.py migrate- Create a superuser (optional):
python manage.py createsuperuser- Start the development server:
python manage.py runserverThe backend will be available at http://localhost:8000
- Navigate to the frontend directory:
cd frontend- Install dependencies:
npm install-
Configure environment variables: Create a
.envfile based on your backend URL configuration. -
Start the development server:
npm run devThe frontend will be available at http://localhost:5173
- Open STM32CubeIDE
- Import the
FreeRTOS_LoRaWANproject - Configure LoRaWAN credentials (AppEUI, AppKey, DevEUI)
- Build and flash to your STM32WLE5JCIX device
POST /api/client/login- User login (returns JWT tokens)POST /api/client/register- User registrationPOST /api/client/logout- User logoutPOST /api/client/refresh- Refresh access token
GET /api/client- Get current user profilePUT /api/client/update- Update user profileGET /api/users- List all users (admin)DELETE /api/users/<id>- Delete user (admin)
GET /api/central- List all centralsPOST /api/central/create- Create new central stationGET /api/users/central/- List user's central stationsGET /api/central/<id>- Get central detailsPUT /api/central/<id>- Update centralDELETE /api/central/<id>- Delete central
GET /api/node- List all nodesPOST /api/node/create- Create new nodeGET /api/node/central/<id>/- List nodes in a centralGET /api/node/<id>- Get node detailsPUT /api/node/<id>- Update nodeDELETE /api/node/<id>- Delete nodeGET /api/node/irrigate/<id>- Activate irrigation
GET /api/soil-data- List all soil readingsPOST /api/soil-data- Store new sensor readingsGET /api/soil-data/node/<id>/- Get node's soil dataGET /api/node-stats/<id>/<period>- Get averaged moisture data- Periods:
hour,day,week,month,year,last_ten_data
- Periods:
GET /api/central-stats/<id>/<period>- Get central aggregate statistics
- Sign Up: Create an account at
/sign-up - Create Central Station: Add a new monitoring location at
/new-central - Add Nodes: Register sensor nodes under your central station
- Monitor Data: View real-time and historical data on the dashboard
- Control Irrigation: Activate irrigation remotely from node controls
# Frontend
cd frontend
npm run lint
# Backend
cd backend
python manage.py test# Frontend
cd frontend
npm run build
# Backend - Deploy to PythonAnywhere or your preferred hostingfrontend/
├── src/
│ ├── assets/ # Static assets
│ ├── components/ # Reusable UI components
│ ├── contexts/ # React contexts (user auth)
│ ├── pages/ # Page components
│ ├── schemas/ # Form validation schemas
│ ├── utils/ # Utility functions
│ └── App.tsx # Main application component
backend/
├── client/ # User and authentication app
├── services/ # Core business logic
│ ├── models.py # Database models
│ ├── serializers.py # DRF serializers
│ └── views.py # API views
└── soilsense/ # Django project settings
FreeRTOS_LoRaWAN/
├── Core/ # Core application logic
│ ├── Inc/ # Header files
│ └── Src/ # Source files
├── LoRaWAN/ # LoRaWAN stack
└── Middlewares/ # FreeRTOS and libraries
Raw sensor values (0-550) are mapped to percentage (0-100%):
- 0 → 0% (dry)
- 550 → 100% (saturated)
All soil readings include:
- Timestamp
- Node ID
- Moisture value
- Associated central station
- Backend: Hosted on PythonAnywhere at
soilsense.pythonanywhere.com - Frontend: Configured for Vercel deployment
- Hardware: STM32 nodes deployed in field locations
Configure the following for production:
- Backend API URL
- LoRaWAN credentials (AppEUI, AppKey, DevEUI)
- Database credentials
- JWT secret keys
- Mapbox access token
- v1.0 - Initial deployment (02/02/25)
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project is proprietary software. All rights reserved.
For questions, issues, or support, please contact the development team.
SoilSense - Intelligent Agriculture Through Connected Sensors