“Can I do an AI project with ESP32?” is one of the most common questions we get from students and hobbyists. The short answer is yes – and in 2026 it is easier than ever. A modern ESP32-S3 can recognise voice commands, detect faces, classify sensor signals, and even act as the “ears and mouth” of a ChatGPT-style assistant. This guide explains the 4 practical ways to build an ESP32 AI project, which board to buy, and a complete step-by-step starter build with code.

ESP32 AI project guide: 4 ways to add AI to ESP32 and ESP32-S3
Four practical ways to build an AI project with ESP32

Which ESP32 is best for an AI project?

Not every ESP32 is equal for AI. The ESP32-S3 is the usual choice: Espressif describes it as a dual-core Xtensa LX7 running up to 240 MHz with extra vector instructions that speed up neural-network and signal-processing work (Espressif ESP32-S3 page). Espressif’s own speech library also recommends the S3 because of these AI instructions and its fast octal PSRAM support.

ChipGood for AI?Typical use
ESP32 (classic)BasicSimple TinyML on sensor data; older ESP-EYE camera examples
ESP32-C3LimitedVery small models; Wi-Fi “client” for cloud AI voice projects
ESP32-S3 (with PSRAM)Best valueVoice commands, wake words, camera face detection, TinyML, AI voice assistants
ESP32-P4Most powerfulHeavier camera vision; no built-in Wi-Fi, so boards pair it with a separate wireless chip

Buying tip: choose an ESP32-S3 module with PSRAM (for example an N16R8 variant – 16 MB flash, 8 MB PSRAM). Camera and voice models need the extra memory. Boards without PSRAM are the number-one reason student AI projects fail to run.

4 ways to add AI to your ESP32

Four ways to build an ESP32 AI project: ESP-SR voice, ESP-WHO vision, Edge Impulse TinyML, cloud LLM
The four main routes to an ESP32 AI project

1. Offline voice commands with ESP-SR

ESP-SR is Espressif’s free speech framework. It includes an audio front-end (noise and echo handling), WakeNet for wake words such as “Hi, ESP”, and MultiNet, which can recognise up to about 300 Chinese or English commands – fully offline. Typical project: “Hi ESP – turn on the fan” controlling relays, with no internet at all. You need an ESP32-S3 board with an I²S MEMS microphone.

2. Camera vision with ESP-WHO and ESP-DL

ESP-WHO is Espressif’s image-processing platform; it uses the ESP-DL deep-learning library to run models such as face detection and face recognition on the chip. Good projects: face-recognition attendance, a smart doorbell, or a “person present” sensor for lights and fans. Note that Espressif now lists the popular ESP32-S3-EYE board as end-of-life, so check stock or use another supported S3 camera board.

3. Your own TinyML model with Edge Impulse

This is the most flexible method and the best for a final-year project. You record your own sensor data (vibration, sound, gas, current), train a model online with Edge Impulse, and download it as an Arduino library or C++ library. Edge Impulse officially supports ESP32 deployments and now includes ESP-DSP acceleration automatically in its ESP32 builds (Edge Impulse ESP32 docs). The step-by-step build below uses this method.

4. ChatGPT-style AI voice assistant (cloud LLM)

ESP32 AI voice assistant architecture: wake word on ESP32-S3, speech and LLM on cloud server
In an ESP32 AI voice assistant, only the wake word runs on the chip – the “thinking” happens on a server

This is the most viral trend right now. Open-source projects such as XiaoZhi ESP32 turn an ESP32 board into a talking AI assistant using large language models like Qwen or DeepSeek, and support ESP32-C3, ESP32-S3 and ESP32-P4 boards. The ESP32 handles the wake word, microphone, speaker and display; speech recognition, the LLM and text-to-speech run on a server over Wi-Fi. It can also control devices like LEDs and relays by voice.

Be honest in your report: this is a hybrid “edge + cloud” system, not pure Edge AI. It needs a stable internet connection, uses mobile data if you run it on a SIM router, and your voice is processed on a third-party server. That makes it great for demos, but weaker for offline rural use.

Step-by-step: your first ESP32 AI project (gesture / vibration classifier)

We will build a small device that recognises 3 motion patterns – for example “idle”, “shake” and “circle” – using an ESP32-S3 and an MPU6050 accelerometer. The same steps work for detecting a faulty fan or pump from its vibration.

What you need

  • ESP32-S3 development board (with PSRAM preferred)
  • MPU6050 accelerometer/gyro module
  • Jumper wires and a USB cable
  • A laptop with Arduino IDE (ESP32 board package installed), Node.js and the Edge Impulse CLI
  • A free Edge Impulse account
ESP32 AI project wiring diagram: ESP32-S3 connected to MPU6050 over I2C
Wiring for the starter build – any free GPIO pair can be used for I²C

Step 1: Stream sensor data to Edge Impulse

Upload this sketch. It prints acceleration as comma-separated values at a fixed rate, which the Edge Impulse data forwarder can read over USB.

#include <Wire.h>
#include <Adafruit_MPU6050.h>
#include <Adafruit_Sensor.h>

Adafruit_MPU6050 mpu;
const uint32_t SAMPLE_US = 10000;   // 100 Hz sample rate

void setup() {
  Serial.begin(115200);
  Wire.begin(8, 9);                 // SDA, SCL (change to your pins)
  if (!mpu.begin()) {
    Serial.println("MPU6050 not found - check wiring");
    while (1) delay(10);
  }
  mpu.setAccelerometerRange(MPU6050_RANGE_4_G);
}

void loop() {
  static uint32_t next = micros();
  sensors_event_t a, g, t;
  mpu.getEvent(&a, &g, &t);
  Serial.print(a.acceleration.x); Serial.print(',');
  Serial.print(a.acceleration.y); Serial.print(',');
  Serial.println(a.acceleration.z);
  next += SAMPLE_US;
  while ((int32_t)(micros() - next) < 0) { }   // keep a steady rate
}

Then, in a terminal, run edge-impulse-data-forwarder, log in, and name the axes accX, accY, accZ. Your board now appears under Devices in your Edge Impulse project.

Step 2: Record and label data

  • Record about 2–3 minutes of each class (“idle”, “shake”, “circle”) in 10-second samples.
  • Record in different positions and by different people – variety makes the model robust.
  • Keep about 20% of the data as a test set.

Step 3: Train the model

  1. Create an impulse with a 2-second window, a Spectral Analysis processing block and a Classification learning block.
  2. Train, then check accuracy on the test set. Above about 90% is a good start for 3 clear motions.
  3. If accuracy is low, collect more varied data before changing the model.

Step 4: Deploy to the ESP32 and run it

Go to Deployment, choose Arduino library, build, and add the downloaded ZIP in the Arduino IDE (Sketch → Include Library → Add .ZIP Library). Then replace your sketch with this one. Change the #include line to match your project name.

#include <Wire.h>
#include <Adafruit_MPU6050.h>
#include <Adafruit_Sensor.h>
#include <esp32_gesture_inferencing.h>   // name comes from your Edge Impulse project

Adafruit_MPU6050 mpu;
static float buffer[EI_CLASSIFIER_DSP_INPUT_FRAME_SIZE];

void setup() {
  Serial.begin(115200);
  Wire.begin(8, 9);
  if (!mpu.begin()) { Serial.println("MPU6050 not found"); while (1) delay(10); }
  mpu.setAccelerometerRange(MPU6050_RANGE_4_G);   // same setting as when collecting data
}

void loop() {
  // 1. Fill one window with x, y, z samples at the trained rate
  for (size_t i = 0; i < EI_CLASSIFIER_DSP_INPUT_FRAME_SIZE; i += 3) {
    uint32_t next = micros() + (uint32_t)(EI_CLASSIFIER_INTERVAL_MS * 1000);
    sensors_event_t a, g, t;
    mpu.getEvent(&a, &g, &t);
    buffer[i + 0] = a.acceleration.x;
    buffer[i + 1] = a.acceleration.y;
    buffer[i + 2] = a.acceleration.z;
    while ((int32_t)(micros() - next) < 0) { }
  }

  // 2. Run the model
  signal_t signal;
  numpy::signal_from_buffer(buffer, EI_CLASSIFIER_DSP_INPUT_FRAME_SIZE, &signal);
  ei_impulse_result_t result;
  if (run_classifier(&signal, &result, false) != EI_IMPULSE_OK) return;

  // 3. Print the most likely class
  size_t best = 0;
  for (size_t ix = 1; ix < EI_CLASSIFIER_LABEL_COUNT; ix++) {
    if (result.classification[ix].value > result.classification[best].value) best = ix;
  }
  Serial.printf("%s (%.2f)  dsp %d ms, nn %d ms\n",
                result.classification[best].label,
                result.classification[best].value,
                result.timing.dsp, result.timing.classification);
}

Open the Serial Monitor at 115200 baud and move the board – you should see the detected gesture and the processing time in milliseconds. From here, drive a relay, an LED or send the result to a dashboard over Wi-Fi.

Which ESP32 AI method should you choose?

MethodInternet neededDifficultyBest for
ESP-SR voice commandsNoMedium (ESP-IDF)Offline voice-controlled switches and appliances
ESP-WHO camera visionNoMedium–HardFace detection/recognition, attendance, doorbell
Edge Impulse TinyMLNo (only for training)Easy–MediumCustom sensors, fault detection, final-year projects
Cloud LLM voice assistantYesEasy (pre-built firmware) to Hard (custom)Talking assistants, smart-home demos

For a final-year project we recommend method 3 (or 1) because you collect your own data and can show real results – accuracy, inference time and power. Method 4 is impressive in a demo but you did not build the “AI” part yourself, and examiners often ask about that.

Common problems and fixes

ProblemLikely causeFix
Board resets when model or Wi-Fi startsWeak USB supply / brownoutUse a good cable and 5 V supply; add a 470–1000 µF capacitor near the 3.3 V regulator
“Out of memory” or model fails to loadNo PSRAM or PSRAM disabledUse an S3 module with PSRAM and enable it in Arduino Tools or menuconfig
Good accuracy in Edge Impulse, poor on the boardDifferent sample rate or sensor rangeUse exactly the same rate and range when collecting and when running
Voice commands not recognisedMic wiring, gain or noisy roomCheck I²S pins, keep the mic away from the speaker and fans
Sketch too largeSmall flash partitionChoose a larger partition scheme (e.g. “Huge APP”) in Tools

For general board debugging, see our guides on troubleshooting a dead circuit board and testing components with a multimeter. Cheap modules can also be counterfeit – read how to spot fake electronic components.

ESP32 AI project ideas to try next

  • Bangla voice-controlled home switch board (ESP-SR or Edge Impulse keyword spotting)
  • Pump or motor fault detector using vibration (the starter build above, on a real motor)
  • Face-recognition attendance system for a classroom (ESP-WHO)
  • Baby-cry or doorbell sound alert to your phone
  • A desk AI assistant that also switches your room lights (XiaoZhi-style)

For 15 more ideas with difficulty levels, read 15 Edge AI & TinyML Final-Year Project Ideas for 2027, and for classic topics see Final-Year EEE Project Ideas for Students in Bangladesh. To see ESP32 in a real product, check our solar-powered ESP32 Water ATM controller.

Frequently asked questions

Can a normal ESP32 (not S3) run AI?

Yes, for small sensor models (TinyML) it works. For camera vision and voice wake words, the ESP32-S3 is much better because of its vector instructions and PSRAM support.

Can ESP32 run ChatGPT itself?

No. A large language model is far too big for any microcontroller. In ESP32 “ChatGPT” projects the ESP32 records and plays audio and talks to a cloud server, which runs the language model.

Do I need to know Python or machine learning first?

Not for a first project. Edge Impulse handles training in the browser. Basic Arduino C/C++ is enough. Learning the basics of features, overfitting and test accuracy will help you in the viva.

Arduino IDE or ESP-IDF?

Start with Arduino IDE for Edge Impulse projects. Use ESP-IDF for ESP-SR, ESP-WHO and XiaoZhi, as their examples are built for it.

Want an ESP32 AI project built or need help debugging yours? We design custom PCBs, firmware and complete working prototypes for students and companies. Message us on WhatsApp or use the contact form. You can write in Bangla or English.


MKDas

Mithun K. Das. B.Sc. in Electrical and Electronic Engineering (EEE) from KUET. Senior Embedded Systems Designer at a leading international company. Welcome to my personal blog! I share articles on various electronics topics, breaking them down into simple and easy-to-understand explanations, especially for beginners. My goal is to make learning electronics accessible and enjoyable for everyone. If you have any questions or need further assistance, feel free to reach out through the Contact Us page. Thank you for visiting, and happy learning!

0 Comments

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *