Open Claw
中文
· OpenClaw Team

How to Build a $5 AI Assistant with ESP32 — Complete Guide

Building your own AI assistant used to require expensive hardware, cloud subscriptions, and complex software stacks. With OpenClaw and a $5 ESP32-C3 board, you can have a fully functional AI agent running on your desk in under 30 minutes.

This guide walks you through the entire process — from buying the parts to having a working AI assistant that can read sensors, control devices, and chat with you over Telegram.

What Makes This Different from ChatGPT?

ChatGPT runs in the cloud and talks through a web browser. Your ESP-Claw agent runs on a physical device in your home, and it can do things in the real world:

  • Read the temperature and humidity in your room
  • Turn lights on and off via MQTT or IR
  • Control servo motors to open curtains
  • Set timers and reminders
  • Send you Telegram messages proactively

The AI isn’t just answering questions — it’s an agent that uses tools to interact with the physical world. When you say “it’s hot in here,” it doesn’t just tell you the temperature — it checks the sensor, then sends an IR command to turn on your AC.

Bill of Materials

Here’s everything you need. Total cost: under $8 for the basic setup, under $15 for the full experience.

Essential (Under $5)

ComponentPurposePriceWhere to Buy
ESP32-C3 SuperMiniMain processor~$2.00AliExpress, Amazon
USB-C data cablePower and programming~$1.00Most people have one
BreadboardPrototyping~$1.50AliExpress, Amazon
Jumper wires (10 pack)Connections~$0.50AliExpress, Amazon

Optional Peripherals

ComponentPurposePrice
DHT22 sensorTemperature and humidity~$2.00
SG90 servo motorPhysical movement~$1.50
SSD1306 OLED (128x64)Status display~$2.50
IR LED + receiverAC and TV remote control~$0.50
Passive buzzerAudio alerts~$0.30

Step 1: Prepare Your Board

The ESP32-C3 SuperMini is a tiny development board — roughly the size of a postage stamp. It has:

  • 32-bit RISC-V processor at 160 MHz
  • 400KB SRAM (no external PSRAM needed)
  • Wi-Fi 2.4GHz and Bluetooth 5.0
  • USB-C connector for power and programming
  • 13 GPIO pins for connecting sensors and actuators

When you receive the board, inspect it for any obvious damage. The USB-C port should be firmly attached, and all components should be cleanly soldered.

Install USB Drivers (If Needed)

Most modern operating systems recognize the ESP32-C3 automatically. If your computer doesn’t detect the board:

Windows: Download and install the CH340 driver from the manufacturer’s website. After installation, the board should appear as a COM port in Device Manager.

macOS: macOS Sequoia and later include built-in support. For older versions, install the CH340 driver. After installation, you may need to allow it in System Preferences → Security & Privacy.

Linux: The driver is included in the kernel. Run ls /dev/ttyACM* to find the device. You may need to add your user to the dialout group: sudo usermod -a -G dialout $USER.

Step 2: Flash the Firmware

The easiest way to flash is our browser-based tool. No software installation required.

  1. Open Chrome or Edge (version 89 or later)
  2. Navigate to the Install page on our website
  3. Select “ESP32-C3” as your board type
  4. Click “Connect & Flash”
  5. In the browser popup, select your USB device
  6. Wait approximately 30 seconds for the flash to complete

The progress bar will show three stages: erasing the old firmware, writing the new firmware, and verifying the write was successful.

What If the Flash Fails?

The most common issue is the board not entering download mode. Here’s how to fix it:

  1. Hold down the BOOT button on the board (the small button, not the reset button)
  2. While holding BOOT, click “Connect” in the browser
  3. Release the BOOT button after the connection is established
  4. Click “Flash” to start the process

If you’re still having trouble, try a different USB cable. Cheap cables often only carry power, not data. A cable that works for file transfer on your phone will work here.

Step 3: Configure Wi-Fi

After a successful flash, the ESP32 will restart and create a Wi-Fi hotspot called “ESPClaw-XXXX” (where XXXX is a unique identifier).

  1. On your phone or laptop, connect to this hotspot
  2. A captive portal page should open automatically
  3. If it doesn’t open, navigate to http://192.168.4.1 in your browser

On the configuration page:

  1. Select your home Wi-Fi network from the dropdown
  2. Enter the Wi-Fi password
  3. Choose your AI provider (Claude API recommended for best results)
  4. Enter your API key
  5. Click “Save and Restart”

The board will restart and connect to your Wi-Fi network. The built-in LED will blink three times to confirm a successful connection.

Step 4: Set Up Telegram

Telegram is the recommended communication channel because it’s free, fast, and works on all platforms.

Create a Telegram Bot

  1. Open Telegram and search for “@BotFather”
  2. Send the command /newbot
  3. Choose a name for your bot (e.g., “My Home AI”)
  4. Choose a username (must end in “bot”, e.g., “myhome_ai_bot”)
  5. BotFather will give you an API token — copy it

Connect the Bot to ESP-Claw

  1. Open the ESP-Claw configuration page (the IP address was shown in the serial monitor, or check your router’s connected devices)
  2. Go to “Channels” section
  3. Paste your Telegram bot token
  4. Click “Save”

Now send a message to your bot on Telegram. You should receive a response within 1-2 seconds.

Step 5: Connect a Temperature Sensor

Let’s add a DHT22 temperature and humidity sensor so your AI can monitor the environment.

Wiring

Connect the DHT22 to your ESP32-C3:

DHT22 PinESP32-C3 PinWire Color
VCC (pin 1)3.3VRed
Data (pin 2)GPIO 4Yellow
GND (pin 4)GNDBlack

Note: Pin 3 on the DHT22 is not connected. If you’re using a DHT22 module (the blue PCB version), it only has 3 pins and includes the pull-up resistor. If you’re using the bare sensor, add a 10K ohm pull-up resistor between VCC and Data.

Test It

Send a message to your Telegram bot: “What’s the temperature?”

The AI will automatically call the dht_read tool, read the sensor, and respond with something like: “It’s currently 24.5°C with 52% humidity. Comfortable conditions!”

Step 6: Customize Your AI’s Personality

The personality of your AI agent is defined in a file called SOUL.md. This is just a Markdown file that tells the AI how to behave.

The default personality is a helpful home assistant, but you can change it to anything you want. Access the configuration page and edit the SOUL.md section:

# My AI Butler
You are a British butler named Jeeves, running on an ESP32
in the living room. You are impeccably polite and slightly
witty.
## Communication Style
- Always address the user as "Sir" or "Madam"
- Use formal British English
- Include subtle humor when appropriate
- Never use emoji
## When monitoring temperature
- Below 18°C: Suggest turning on the heating
- Above 26°C: Suggest cooling measures
- Always mention the humidity if it's above 70%

Save the file and the AI will immediately adopt the new personality. No reflashing required.

What You Can Do Next

Now that you have a working AI assistant, here are some ideas to explore:

Add more sensors: BME280 for barometric pressure, PIR for motion detection, or a light sensor for ambient brightness. Each sensor you add gives the AI more awareness of its environment.

Control your home: Connect a relay module to control lights, or use an IR LED to control your AC and TV. The AI can learn your preferences and suggest actions proactively.

Create automation rules: If you’re using WireClaw firmware, you can set up rules like “if temperature exceeds 28°C and I’m home, turn on the AC automatically.”

Build an enclosure: Design a 3D-printed case for your setup. The community has shared several designs for different sensor configurations.

Troubleshooting Common Issues

Bot doesn’t respond: Check that the ESP32 is connected to Wi-Fi (LED should be solid, not blinking). Verify the API key is correct. Check your API provider’s dashboard for any quota issues.

Sensor readings seem wrong: Ensure the wiring is correct and connections are firm. DHT22 sensors need a few seconds to stabilize after power-on. Try reading the sensor again after 30 seconds.

High latency responses: Response time depends on your AI provider. Claude Haiku is fastest (~0.5-1s). If latency is consistently high, check your Wi-Fi signal strength. The ESP32 should be within reasonable range of your router.

Wi-Fi disconnects: The ESP32-C3 only supports 2.4GHz Wi-Fi. Make sure your router has 2.4GHz enabled. Some mesh networks automatically steer devices to 5GHz, which won’t work.

Cost Breakdown

Let’s be completely transparent about the costs:

ItemOne-time CostRecurring Cost
ESP32-C3 board$2.00
USB cable$1.00
DHT22 sensor$2.00
Breadboard + wires$2.00
Claude API usage~$0.50/month
Electricity (0.5W 24/7)~$0.05/month
Total$7.00~$0.55/month

That’s a fully functional, private, customizable AI assistant for the price of a coffee.