ESP32: M5 Camera Module

The M5 stack has some clever hardware in its portfolio. Honestly, so far I only had contact with this camera module. Here is a super quick guide to get the camera running in your Arduino IDE

Usually you would use the software stack provided by M5 to get their hardware running. For simplicity I prefer to be a bit more independent from their libraries. So I was looking for a way to use just standard libraries of the ESP32 Arduino platform. To my luck mic159 already did the hard work and ported the necessary classes to the Arduino platform.

But when I tried to run his code I couldn’t figure out how to get the streamed images to display on my laptop. The code seems to send the frames per UDP to the second IP in the Soft AP range, as soon as a device is connected. I tried to use VLC but to no avail. So I forked the repository and altered the code to offer the captured images over a web server.

Setup

  • Make sure you have the latest version of the ESP32 platform setup. If you haven’t, then follow the instructions here
  • Now checkout my fork of mic159’s code from github. Either with git clone or by downloading the zip file
  • Connect the M5Cam to your computer, set the Serial Port and flash the code to the module

 

Running the Cam Server

  • Now Connect your computer to an SSID “m5cam” and open the browser at 192.168.4.1. You should now see a live feed from the camera
  • To get a still frame you can open 192.168.4.1/camera

 

Review & Outlook

The quality of the picture is quite decent. With the current code I coudn’t get the module to run in highest resolution (1600×1200) because there is not enough memory for the framebuffer. But I maybe there is a way around that, if you just stream the content directly to web server clients. One of my next experiments will be to see if I can get Google’s vision API to detect objects in the captured images. The module also has two pads to solder a LiPo battery and also has the necessary charger chip. This should make it very easy to use for many applications.

 

Where to buy the module?

I got mine from banggood, but you can also find the modules on Aliexpress

Did you like this post? Consider supporting me with a virtual coffee or beer.

Posted by squix78

4 comments

  1. Very interesting module. Look forward to more development with this unit. It has so many accessories (analog microphone, 3 axis gyro and accelerometers, temp and humidity sensor plus built in LiPo charger). I can envision a few uses in my RC hobby as a data logger. Just need to add GPS and it would be about perfect.

    • As a follow up this module get very HOT. Banggood shipped it with a small heat sink and I understand why now! Need to also cool the camera module or it will quit working. Seeing how poorly the thermal management was I decided to not use it for my planned project.

  2. I bought two of these from AliExpress and received them a couple of days ago. They came programmed with a demo sketch that streams on 192.168.4.1. They do work, but they seem a bit flaky. Sometimes they do not start on power up and sometimes they start but have artifacts all over the images. Sometimes they start and stream fine. An article I found on the net suggested that the issue was lack of pullup resistors on the I2C lines running the camera. What has been your experience with this? I would like to see this module come up as a streaming server on my existing network.

  3. has anyone made it work for higher resolution like 1280×1024 and 1600×1200, I really need higher resolution for my project

Leave a Reply