Clawctl
Guides
11 min

I Built a $200 AI Home Lab: OpenClaw + ESP32 + a Used GPU. Here's My Exact Setup.

No cloud. No subscriptions. Just an ESP32 for sensors, a $60 used GPU for local inference, and OpenClaw tying it all together. The full hardware list, wiring, and config.

Clawctl Team

Product & Engineering

I Built a $200 AI Home Lab: OpenClaw + ESP32 + a Used GPU. Here's My Exact Setup.

A friend asked me what my "smart home" setup was.

I told him: an ESP32 dev board, a used GPU from eBay, and an old laptop.

He thought I was joking.

But that $200 in hardware runs my entire home intelligence stack. Temperature monitoring. Energy tracking. Air quality alerts. Security notifications. And an AI agent that makes decisions about all of it — running locally on my GPU, zero cloud dependency, zero monthly cost.

Here is the exact parts list, the wiring, and the OpenClaw configuration. Everything you need to build this yourself this weekend.

The Parts List

ComponentWhat I UsedCost
MicrocontrollerESP32-WROOM-32 dev board$8
Temperature/humidityDHT22 sensor$4
Air qualityMQ-135 gas sensor$3
Motion detectionHC-SR501 PIR sensor$2
Light levelBH1750 lux sensor$3
GPUNVIDIA GTX 1060 6GB (used, eBay)$60
Host machineOld laptop or mini PC (any x86 with 8GB+ RAM)~$100
MiscBreadboard, jumper wires, USB cable$5-10
PowerUSB power supply for ESP32$5

Total: ~$195

You probably already have some of this. If you have any PC with a spare PCIe slot, your cost drops to under $100.

The GPU is optional if you want to use a cloud LLM. But the whole point of this build is local inference. No data leaving your network. No API bills. Complete privacy.

The Architecture

┌─────────────────────────────────┐
│         ESP32 + Sensors         │
│  (temp, humidity, air, motion,  │
│   light — reads every 30 sec)   │
└──────────────┬──────────────────┘
               │ HTTP POST (JSON)
               ▼
┌─────────────────────────────────┐
│         OpenClaw Agent          │
│  (receives sensor data,         │
│   makes decisions, logs,        │
│   sends alerts)                 │
└──────────────┬──────────────────┘
               │ Inference request
               ▼
┌─────────────────────────────────┐
│    Local LLM on GPU (Ollama)    │
│  (Mistral 7B or Llama 3 8B)    │
│  (runs on GTX 1060 6GB)        │
└─────────────────────────────────┘

Three layers. ESP32 collects data. OpenClaw thinks about it. The local LLM is the brain.

Everything on your home network. Nothing touches the cloud.

Part 1: The ESP32 Sensor Hub

Wiring

The ESP32 is a $8 microcontroller with built-in WiFi. It connects to your sensors and pushes data to OpenClaw over HTTP.

Pin layout:

ESP32 Pin    Sensor         Wire Color
─────────    ──────         ──────────
GPIO 4       DHT22 Data     Yellow
GPIO 34      MQ-135 Analog  Orange
GPIO 13      PIR Signal     Green
GPIO 21      BH1750 SDA     Blue
GPIO 22      BH1750 SCL     White
3.3V         All VCC        Red
GND          All GND        Black

If you have never wired an ESP32 before: it is literally pushing wires into holes on a breadboard. No soldering required for prototyping.

ESP32 Firmware

Flash this to your ESP32 using Arduino IDE or PlatformIO:

#include <WiFi.h>
#include <HTTPClient.h>
#include <DHT.h>
#include <Wire.h>
#include <BH1750.h>

const char* ssid = "your-wifi";
const char* password = "your-password";
const char* openclaw_url = "http://192.168.1.100:3000/webhook/sensors";

DHT dht(4, DHT22);
BH1750 lightMeter;

void setup() {
  Serial.begin(115200);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) delay(500);

  dht.begin();
  Wire.begin(21, 22);
  lightMeter.begin();
  pinMode(13, INPUT);  // PIR
}

void loop() {
  float temp = dht.readTemperature();
  float humidity = dht.readHumidity();
  int airQuality = analogRead(34);
  bool motion = digitalRead(13);
  float lux = lightMeter.readLightLevel();

  if (WiFi.status() == WL_CONNECTED) {
    HTTPClient http;
    http.begin(openclaw_url);
    http.addHeader("Content-Type", "application/json");

    String payload = "{\"temperature\":" + String(temp) +
                     ",\"humidity\":" + String(humidity) +
                     ",\"air_quality\":" + String(airQuality) +
                     ",\"motion\":" + String(motion ? "true" : "false") +
                     ",\"light_lux\":" + String(lux) +
                     ",\"timestamp\":\"" + String(millis()) + "\"}";

    http.POST(payload);
    http.end();
  }

  delay(30000);  // Read every 30 seconds
}

That is the entire firmware. 40 lines. It reads all 4 sensors every 30 seconds and POSTs JSON to your OpenClaw instance.

Part 2: The GPU and Local LLM

Setting Up Ollama

On your host machine (the old laptop or mini PC), install Ollama:

curl -fsSL https://ollama.com/install.sh | sh

Pull a model that fits in 6GB VRAM:

ollama pull mistral:7b-instruct-v0.3-q4_K_M

The quantized Mistral 7B runs comfortably on a GTX 1060 6GB. Response time is 2-4 seconds. Not blazing fast. But for a home automation agent that processes sensor data every 30 seconds, it is more than enough.

Why Mistral 7B? It handles structured data well, follows instructions reliably, and the quantized version fits in 6GB. Llama 3 8B also works but is slightly slower on this GPU.

Test it:

curl http://localhost:11434/api/generate -d '{
  "model": "mistral:7b-instruct-v0.3-q4_K_M",
  "prompt": "The temperature is 28°C and humidity is 85%. Is this concerning for a home environment?",
  "stream": false
}'

If you get a response, your local LLM is working.

GPU Performance Numbers

Real numbers from my GTX 1060:

MetricValue
Model load time~8 seconds (first query)
Inference (short response)1.5-2.5 seconds
Inference (detailed analysis)3-5 seconds
VRAM usage4.1 GB / 6 GB
Power draw during inference~90W
Idle power draw~15W

The GPU costs roughly $3/month in electricity running 24/7. Compare that to cloud API costs for 2,880 inferences per day (one per 30-second sensor reading).

At $0.003 per 1K input tokens on a cloud API, you would pay $50-80/month for the same volume. The GPU pays for itself in the first month.

Part 3: OpenClaw Configuration

System Prompt for Your Home Agent

You are a home intelligence agent running on local hardware.

You receive sensor data every 30 seconds from an ESP32 with:
- Temperature (°C)
- Humidity (%)
- Air quality index (0-4095, lower is better, above 1000 is concerning)
- Motion detection (boolean)
- Light level (lux)

Your responsibilities:
1. Monitor all readings and maintain a running log
2. Alert me via webhook if anything is concerning:
   - Temperature above 30°C or below 15°C
   - Humidity above 80% or below 30%
   - Air quality above 1000
   - Motion detected between 11 PM and 6 AM (security)
   - Unusual patterns (sudden changes, sensor drift)
3. Generate a daily summary at 8 PM
4. Learn patterns over time (typical temperature curves, when I usually get home, etc.)

Use the local Ollama endpoint at http://localhost:11434 for inference.
Do NOT send any data to external services.
All processing stays local.

The Webhook Receiver

Configure OpenClaw to receive the ESP32 data via a webhook endpoint. The sensor data comes in as JSON:

{
  "temperature": 23.5,
  "humidity": 55,
  "air_quality": 342,
  "motion": false,
  "light_lux": 450,
  "timestamp": "1707580800000"
}

The agent processes each reading, decides if it needs to act, and logs everything locally.

Alert Configuration

Set up alerts via Telegram, Discord, or email. I use Telegram because it is instant:

When you detect a concerning reading, send an alert to my Telegram bot.

Format:
🔴 [SENSOR] is [VALUE] (threshold: [THRESHOLD])
Recommendation: [what to do]

For non-urgent patterns (like gradual humidity rise), use:
🟡 [DESCRIPTION]
Trend: [data over last hour]

Real alert I got last month:

🔴 Air quality is 1,847 (threshold: 1,000)
Recommendation: Open windows immediately.
Likely cause: Kitchen activity + closed windows
for 3+ hours.

Historical: Air quality has exceeded 1,000
three times this week, all between 6-8 PM.
Consider running the range hood during cooking.

My dumb smart home speaker would have just said "Air quality is poor." The agent told me what caused it, when it keeps happening, and how to prevent it.

Part 4: What I Actually Use This For

Temperature Management

The agent learned my home's temperature patterns in about a week. It knows:

  • The living room heats up 2 degrees between 2-4 PM from sun exposure
  • The bedroom stays 3 degrees cooler than the rest of the house
  • If humidity is above 70% and temperature is above 26°C, I probably need to turn on the AC

I get a message at 1:45 PM on sunny days: "Living room will likely hit 28°C by 3 PM based on current sun exposure pattern. Close the blinds now to keep it under 26°C."

That is not a thermostat. That is an agent that understands my house.

Security

Motion detection between 11 PM and 6 AM sends me an immediate alert. But the agent is smarter than a basic PIR alarm.

It knows that I usually get home between 6-7 PM. If the PIR triggers at 6:30 PM, it is probably me. If it triggers at 3 AM and there has been no door sensor activity, that is different.

After a month, the false positive rate dropped to near zero because the agent learned my patterns.

Energy Awareness

The light sensor tells the agent when lights are on. Combined with the PIR motion sensor, it knows when lights are on in an empty room.

Last month: "Lights were on in the living room for 4.2 hours with no motion detected. This happened 11 times this month. Estimated wasted energy: 6.6 kWh (~$1.50)."

Not life-changing money. But the pattern awareness is the point.

Air Quality Tracking

The MQ-135 is a cheap gas sensor. It is not lab-grade. But it reliably detects cooking fumes, cleaning products, and poor ventilation.

The agent built a baseline for my house and alerts me when readings deviate significantly. Over 3 months, it identified that my worst air quality days correlate with cooking with the windows closed and running the dryer simultaneously.

I adjusted my routine. Air quality improved noticeably.

Scaling Up

The ESP32 has plenty of GPIO pins left. Future additions I am planning:

SensorCostPurpose
Soil moisture$2Plant watering alerts
Sound level (MAX4466)$4Noise monitoring
CO2 (MH-Z19B)$15True CO2 measurement
Door sensor (reed switch)$1Entry/exit tracking
Current sensor (SCT-013)$8Real electricity monitoring

Each one is just another wire to the ESP32 and another field in the JSON payload. The OpenClaw agent adapts its system prompt and starts monitoring.

Total for the "deluxe" version: ~$230. Still less than one year of a Nest subscription.

The Privacy Argument

Everything in this setup runs locally.

  • Sensor data stays on your network
  • The LLM runs on your GPU
  • Alerts go through your chosen channel
  • No company has your home's temperature data
  • No cloud service knows when you are home or not

Big tech smart home devices send everything to the cloud. Your voice recordings. Your activity patterns. When you sleep. When you leave.

This setup: your data, your hardware, your network. Period.

Cloud Hybrid Option

If you do not want to buy a GPU, you can run the same setup with a cloud LLM. Use OpenClaw on Clawctl and point your ESP32's webhook to your Clawctl instance.

You lose the "zero cloud" purity, but you gain:

  • More powerful models (Claude, GPT-4)
  • No GPU maintenance
  • Reliable uptime without managing hardware
  • Same sensor setup, same firmware

The ESP32 + sensor part is the same either way. The only difference is where the brain lives.

Deploy OpenClaw on Clawctl for your home lab

Get Started This Weekend

Saturday morning: Order the parts (or grab them if you have a parts bin). Set up the ESP32.

Saturday afternoon: Install Ollama and pull a model. Wire the sensors and flash the firmware.

Sunday morning: Deploy OpenClaw, configure the agent, and connect the webhook.

Sunday afternoon: Everything is running. Sit back and watch your home get smarter.

Total time: 4-6 hours. Total cost: $200 or less. Monthly cost: $3 in electricity.

You do not need a $300 Nest Hub, a $200 Ring subscription, or a $500 Home Assistant server. You need an $8 ESP32, a $60 used GPU, and a good agent.

Explore the IoT skill templates

Read the ESP32 + OpenClaw quickstart guide

Ready to deploy your OpenClaw securely?

Get your OpenClaw running in production with Clawctl's enterprise-grade security.