Back to projects

paddock monitoring

IoT project for monitoring paddocks

November 2024
IoT
TypeScript
ESP32
Express
React Native
Docker

The paddock monitoring system provides real-time environmental data from agricultural fields. As shown in Figure 1, the system uses a network of sensors connected to microcontrollers that transmit data to a central API server.

High-level architecture diagram of the paddock monitoring system showing sensor connectivity and data flow.
Figure 1: High-level architecture diagram of the paddock monitoring system showing sensor connectivity and data flow.
  • 3 x Heltec WiFi LoRa 32 V3
  • 3 x 40 jumper wire cables, 20 cm each M2M/F2M/F2F
  • 1 x soldering iron set
  • 1 x heat shrink tubing set
  • 5 x 1M cable DS18B20 digital stainless steel temperature sensor
  • 3 x IP65 electrical project box (20 x 12 x 7.5 cm)
  • 5 x Mini Breadboard 400 Pin
  • 3 x Bingfu Lora Gateway Antenna 868 MHz 2 dBi RP-SMA Connector Outdoor Antenna
  • 1 x Cable Gland Set, IP68 Waterproof Adjustable Cable Gland

The following code snippet shows the platformio.ini configuration file for the paddock monitoring microcontroller project.
Then PIN-configuration for the LoRa module and the DS18B20 temperature sensor are defined.

The database model consists of 4 entities: Paddock, Microcontroller, Sensor, and Measurement. As shown in Figure 2, each paddock can have multiple microcontrollers, each microcontroller can have multiple sensors, and each sensor can record multiple measurements.

Entity relationship diagram showing the data model structure with Paddock, Microcontroller, Sensor, and Measurement entities.
Figure 2: Entity relationship diagram showing the data model structure with Paddock, Microcontroller, Sensor, and Measurement entities.

The paddock monitoring system is deployed using a microservices architecture with separate services for the API server and mobile app. The deployment flow is as follows:

API Server
Github
Azure Docker Registry
api-paddockmonitoring-prod.azurewebsites.net
Mobile App
Github
Azure Docker Registry
app-paddockmonitoring-prod.azurewebsites.net
paddock-monitoring.tony-luke.de

The paddock monitoring system exposes the following RESTful API endpoints to interact with the application:

Measurements
GET
/measurements

Retrieve all measurements

POST
/measurements

Create a new measurement

Microcontrollers
GET
/microcontrollers

Retrieve all microcontrollers

POST
/microcontrollers

Register a new microcontroller

Sensors
GET
/sensors

Retrieve all sensors

POST
/sensors

Register a new sensor

Paddocks
GET
/paddocks

Retrieve all paddocks

POST
/paddocks

Create a new paddock

The mobile app provides real-time sensor data and paddock status information. As shown in Figure 3, users can view temperature, humidity, and soil moisture levels for each paddock.

Mockup of the paddock monitoring mobile app showing real-time sensor data and paddock status.
Figure 3: Mockup of the paddock monitoring mobile app showing real-time sensor data and paddock status.