🌈 ESP32-S3 Rainbow: ZX Spectrum Emulator Board! Get it on Crowd Supply →
View All Posts
read
Want to keep up to date with the latest posts and videos? Subscribe to the newsletter
HELP SUPPORT MY WORK: If you're feeling flush then please stop by Patreon Or you can make a one off donation via ko-fi

Last time I made an ESP32 pretend to be a webcam; this time it’s a real USB UVC cam streaming MJPEG. Then I go further: I bolt on a tiny 32x24 infrared sensor, scale it up to 320x240 with nearest-neighbor or bilinear, JPEG it, and stream it like any normal webcam. Along the way I show why ESP32-CAM won’t work (no native USB), dive into I2C gremlins (run a scanner first, check pull-ups), and fix a flaky 3.3V regulator solder job. Quick hardware tour: onboard 2.2K pull-ups, ME6212 LDO, and an AT32F415 MCU. Audio can wait—today’s all about making thermal video look good over UVC.

Related Content
Transcript

Last time we made an ESP32 think it was
a webcam. This time we’ve switched
things up and it is actually a real
webcam. And this other one is a bit
special. It’s only 32x 24 pixels, but it
measures infrared instead of visible
light. We take that tiny image, scale it
up, do a bit of processing, JPEG encode
it, and stream it over USB just like a
normal webcam would. Let’s start with a
simple ESP32 webcam. Now, this turns out
to be surprisingly easy. Now, I’m using
this very nice little module that has
the camera builtin, but you should be
able to use any suitable S3 module and
camera module. What you can’t use is one
of these ESP32 cam boards. Firstly,
there’s no USB. Secondly, the ESP32
module that’s used on this doesn’t have
support for native USB, so it just won’t
work. Our USB UVC setup uses MJPEG
encoding, which as we saw last time is
just a stream of JPEG images sent one
after another. The really nice thing
about these camera modules is that they
already give us a JPEG image. So, all we
have to do is grab that JPEG data and
send it over USB. You really can’t get
more simple than that. Now, obviously, a
real webcam would do audio. We have
looked at USB UAC in a previous video,
so at some point I may try and mash them
together into some kind of Frankenstein
USB combo device that does video and
audio, but that’s for another video. So,
let’s move on to the infrared camera.
This one is a bit more complicated.
First off, it’s an I squared C device. I
actually spent quite a while debugging
this, scanning I squared C addresses,
checking pull-ups, swapping voltages,
all the usual stuff. In the end, I
looked at the PCB under a microscope and
found the real problem. The soldering on
this 3.3 volt regulator was a bit dodgy.
So, after refflowing the joints,
everything worked perfectly. A couple of
quick notes about this board. The I
squared C pull-ups are builtin 2.2K to
3.3 volt. And there’s also a 3.3 volt
regulator on board. In theory, this does
mean that it should be powered by 5
volts or at least higher than 3.3 volts.
But in practice, I found it was
perfectly happy running directly from
3.3 volts as well. Now, for this, I am
using my custom dev board that I got
made by the great guys at PCB Way, but
you should be able to use any S3 board,
so don’t worry about needing a custom
board like I’ve got. With the I squared
C working, we hit the next challenge.
The image is tiny. 32x 24 pixels just
isn’t very useful on its own. So, what
I’m doing is scaling it up to 320x 240,
a factor of 10 in each direction. I’ve
implemented two options, nearest
neighbor scaling and by linear scaling.
Both work well, and the frame rate is
pretty decent. And once it’s scaled,
you’d never guess it started life as a
32x 24 image. Now, if you just wanted to
see an ESP32 stream a thermal camera as
a USB webcam, that’s basically it. But
if you are trying to build something
like this yourself, there are a few
things worth knowing. I squared C can
often be quite difficult to get working.
So, I have a checklist now of things to
do. The very first thing I do is run an
I squared C scanner. If nothing shows
up, there’s no point debugging software.
You’ve got a hardware problem. This is
some advice that I really should listen
to more often.
A lot of I squared C problems come down
to pull up resistors. Some modules don’t
have them at all. Some use very weak
values. Many Arduino compatible modules
have a 3.3 regulator on board. This is
due to the fact that many early Arjuino
boards were 5V systems. Powering them
from 3.3 volts can almost work, which is
worse than not working at all. So, let’s
do a deep dive on this board in
particular. We do have a 3.3 volt
regulator on board. So in theory, we
should give it more than 3.3 volts. In
this particular low dropout regulator
looks like it’s an ME 6212 series. This
has a dropout voltage of around 120 m at
100 milliamps load. So it probably
should still work if we feed in 3.3
volts to it. Ideally though, we should
probably feed it in 5 V. Fortunately,
the pull-up resistors are connected to
the 3.3 volt line, so we don’t need to
worry about weird voltage levels on the
I squed C bus. Other than that, all we
have on board is this A32F415
series microcontroller. This is a 32-bit
ARM Cortex M4 running at 150 MHz with
32K of RAM and 128 kilob of flash.
Pretty beefy for this little board. But
that’s pretty much it for the hardware
side of things. I am actually very
tempted to just remove this 3.3 volt
regulator entirely and power the board
directly from 3.3 volts. We could just
run a jumper wire straight over it. But
anyway, pretty cool. USB UVC is pretty
interesting technology. So, check out
the previous video. Should be appearing
on the screen somewhere now.


HELP SUPPORT MY WORK: If you're feeling flush then please stop by Patreon Or you can make a one off donation via ko-fi
Want to keep up to date with the latest posts and videos? Subscribe to the newsletter
Blog Logo

Chris Greening

> Image

atomic14

A collection of slightly mad projects, instructive/educational videos, and generally interesting stuff. Building projects around the Arduino and ESP32 platforms - we'll be exploring AI, Computer Vision, Audio, 3D Printing - it may get a bit eclectic...

View All Posts