Download PDF Parts List View on YouTube Download Code

Today, we will look at the smallest ESP32 Camera board yet, the Seeeduino XIAO ESP32S3 Sense board.

Introduction

Adding cameras to projects used to be the domain of microcomputer boards, like the Raspberry Pi. While you could buy cameras that attach to the Arduino, these were intended for taking still images and not streaming video.  Microcontrollers were simply not powerful enough to handle the volume of data and the data rates required for streaming video.

That changed in 2016 when Espressif released the ESP32 chip, a successor to its popular ESP8266 module. This powerful 32-bit microcontroller had performance specifications that were light-years ahead of its 8-bit predecessors. And it also had the speed and memory that allowed it to process video.  

A little over a year after the release of the ESP32, a company named Ai Thinker released the ESP32-CAM board.  At only 9 US dollars, this little camera was perfect for hobby electronics and implementing inexpensive surveillance systems. It even had a MicroSD card holder and a white “flash” LED, despite its low price.  It did not have a USB port, however, so an external FTDI adapter was required to program it (these days, it is often sold with a USB adapter board).

Other ESP32-based camera boards from other manufacturers followed the ESP32-CAM.  Espressif themselves came up with the ESP-EYE, a small ESP32-based camera board with an integrated microphone.

Espressif added a sample sketch called “CameraWebServer” to the ESP32 samples; this little gem allowed users to use the camera with a full-featured interface. The interface provides an impressive number of controls for the camera, as well as the ability to stream video and do simple face recognition.

These days, there are a variety of ESP32 camera boards from several manufacturers, each sporting a slightly different set of features. Today, we will look at one of the newest ones, the tiny Seeeduino XIAO ESP32S3 Sense board.

XIAO ESP32S3 Sense

The Seeeduino XIAO ESP32S3 Sense board actually consists of two separate boards:

  • The Seeeduino XIAO ESP32S3 board. This board is also available separately. It includes the microcontroller, two LEDs, a USB-C connector, and two of the smallest pushbutton switches you have ever seen!
  • The Camera module. This plugs into the top of the XIAO board. Along with the camera, it includes a microphone and a MicroSD card holder.

The XIAO ESP32S3 board has a USB-C connector for both power and data transfer, and it shares the same footprint and connections as the other boards in the growing Seeeduino XIAO family of microcontrollers.

Seeeduino XIAO Family

The Seeeduino XIAO boards are tiny microcontrollers built on small printed circuit boards that feature castellated pin connectors, allowing them to be used with conventional Dupont pins or as a surface-mount device.

You might remember the original XIAO board, as it was reviewed here in the DroneBot Workshop when it was first released. I have also used it in a couple of projects and demos.  It’s a powerful yet inexpensive board based on the SAMD21 microcontroller.

Well, the family has really grown since then, and as of this writing, the headcount at the XIAO dinner table is as follows:

  • XIAO SAMD21 – The original board featuring a SAMD21 Cortex-M0+ processor running up to 48 MHz.
  • XIAO RP2040 – Runs an RP2040 Dual-core Cortex-M0+ processor, running up to 133 MHz.
  • XIAO nRF52840 – Ultra-low-power Bluetooth device. Cortex-M4 running up to 64 MHz.
  • XIAO nRF52840 Sense – Advanced version of nRF52840 with microphone and IMU.
  • XIAO ESP32C3 – ESP32 RISC-V running up to 160 MHz, with Bluetooth and WiFi.
  • XIAO ESP32S3 – Dual-core Xtensa LX7 running up to 240 MHz.
  • XIAO ESP32S3 Sense – The XIAO ESP32S3 with a camera and microphone module.

Seeed Studio also has several prototyping accessories made for the XIAO, and these can be used with any of the XIAO boards.

XIAO ESP32S3 Sense Specifications

The Seeeduino XIAO ESP32S3 Sense board has the following specifications:

  • Processor – ESP32-S3R8 Xtensa LX7 dual-core  @ 240MHz maximum speed
  • WiFi – 2.4 GHz
  • Bluetooth – BLE: Bluetooth 5.0, Bluetooth mesh
  • Memory – 8Mb PSRAM & 8Mb Flash
  • GPIO – 11 I/O ports
  • ADC – 9 channels
  • Touch switches – Nine touch switch pins.
  • Interface – UART, SPI, I2C & I2S
  • Dimensions – 21 x 17.5 mm
  • Camera – OV2640 1600*1200 sensor
  • Microphone – MSM261D3526H1CPM MEMS Microphone
  • MicroSD – 32 GB maximum, FAT32 Formatted

The XIAO board is a castellated pin design that can be surface mounted or used with male or female Dupont pins. The pins are not included in the package with the board.

A stick-on antenna is included with the board in the traditional Seeed Studio XIAO packaging.

XIAO ESP32S3 Sense Pinouts

The XIAO ESP32S3 Sense consists of two boards: the main board and the camera/microphone/MicroSD board.

Here is the top view of the main board:

Note the two pushbuttons; they are minuscule! They can be used to reset the board or to enter bootloader mode.

The XIAO board also has two LED indicators:

  • Red – Power and battery charge monitor.
  • Amber – User LED, the equivalent of LED_BUILTIN. Note that this LED is illuminated when the input is LOW, which is backward from most Arduino boards.

Here are the pinouts for the main board:

Note that all the I/O pins have multiple purposes and can be addressed either by the Arduino designation or the ESP32 GPIO number.

The 5-volt power pin can be either an input or an output:

  • Input – 5-volts to power the XIAO. This must be applied through a Schottky diode to isolate the power supply from the USB-C voltage.
  • Output – If USB-C powered, then this pin can be used as a 5-volt output. Note that this voltage is not present when powering the board with a battery.

The 3.3-volt pin is an output-only that can be used to power sensors.  It cannot be used as an input to power the board!

There are additional connections on the underside of the board:

These points provide connections to several of the USB-C pins, plus some of the connections on the board-to-board connector. The solder pads for connecting the battery are also located here.

Camera Board Connections

The camera board has two additional GPIO connections, as illustrated here:

XIAO ESP32S3 Sense vs. ESP32-CAM

Here is a comparison between the Seeeduino XIAO ESP32S3 Sense board and the AI Thinker ESP32-CAM board:

Note that on just about every point, the XIAO meets or exceeds the ESP32-CAM board. The exception is the white “flash” LED on the ESP32-CAM that is not present on the XIAO.

The ESP32-CAM can also be used with an internal or external antenna, while the XIAO can only be used with an external one.

Incidentally, the antenna provided with the XIAO is functional, but just barely. You will do much better by replacing it with another 2.4 GHz antenna with a U.FL connector.

Getting Started with the XIAO ESP32S3 Sense

After opening the XIAO package and examining its contents, you may want to solder some pins to your new microcontroller. This will make it easier to experiment with using a solderless breadboard.

Once you do that, you can move to your computer to set up your Arduino IDE.

Arduino IDE Setup

The Seeeduino XIAO ESP32S3 Sense board does not require a new boards manager JSON file, as the board is already included with the latest version of the ESP32 Boards Manager.  

Connect your XIAO to your computer via the USB-C connection. Now, see if the Arduino IDE identifies it correctly.  If it doesn’t (it will likely find another ESP32S3 board), then do a manual search for it; you should find “XIAO ESP32S3”.  If you can’t find the XIAO, then you probably need to update your boards manager.

There is one more step required after you select the correct board. You need to set the IDE PSRAM option to “OPI PSRAM”.  Do that by selecting the Tools menu, then scrolling down to PSRAM.  If it is currently disabled, then select OPI PSRAM.

The Arduino IDE is now properly set up for the Seeeduino XIAO ESP32S3 Sense board.

Reloading the Bootloader

One thing I experienced a few times when programming the XIAO is that the board would occasionally refuse to accept new programming. This usually occurred after I uploaded a program that didn’t work how I wanted it to!

To resolve this issue, you need to reload the bootloader. This is pretty simple, at least if you have small hands.

  • Unplug the USB-C cable.
  • Hold down the ultra-tiny Boot button (it has a small “B” beside it)
  • Insert the USB-C cable.
  • Release the button.

I used a pointer from my tablet to do this, you’ll probably need something tiny and non-conductive unless you have very small fingernails!

After doing this, try loading a simple sketch like “Blink” to see if all is well.

CameraWebServer Demo

The “Hello World” of ESP32-based cameras is the CameraWebServer sketch. It is included in the Examples files packaged with the ESP32 boards manager, under the WiFi section.

CamearWebServer runs a full-featured camera interface that can be used to control the camera as a still or streaming device. You can adjust pretty well every parameter, and can also use this application to save images to the MicroSD card.

There are two changes you need to make to this sketch before you upload it.

  • The camera type needs to be CAMERA_MODEL_XIAO_ESP32S3.  This model needs to be included in your camera_pins.h file.
  • You need to supply your SSID and Password for your WiFi network. 

If you have an older version of CameraWebServer that does not include the XIAO, you can use the copy included in the ZIP file with today’s code downloads.

Once you have it loaded, give it a try. Start it up, and look in your Serial Monitor for a URL, which consists of an IP address assigned by your wireless router. Then, go to a computer or tablet connected to that same wireless network and type in that address.

You should see the CameraWebServer main screen. Experiment with the controls. You must start the stream manually; it does not start automatically.

The camera performance is on par with the ESP32-CAM, which makes sense as both boards use the same 2 MP sensor.

Voice Recording Camera

Today, we will perform an experiment, one that could be reworked into a practical project.

We are going to use the XIAO as a still-image camera. The camera will save its images on the MicroSD in JPEG format.

After the image has been saved, the XIAO will record 10 seconds of sound and then save it as a WAV file to the MicroSD card.  You can adjust this time if you wish.

The whole thing will be activated by touching one of the touch switches.

Hooking up the XIAO

The ”hookup” for this project is extremely simple. All you need to do is attach a touch switch of sorts to the first pin, TOUCH1. 

The touch switch can be as simple as a piece of hookup wire on the solderless breadboard. This is how I set mine up:

Technically, you don’t need to solder any pins to the XIAO, but it probably will be easier to experiment with if you do.

Preparing the MicroSD Card

The MicroSD card must be 32GB or less; you can use a larger card, but the extra storage space will be ignored.

The card needs to be formatted with FAT32. If yours isn’t, you’ll need to reformat it, losing all the existing data it holds.  The Microsoft Windows File Manager is the easiest way to format the card. The Mac Disk Utility can also do this.

Many smaller MicroSD cards come formatted in FAT32 from the factory, so you may not have to do anything. 

Insert your formatted MicroSD card into the holder on the XIAO ESP32S3 Sense board. Ensure the camera board is mounted securely on the main board, and plug in the USB-C connection to your computer.

Voice Recording Camera Sketch

Our sketch will use a number of libraries to interface with the devices on the Sense board.

OV2640 Camera Module

The camera module will use the ESP32 Camera library. This was installed when you installed your ESP32 Boards Manager.

MSM261D3526H1CPM MEMS Microphone

This microphone module has an I2S interface, so we will use the I2S library to work with it.  This is another library that was packaged with the ESP32 Boards Manager.

MicroSD Card

We will need three libraries to work with the MicroSD card. The SPI library is used, as the MicroSD has an SPI interface. The FS library handles the file system, which we need to create and store files. And the SD library handles the SD card itself.

XIAO-Camera-Microphone-SD Sketch

Now, here is the sketch that we will use for the “voice recording camera” demo:

The sketch includes the two files camera_pins.h and camera_index.h. These are the same files included with the CameraWebServer sketch, defining the camera connections and capabilities.

We start by including the required libraries. Next, we define the camera model and pins.

Line 25 sets the audio recording time in seconds; you can change this if you wish.  In the following lines, we also define a number of audio parameters; you can adjust the VOLUME_GAIN, but it is best to leave the others alone.

Next, we define some status variables for the camera and MicroSD card. We also set up a counter variable; this will be used to create a unique file name.

Line 43 has the threshold for the touch switch sensitivity. It should be fine, but if you experience erratic touch switch operation, you can adjust it.

Next, we define a number of functions:

  • photo_save – Save images to the MicroSD card. You need to provide a filename.
  • writeFile – Writes an image to the card. Called from within photo_save.
  • record_wav – Records a WAV file and writes it to the MicroSD card.  You need to provide a filename.
  • generate_wav_header – Create the WAV header for the audio file.
  • gotTouch1 – The callback function for the touch switch. Activated every time the switch is touched.
  • CameraParameters – Sets a number of camera parameters. Used in Setup.

In Setup, we start the serial monitor. We will use this to monitor the image and sound recording process.  As we require the serial monitor, we wait until it has started before proceeding.

Next, we set up I2S for the microphone.  We then attach the touch switch interrupt to the interrupt handler gotTouch1.

In the following line, we call the function that loads the camera parameters. If all is OK we set our camera status to true.

We then initialize the MicroSD card and set its status as well.  After that, we print out the MicroSD card type. This isn’t really necessary, but it does serve to illustrate how to work with the SD library.

Now to the Loop!

We start the Loop by checking the status of both the camera and MicroSD card. Assuming they are both good, we check the touch1detected variable, whose status will be set by the callback function.

If we find the variable has been set, then it’s time to spring into action! First, we create an image filename, using the counter variable to make it unique. We use this with the photo_save function to take our image and store it on the MicroSD card.

We then do the same thing for audio, generate a filename, and use the record_wav function to save it to the MicroSD card.

Finally, we increment the file count and exit. We finish the Loop and start again.

Voice Recording Camera Demo

The most challenging part of running the demo is mounting the camera into position. The XIAO ESP32S3 Sense has the camera module floating, attached solely by its short cable.  While the ESP32-CAM has a similar arrangement, that board has a larger MicroSD card shell, and most people just use double-sided tape to hold down the camera. On the Seeeduino board, this could be done, but it is somewhat awkward and would bend the ribbon cable.

After you figure out the mounting, ensure that the camera module is seated correctly and that a FAT-32 formatted MicroSD is installed. Then, load the sketch.

Aim the camera and touch your “touch switch.” The amber LED will briefly flash, and the serial monitor will display the progress. First, the image file will be written, and then the 10-second recording will begin. After the recording finishes, a WAV file will be saved to the MicroSD card.

Try a few more images; you should see the file name increment each time. 

When you are done, power down the XIAO and pull out the MicroSD card. Now, insert it into a reader on a computer and view the contents. You should see matching image and sound files, each with the same name.

Most computers have applications to view images and play WAV files. I used the open-source audio editor Ocenaudio to play back the files. As the images and audio files share the same name, Ocenaudio displays the images as thumbnails for the sound files. 

Camera Upgrade

It is possible to upgrade the 2MP camera included with the XIAO ESPO32S3 Sense board to a 5MP model. This will result in better image quality, as the larger sensor is capable of HD video at 30fps.

Seeed Studio sells an upgrade kit that contains an OV5640 5MP sensor.

OV5640 Camera

The OV5640 by Omnivision is an improved version of the OV2640 module included with the Sense board.  It has a 5-megapixel CameraChip sensor and sports an array of 2592 x 1944 pixels.

One big feature of this camera is its low-light sensitivity, assisted by the sensor’s internal backlighting. 

The camera also has a voice-coil motor to move the lens for autofocusing applications.  However, despite advertising the camera as an “autofocusing camera,” Seeed Studio has provided no information for using it.

Camera Installation

Installation of the camera is quite simple.

  • Remove the camera board from the XIAO Sense main board.
  • Using a small screwdriver, pry up the black top of the camera connector. It should lift like a small “door.”
  • Remove the 2MP camera module. Keep it handy for other experiments.
  • Insert the ribbon cable from the new 5MP module. Make sure to keep the conductive side of the cable facing down, and ensure it is seated all the way forward in the connector.
  • Close the “door” on the connector.

This completes the installation.

Testing the Upgraded Camera

Once again, we can rely on the CameraWebServer sketch to test our camera.

You do not need to change any configuration settings when running CameraWebServer, as it will detect the OV5640 and set itself up for it. When you run the sketch and view it in a web browser, you should see the name “OV5640” in the top browser bar. This confirms that the camera is being properly recognized.

One idiosyncrasy I noticed right away is that the camera’s horizontal axis is reversed, causing everything to have a “mirror-image” appearance.  You can use the “Horiz Mirror” slider in CameraWebServer to correct this.

The camera does indeed have a better image, as would be expected. However, I could not get the autofocus to work on its own or by using the ESP32 OV5640 Autofocus library.  I tried contacting Seeed Studio for more autofocus information, but as of this writing, they have not responded.

The camera upgrade is packaged with two heatsinks, and I advise you to use the larger one on the back of the module. If you are streaming video, the OV5640 module gets very hot.

Conclusion

This tiny little package really does pack a lot of power, and for fourteen US dollars, it is an excellent deal.  If you don’t require the camera, microphone, and SD card, you can buy the XIAO ESP32S3 board on its own for $7.49, making it one of the least expensive ESP32S3 boards out there.

The camera upgrade may or may not be worth it, depending upon your intended use. For still images, it would be a good addition. The streaming video runs very warm, so plan on dealing with the extra heat.

Overall, this is an excellent little package that has a lot of advantages over the older ESP32-CAM board. Pick one or two up to add to your microcontroller toolbox!

Parts List

Here are some components you might need to complete the experiments in this article. Please note that some of these links may be affiliate links, and the DroneBot Workshop may receive a commission on your purchases. This does not increase the cost to you and is a method of supporting this ad-free website.

Seeeduino XIAO ESP32S3 Sense   Seeed Studio

Seeeduino XIAO ESP32S3 Sense   Digikey

OV5640 Camera Upgrade Seeed Studio

OV5640 Camera Upgrade Digikey

 

Resources

Code Samples – All the code used in the article in one easy-to-use ZIP file!

Article PDF – A PDF version of this article in a ZIP file.

XIAO ESP32S3 Sense Wiki – Seeed Studio’s Wiki for the XIAO ESP32S3 Sense board.

 

Seeeduino XIAO ESP32S3 Sense Board – A Tiny ESP32 Camera
Summary
Seeeduino XIAO ESP32S3 Sense Board - A Tiny ESP32 Camera
Article Name
Seeeduino XIAO ESP32S3 Sense Board - A Tiny ESP32 Camera
Description
The Seeeduino XIAO ESP32S3 Sense board is a tiny ESP32 camera board with some impressive features. The board includes a camera, microphone, MicroSD card and it uses a USB-C connector. It even has provisions for charging a LiPo battery.
Author
Publisher Name
DroneBot Workshop
Publisher Logo
Tagged on:
Subscribe
Notify of

5 Comments
Oldest
Newest
Inline Feedbacks
View all comments
Vince
8 months ago

Hello Bill, I’m in the UK and I would just like to say a big thank you for all your videos and projects, the amount of detailed description and software is very much appreciated and I’m sure it takes a lot of work doing it all. I’m also jealous of your nice tidy workshop area, after 60+ years (I’m 72 now) of building electronic and mechanical things, both for my work and hobby, my home workshop/bench is a disaster area! 🙄 I’m thoroughly ashamed of myself, but I’m too old to change now! 😉 OK, I did get one of… Read more »

Marc Vick
8 months ago

Truly fantastic content. I always enjoy your videos; never an unnecessary word yet reliably thorough! Well-done and much appreciated.

4 months ago

Bill, Thanks so much for all that you do. My latest creation is a conversion of an old “Dusk to Dawn” porch light that sporadically work however it wishes to a 3D printed camera housing mounted in place of the original electronics. I have versions of the unit for the ESP32_am and the Pi Zero 2 W. Unfortunately, neither unit has a simple external antenna connection that is usable. Like you, I have Pi Zero 2 W units and ESP32-Cam units that no longer work because I’ve destroyed them in trying to rig the external antenna. AH HA!! Along comes… Read more »

Joseph Tannenbaum
3 months ago

Loaded this program and serial says camera ok and identifies the card. When touched, says saving picture /image1.jpg then Recording 10 sec of sound. Recording Sound… Malloc failed. I guess this is memory allocation failed? but on card? on chip? How to clear it?

Philippe Rubbers
2 months ago

Thanks for the pointers.
What frame rate can be expected from the ESP32?
I see the camera can do 30fps at 1080p…. and I am getting 1fps or even less.