Editor’s desk

On-Device Vision Without Writing Model Code: Face Detection on the XIAO ESP32S3 Sense article cover

On-Device Vision Without Writing Model Code: Face Detection on the XIAO ESP32S3 Sense

With the SenseCraft AI web tool, a thumb-sized XIAO ESP32S3 Sense camera board can run a face detection model on the chip and send results over GPIO, serial or MQTT, with no cloud needed for the detection itself.

Most camera projects send every image to a server for analysis. That costs bandwidth, adds delay and raises privacy questions. A different approach is to run a small vision model on the camera board itself, and only send the result: a face is here, at this position, with this confidence.

The Seeed Studio XIAO ESP32S3 Sense is a very small ESP32-S3 board with a detachable camera and microphone. Seeed's SenseCraft AI platform lets you deploy pre-trained models to it from a web browser. With this setup, face detection can run fully on the board, with a live video preview and results sent out over GPIO or MQTT, and no machine learning code to write.

This guide explains how it works, what you need, how to set it up and how to take it further with an AI coding tool.

How it works in plain words

A vision model is a set of numbers that has learned to recognise patterns in images. A small model can be squeezed down to fit on a microcontroller. It is less accurate than a large model on a server, but it is fast enough for simple jobs such as finding faces or people.

SenseCraft AI keeps a library of these models. When you pick one and click deploy, the web page connects to your board over USB, downloads the model to the board and starts it. From then on, the board takes a picture, runs the model and produces a list of detections, each with a box and a confidence score.

You then choose what the board does with that result.

GPIO output sets a pin high or low when a face is found or not found. This is the simplest option, and it can switch an LED, a buzzer or a relay. It only tells you yes or no.

Serial output sends the full details, such as how many faces, where they are and with what confidence, over UART, I2C or SPI. You need a second microcontroller to read and act on it.

MQTT output sends the results over Wi-Fi to an MQTT broker, which is a small message server. Home automation systems such as Home Assistant can read from a broker, which makes this the natural choice for smart home projects.

What you need

A XIAO ESP32S3 Sense board with its camera attached.

A USB-C data cable.

A computer with a Chrome-based browser, since the deployment uses the browser's serial connection.

For MQTT, a broker. You can run your own, such as Mosquitto on a home server, or use a public test broker while learning. A desktop MQTT client such as MQTTX helps you see the messages.

Step by step

Open SenseCraft AI in your browser and find the Face Detection model. Filter the list for the XIAO ESP32S3 Sense.

Click deploy, connect the board and choose its serial port when the browser asks. The model upload takes a minute or two.

When the upload finishes, a preview opens with live video from the board and boxes drawn around any faces. Move around and see how it reacts to distance, angle and light.

Open the output settings. For a first test, use GPIO and wire an LED through a resistor to the chosen pin, so the LED lights when a face is seen.

Then try MQTT. Enter your Wi-Fi details, the broker address and port, and a client ID. In your MQTT client, subscribe to the topic shown in Seeed's guide, then trigger an inference and watch the result arrive as a message.

Adding your own logic with an AI coding tool

The no-code part ends at the output. What happens next is up to you, and that is where an AI coding tool earns its keep.

If you use MQTT, ask an agent to write a small Python script that subscribes to the topic, reads the detection message and does something with it: logs visits with a timestamp, sends a phone notification when a face appears after midnight, or counts how many times people pass a door.

If you use serial output, ask the agent to write Arduino code for a second board that reads the detection data and drives a servo to point at the face, or shows the count on a small screen. Give it the exact format of the data, which you can copy from the serial monitor.

If you use Home Assistant, ask the agent to write an MQTT sensor configuration and a simple automation, such as turning on a hallway light when a face is detected at night.

In each case, paste a real sample message into the prompt. Agents guess message formats badly. A real example removes the guesswork.

Pitfalls

Lighting. Small models struggle in dim or backlit scenes. Test in the real spot where the camera will live, at the times it will be used.

Confidence thresholds. A low threshold gives false alarms. A high one misses real faces. Adjust the threshold in the settings and log results for a day before you trust it.

Heat and power. Running a camera and a model continuously warms the board and drains batteries. For battery projects, trigger detection only when needed, for example with a motion sensor.

Privacy and the law. Detecting faces is not the same as recognising who someone is, but a camera pointed at shared spaces still affects people. Tell others in your home, do not point it at neighbours or public paths, and check local rules about cameras.

Public brokers. A public MQTT test broker can be read by anyone who guesses your topic. Use your own broker with a password for anything real.

Variations

Swap the model. The library includes other detection and classification models, and you can upload or train your own, for example to spot a pet, a parcel at the door or a full bin.

Save images to an SD card when a detection happens, using the trigger actions.

Combine with a voice assistant, so the device greets someone when a face appears.

Move to a board with a screen, or to Seeed's larger vision devices, when you need more power.

The short version

The XIAO ESP32S3 Sense can run a face detection model on the board itself, deployed from the SenseCraft AI web page with no machine learning code. Results can go out as a simple pin signal, as detailed serial data or as MQTT messages for home automation. Test in real lighting, tune the confidence threshold, use your own MQTT broker, respect the privacy of the people the camera sees and use an AI coding tool to write the small scripts and automations that turn detections into actions.