IJ
Ivan Jovanovski
HomeProjectsLabResumeNowFuture Ideas
IJ
Ivan Jovanovski

Electrical Engineer building practical solutions in energy systems, automotive electronics, and embedded systems.

Navigation

  • Aerospace
  • Projects
  • Lab

Focus Areas

  • Energy Systems
  • Automotive Electronics

Connect

© 2025 Ivan Jovanovski. All rights reserved.

Smart Farm IoT: Distributed Garden Watering System

IoTLoRaAgriculture
General
Smart Farm IoT: Distributed Garden Watering System

Project Overview

A modular IoT-based smart agricultural system designed to optimize resource management and sustainability through automation. This proof-of-concept demonstrates distributed sensor nodes communicating via LoRa, an ESP32 gateway with secure SSL/TLS connectivity, and a Java server integrated with Kafka for real-time data processing.

Version:v1.0-PoC
Time:~24.0 hours
Cost:$200
Status:in-progress

Materials

  • ESP32 Development Board × 1
  • LoRa Modules (433MHz) × 3
  • Arduino Nano × 2
  • DHT11 Temperature/Humidity Sensor × 2
  • Capacitive Soil Moisture Sensor × 2
  • Power supplies and batteries × 1

Tools

  • Arduino IDE
  • Java 11+ with Maven
  • Apache Kafka
  • DuckDNS
  • Soldering iron

Build Steps

1. Project Vision and System Architecture

⏱️ ~4.0h
Step 1 image 1

Context and Motivation

Agriculture faces significant challenges in optimizing resources and ensuring sustainability. Traditional farming methods often lead to inefficient water usage, delayed responses to environmental changes, and difficulty in monitoring large areas. The integration of IoT and distributed systems offers a transformative solution by enabling real-time monitoring, automated control, and data-driven decision-making.

Project Vision

The goal is to create a modular smart agricultural system integrating solar modules, weather monitoring, water management, distributed IoT nodes, a central gateway, backend infrastructure, and a frontend interface. The system makes farms more productive, sustainable, and easier to manage.

Current Scope

This PoC validates the core architecture with data collection nodes (Arduino Nano, DHT11, soil moisture sensors), secure ESP32 gateway with LoRa and SSL/TLS, and Java server with Kafka integration.

2. Hardware Components Deep Dive

⏱️ ~3.0h
Step 2 image 1Step 2 image 2Step 2 image 3

ESP32 Gateway

Dual-core 32-bit Tensilica LX6 at 240 MHz with 520 KB SRAM. Parallel processing: one core handles LoRa, the other manages Wi-Fi. Built-in Wi-Fi 802.11 b/g/n with WPA2 and SSL/TLS support.

LoRa Communication

433 MHz frequency enables 10 km range vs Wi-Fi's 100m. Chirp Spread Spectrum provides noise immunity and simultaneous multi-node communication. Only 120 mA max during transmission, enabling months of battery operation.

Arduino Nano

ATmega328P at 16 MHz with 2 KB SRAM. 19 mA active, reducible to microamps in sleep mode for long-term battery deployment.

Sensors

DHT11: 0-50°C (±2°C), 20-90% RH (±5%), 2.5 mA. Capacitive soil moisture: corrosion-resistant, analog output for fine-grained measurements.

3. Sensor Node Implementation

⏱️ ~5.0h
Step 3 image 1Step 3 image 2

Node Architecture

Independent read-transmit-sleep cycle. Reads DHT11 and soil moisture, formats as ID:T1 T:25.0 H:60.0 S:450, transmits via LoRa.

Key Features

Bidirectional communication with STOP command for low-power mode. LowPower library reduces 19 mA to 5 μA during sleep, extending battery life from days to months.

Hardware

LoRa via SPI (pins 11, 12, 13, 10, 9, 2). DHT11 on digital pin 2 with 10kΩ pull-up. Soil moisture on A0 with power cycling to prevent electrolysis.

4. ESP32 Gateway Implementation

⏱️ ~6.0h
Step 4 image 1Step 4 image 2

Gateway Role

Bridges LoRa sensor network and cloud. Receives from multiple nodes, validates, aggregates, and securely transmits via SSL/TLS. Relays commands back to nodes.

Core Functionality

Wi-Fi with auto-reconnect and exponential backoff. TLS-encrypted server connections. Interrupt-driven LoRa reception with RSSI monitoring. Data validation before forwarding.

Network

Communicates via orman-nodes.duckdns.org (DuckDNS for static DNS). Port 12345 forwarded to server's local IP. LoRa on GPIO 23, 19, 18, 5, 14, 26.

5. Java Server and Kafka Integration

⏱️ ~7.0h

Server Architecture

Central hub for data processing. Receives via SSL/TLS, validates with regex, forwards to Kafka for distributed analytics. Handles multiple simultaneous gateways.

Infrastructure

DuckDNS maps orman-nodes.duckdns.org to public IP. Port 12345 forwarded to internal IP. SSL/TLS via Java Keystore (JKS).

Data Pipeline

Regex validation: ID:[a-zA-Z0-9]+ T:[+-]?\d+(\.\d+)? H:[+-]?\d+(\.\d+)? S:\d+ RSSI:[+-]?\d+. JSON conversion via Jackson. Kafka publish to 'iot-data' topic.

Kafka Benefits

Decoupling, scalability, reliability (data persistence), real-time stream processing. PSK authentication with future certificate-based mutual TLS.

Gallery

Gallery 1Gallery 2Gallery 3Gallery 4Gallery 5Gallery 6Gallery 7Gallery 8Gallery 9Gallery 10

Discussion & Notes

Why use LoRa instead of Wi-Fi?

LoRa provides 10x the range (up to 10km vs 100m) and far less power, enabling battery nodes to operate for months. Ideal for distributed farm sensors.

How secure is the system?

All gateway-to-server communication uses SSL/TLS encryption. Pre-shared key authentication prevents unauthorized access. Future versions will implement certificate-based mutual TLS.

Results

Successfully demonstrated feasibility of IoT-based smart agricultural system with reliable 2+ km LoRa transmission, stable secure gateway connection, and real-time Kafka data processing.

  • LoRa Range: 2-10 km
  • LoRa Frequency: 433 MHz
  • Node Power (Sleep): 5 μA

Future Development Roadmap

Solar Panel Automation

high

Automated panels that open/close based on weather with predictive behavior for maximum energy collection and storm protection.

Advanced Weather Station

high

Wind, rainfall, UV, barometric pressure sensors for sophisticated predictive algorithms.

Automated Irrigation

high

Smart pumps and valves based on real-time soil moisture, weather forecasts, and crop requirements.

Safety Notes

Ensure proper voltage levels (3.3V for ESP32, 5V for Arduino). Use SSL/TLS encryption. Implement authentication. Monitor LoRa transmission power for regulatory compliance. Use weatherproof enclosures outdoors.