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.
- 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
A ridiculous amount of coffee was consumed in the process of building this project. Add some fuel if you'd like to keep me going!