🌱 Hardware Guide

Connect your IoT sensors to Verdant via MQTT. We support any hardware that can publish JSON messages over WiFi.

🌡️

Temperature

DHT22, DS18B20, BME280

💧

Humidity & Soil

SHT31, Capacitive sensors

☀️

Light

BH1750, TSL2561, LDR

🫧

CO₂

MH-Z19, SCD30, SCD40

🔌 MQTT Protocol

Your hardware communicates with Verdant using these MQTT topics. All sensor data is logged on Solana for full auditability.

Publish
verdant/{plant_id}/sensors

Send sensor readings as JSON every 30 seconds

Subscribe
verdant/{plant_id}/actions

Receive AI action commands from Verdant

Sensor Data Format

{
  "temperature": 22.5,  // Celsius
  "humidity": 65,  // Percentage
  "soilMoisture": 45,  // Percentage
  "lightLevel": 3500,  // Lux
  "co2": 800  // PPM (optional)
}

Action Command Format

{
  "action": "water",  // water, light_on, light_off, fan_on, fan_off, heater_on, heater_off
  "duration": 3  // Optional: seconds
}

⚙️ Firmware Examples

Copy-paste ready code for your hardware platform. Open-source and MIT licensed.

⚠️ Replace YOUR_PLANT_ID and credentials with your actual Verdant credentials before deploying to hardware.
verdant_pi_sensor.py
#!/usr/bin/env python3
# Verdant Raspberry Pi Sensor Client
# Reads sensors and publishes to MQTT, receives action commands

import json, time
import paho.mqtt.client as mqtt

# ============ CONFIGURATION ============
MQTT_BROKER = "test.mosquitto.org"
MQTT_PORT = 1883
PLANT_ID = "YOUR_PLANT_ID"
TOPIC_SENSORS = f"verdant/{PLANT_ID}/sensors"
TOPIC_ACTIONS = f"verdant/{PLANT_ID}/actions"

# ============ GPIO PINS ============
PUMP_PIN = 17
LIGHT_PIN = 27
FAN_PIN = 22

def read_sensors():
    # Replace with real sensor reads (DHT22, etc.)
    return {
        "temperature": 22.5,
        "humidity": 65,
        "soilMoisture": 45,
        "lightLevel": 3500
    }

def on_message(client, userdata, msg):
    cmd = json.loads(msg.payload)
    if cmd["action"] == "water":
        activate_pump(cmd.get("duration", 3))

# Main loop — publishes every 30 seconds
while True:
    client.publish(TOPIC_SENSORS, json.dumps(read_sensors()))
    time.sleep(30)

📹 Live Camera Streaming

Stream video from a Raspberry Pi Camera or ESP32-CAM directly into your Verdant dashboard.

Recommended resolution
640×480
Frame rate
5–10 FPS
Bandwidth
~1–2 Mbps
Format
JPEG

📊 Sensor Requirements

Required (at least one)

  • soilMoisture: 0–100% (for watering decisions)

Optional (improves AI accuracy)

  • temperature: Celsius
  • humidity: 0–100%
  • lightLevel: lux value
  • co2: PPM value

🔧 Troubleshooting

Data not showing in dashboard?
  • Check Plant ID matches exactly (case-sensitive)
  • Verify topic format: verdant/YOUR_PLANT_ID/sensors
  • Ensure JSON is valid before publishing
  • Wait at least 30 seconds (rate limiting applies)
MQTT connection failing?
  • test.mosquitto.org is a public broker — no auth needed
  • Use port 8883 for TLS connections
  • Check firewall isn't blocking outbound MQTT traffic
Actions not reaching hardware?
  • Subscribe to verdant/YOUR_PLANT_ID/actions
  • Action format: {"action": "water"}
  • Keep MQTT client loop running continuously
Testing without hardware?
  • Use the "Sensor Test Data" button on the plant page
  • Or use MQTT Explorer to manually publish sensor data

🛡️ Safety & Best Practices