Welcome to Leaf Link

Smart Plant Monitoring for Healthy Growth

Monitor soil moisture, automate watering, and keep your plants thriving with our IoT solution

Key Features

Soil Moisture Monitoring

Real-time monitoring of soil moisture levels for optimal plant health

Automated Watering

Automatically water your plants when soil moisture drops below threshold

Wireless Communication

NRF24L01 radio modules for reliable device communication

Data Analytics

Track moisture trends and watering history over time

System Architecture

Leaf Link consists of three main components working together

Arduino Nodes

Sensor nodes that monitor soil moisture and control water pumps

Raspberry Pi Hub

Central hub that collects data and manages all Arduino nodes

Cloud API

RESTful API for data storage and remote monitoring

Arduino Setup Guide

Set up your Arduino nodes to monitor and water your plants

Required Hardware

  • Arduino Nano or Uno
  • NRF24L01+ Radio Module
  • Capacitive Soil Moisture Sensor
  • 5V Water Pump
  • Relay Module (for pump control)
  • Power Supply (5V/9V)
  • Jumper Wires
  • 10μF Capacitor (for NRF24L01 stability)

Wiring Connections

NRF24L01 Module

NRF24L01Arduino
VCC3.3V
GNDGND
CED9
CSND10
SCKD13
MOSID11
MISOD12

Soil Moisture Sensor

SensorArduino
VCC5V
GNDGND
AOUTA0

Relay Module (for Pump)

RelayArduino
VCC5V
GNDGND
IND7

Software Installation

  1. Install Arduino IDE

    Download from arduino.cc

  2. Install Required Libraries

    Open Arduino IDE → Tools → Manage Libraries

    • RF24 by TMRh20
    • SPI (built-in)
  3. Download Leaf Link Arduino Code

    git clone https://github.com/yourusername/leaf-link-arduino.git
    cd leaf-link-arduino
  4. Configure Device ID

    Edit config.h and set unique device ID:

    #define DEVICE_ID "PLANT_001"
    #define MOISTURE_THRESHOLD 30  // Adjust based on your plant
  5. Upload Code to Arduino

    Connect Arduino via USB → Select Board and Port → Click Upload

Raspberry Pi Setup Guide

Configure your Raspberry Pi as the central hub

Required Hardware

  • Raspberry Pi 3/4/Zero W
  • NRF24L01+ Radio Module
  • MicroSD Card (8GB+)
  • Power Supply
  • GPIO Breakout Board (optional)
  • Jumper Wires

GPIO Connections

NRF24L01 to Raspberry Pi

NRF24L01RPi GPIOPin #
VCC3.3V1
GNDGND6
CEGPIO2215
CSNGPIO8 (CE0)24
SCKGPIO11 (SCLK)23
MOSIGPIO10 (MOSI)19
MISOGPIO9 (MISO)21

Software Installation

  1. Install Raspberry Pi OS

    Use Raspberry Pi Imager to flash the latest OS to your SD card

    # Enable SSH and configure WiFi during imaging
  2. Enable SPI Interface

    sudo raspi-config
    # Navigate to: Interface Options → SPI → Enable
  3. Install System Dependencies

    sudo apt-get update
    sudo apt-get install -y python3-pip python3-dev git
    sudo pip3 install --upgrade pip
  4. Install Python Libraries

    pip3 install pyrf24 RPi.GPIO requests python-dotenv
  5. Clone and Configure Leaf Link Hub

    git clone https://github.com/yourusername/leaf-link-hub.git
    cd leaf-link-hub
    cp .env.example .env
    nano .env  # Configure your API endpoint and credentials
  6. Set Up as System Service

    sudo cp leaf-link.service /etc/systemd/system/
    sudo systemctl enable leaf-link
    sudo systemctl start leaf-link
    sudo systemctl status leaf-link  # Check if running
  7. Configure API Connection

    Edit .env file with your API details:

    API_URL=http://your-server:8080
    API_KEY=your-api-key
    HUB_ID=RPI_HUB_001
    POLLING_INTERVAL=60  # seconds

Testing Your Setup

  1. Test NRF24L01 Connection

    cd leaf-link-hub
    python3 test_radio.py
  2. Check Device Discovery

    python3 scan_devices.py
    # Should detect your Arduino nodes
  3. Monitor Logs

    sudo journalctl -u leaf-link -f
    # Watch real-time logs

Download & Deploy

Get everything you need to start monitoring your plants

Source Code

Complete source code for all components

View on GitHub

Docker Image

Ready-to-deploy containerized API

docker pull yourusername/leaf-link-api:latest

Mobile App

Monitor your plants from anywhere

Quick Start with Docker Compose

# Clone the repository
git clone https://github.com/yourusername/leaf-link.git
cd leaf-link

# Configure environment
cp .env.example .env
nano .env  # Add your configuration

# Start all services
docker-compose up -d

# Access the API
# http://localhost:8080
# http://localhost:8080/docs/

Troubleshooting

NRF24L01 not working?

Add a 10μF capacitor between VCC and GND pins for stable power supply

Moisture readings incorrect?

Calibrate sensor: dry reading (air) and wet reading (water), adjust thresholds

Devices not connecting?

Ensure all devices use the same channel and data rate in configuration

API connection failed?

Check firewall settings and ensure port 8080 is open