Introduction: M5Cam X M5Stack
This instructables show how to use M5Cam and M5Stack to make a wireless camera and monitor.
Step 1: Preparation
M5Cam & M5Stack
You can buy it at M5Stack Official store:
https://www.aliexpress.com/store/3226069
Lipo Battery
Lipo battery is optional if you just want power with USB cable.
M5Stack bundle with a small Lipo battery, you may buy a larger one at the store.
M5Cam not bundle with battery, I have a 802025 Lipo in hand so I use it. The 3D printed case should able to fit a 902030 Lipo.
Step 2: Optional: Soldering Lipo Battery
Soldering Lipo to the pins beside Grove socket, 2 pins is very close, beware don't short 2 pins together.
Step 3: Optional: 3D Print M5Cam Case
https://www.thingiverse.com/thing:3020530
Step 4: Programming
Source code for M5Cam:
https://github.com/moononournation/esp32-cam-demo
This is a esp-idf project, you require esp-idf to build it.
After you familiar esp-idf, simply 2 steps to program M5Cam:
- make menuconfig
- make flash
Source code for M5Stack viewer:
https://github.com/moononournation/M5Stack-Cam-Vie...
This is a M5Stack Arduino project, simply upload it with Arduino.
Step 5: Happy Monitoring!
Its time to show off what you have done with your friends!
22 Comments
Question 2 years ago
I want to do "M5Cam X M5Stack" program.
But, error ocurred like this.
How do i fix of program?
/////
ets Jun 8 2016 00:22:57
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:9720
ho 0 tail 12 room 4
load:0x40080400,len:6352
entry 0x400806b8
M5Stack initializing...OK
[HTTP] begin...
[HTTP] GET...
[HTTP] GET... code: 200
[HTTP] size: -1
[HTTP] Unknow content size: -1
[HTTP] begin...
[HTTP] GET...
[HTTP] GET... code: 200
[HTTP] size: -1
[HTTP] Unknow content size: -1
//////
4 years ago
After a lot of searching i think i got everything on the esp32
But when using the serial terminal i see 2 errors, which keep replying:
[HTTP] GET... failed, error: connection refused
[HTTP] GET... code: -1
Don't know if it has something to do with it.
When i did the esp-cam-demo the red LED was ON.
After doing this script with as arduino (M5Stack-core-ESP32) the LED went OFF
don't know what is going wrong. Somebody has an idea?
Reply 4 years ago
Hello PaulH510,
I have the same problem.
Did you find a solution ?
4 years ago
You need the esp-idf - release/3.1. Don't forget to call make clean after switching to that version.
usb serial is (on my mac) /dev/cu.SLAB_USBtoUART - change this with make menuconfig -> serial configuration
4 years ago
Hello 陳亮
thanks for sharing your idea!
Based on your work I've made it with M5Cam OV2640 (wireless client, ESP-IDF) and M5Stack (wireless client, Arduino)
https://github.com/htpbbp/M5Stack_Snippets/tree/ma...
4 years ago
Thanks very much for fixing the issues I described. Everything works very well. I appreciate your quick response. Thanks for posting.
Reply 4 years ago
Hey how were you able to solve the I2C and set frame issue? I am running into the same issue as you with the long list of I2C errors with the failure to set frame size at the end. I see you said "I fell back and flashed the .bin from M5Cam-firmware.zip" but I'm not sure exactly what you mean by that. Thanks in advance for any help you can provide!
4 years ago
Vivian-ng: Can you post your updated code? I was hoping there was an Arduino .INO file for the M5Cam also. Thanks, Paul Fromen / Merritt Island, Florida
Reply 4 years ago
I am terribly sorry, I wasn't following this thread at all and never saw this until today.
If you are looking for an Arduino INO file, I think you can check out:
https://github.com/squix78/m5cam
Espressif also has official example for a camera web server, but it requires a camera module with PSRAM.
https://github.com/espressif/arduino-esp32/tree/ma...
As for the code about adding mDNS to the original M5Stack camera module, you can try reading this blog post:
https://teck78.blogspot.com/2018/07/adding-mdns-to...
Question 4 years ago
Would you have a template or could you help me?
Answer 4 years ago
I think many people want someone can make it and share it, will you try to contribute to make one?
Reply 4 years ago
But I think my knowledge is still small, but I'll try.
4 years ago
More info concerning my problem getting the referenced M5Cam software to flash and run properly.
Issue #1 - I fell back and flashed the .bin from the M5Cam-firmware.zip to the camera module. It appears to work better, in that is doesn't fire-off I2C errors and the set frame error. It actually connects and sends video to my Windows browser. Unfortunately, when I disconnect from the M5Cam AP, the firmware doesn't reset for a new connection. In order to make another connection, the module must be rebooted. Is this normal?
Issue #2 - Having some limited success, I tried running the viewer app on my M5-Core Black system. The camera module AP connects but fails to GET any data. I get timeouts, followed by disconnections. I tried another M5-Core White system with the same result. I've attached JPGs to show serial log data from both camera and viewer..
Question #1 - What version of ESP-IDF did you use to create the .bin in the M5Cam-firmware.zip?
Question #2 - Did you use the referenced version of the source to build the .bin?
Thanks, Dan
Reply 4 years ago
I have recompiled with latest ESP-IDF, all goes well.
P.S. I also pushed some changes to github
Reply 4 years ago
Hi dpcons, sorry for late reply. I found ESP-IDF have a few I2C related update, I will try recompile and test it.
Issue #1 - I have not yet update the firmware when you download it, it is the M5Cam original firmware. The default setting is set to only allow 1 connection, you may change it by "make menuconfig"
Issue #2 - ESP-IDF default use channel 1 as AP, you may check is channel 1 very busy in your area
Question #1 - around ESP-IDF 3.0
Question #2 - I will try it in latest version
4 years ago
Thanks for the response. I tried to build demo using ESP-IDF. Had no problem. Downloaded and ran Make MenuConfig and Make Flash. Compiled and downloaded fine. After flash, used puTTY to view startup. System failed. Sorry for the length of this message, but I guess you can't upload files to this site. Anyway...got the following:
=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2018.09.15 14:52:21 =~=~=~=~=~=~=~=~=~=~=~=
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x12 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0010,len:4
load:0x3fff0014,len:6060
load:0x40078000,len:9392
load:0x40080400,len:6136
entry 0x4008076c
[0;32mI (171) boot: ESP-IDF v3.2-dev-1016-gd56a40070 2nd stage bootloader[0m
[0;32mI (172) boot: compile time 14:42:02[0m
[0;32mI (173) boot: Enabling RNG early entropy source...[0m
[0;32mI (193) boot: SPI Speed : 40MHz[0m
[0;32mI (206) boot: SPI Mode : DIO[0m
[0;32mI (219) boot: SPI Flash Size : 4MB[0m
[0;32mI (232) boot: Partition Table:[0m
[0;32mI (243) boot: ## Label Usage Type ST Offset Length[0m
[0;32mI (265) boot: 0 nvs WiFi data 01 02 00009000 00006000[0m
[0;32mI (289) boot: 1 phy_init RF data 01 01 0000f000 00001000[0m
[0;32mI (312) boot: 2 factory factory app 00 00 00010000 00100000[0m
[0;32mI (336) boot: End of partition table[0m
[0;32mI (348) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x18c5c (101468) map[0m
[0;32mI (596) esp_image: segment 1: paddr=0x00028c84 vaddr=0x3ffb0000 size=0x03354 ( 13140) load[0m
[0;32mI (629) esp_image: segment 2: paddr=0x0002bfe0 vaddr=0x3ffb3354 size=0x00000 ( 0) load[0m
[0;32mI (631) esp_image: segment 3: paddr=0x0002bfe8 vaddr=0x40080000 size=0x00400 ( 1024) load[0m
[0;32mI (654) esp_image: segment 4: paddr=0x0002c3f0 vaddr=0x40080400 size=0x03c20 ( 15392) load[0m
[0;32mI (718) esp_image: segment 5: paddr=0x00030018 vaddr=0x400d0018 size=0x6e134 (450868) map[0m
[0;32mI (1691) esp_image: segment 6: paddr=0x0009e154 vaddr=0x40084020 size=0x0e5e8 ( 58856) load[0m
[0;32mI (1844) esp_image: segment 7: paddr=0x000ac744 vaddr=0x400c0000 size=0x00000 ( 0) load[0m
[0;32mI (1845) esp_image: segment 8: paddr=0x000ac74c vaddr=0x50000000 size=0x00000 ( 0) load[0m
[0;32mI (1932) boot: Loaded app from partition at offset 0x10000[0m
[0;32mI (1932) boot: Disabling RNG early entropy source...[0m
[0;32mI (1935) cpu_start: Pro cpu up.[0m
[0;32mI (1945) cpu_start: Starting app cpu, entry point is 0x40081104[0m
[0;32mI (1) cpu_start: App cpu up.[0m
[0;32mI (1978) heap_init: Initializing. RAM available for dynamic allocation:[0m
[0;32mI (1999) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM[0m
[0;32mI (2018) heap_init: At 3FFB9438 len 00026BC8 (154 KiB): DRAM[0m
[0;32mI (2037) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM[0m
[0;32mI (2057) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM[0m
[0;32mI (2077) heap_init: At 40092608 len 0000D9F8 (54 KiB): IRAM[0m
[0;32mI (2096) cpu_start: Pro cpu start user code[0m
[0;32mI (28) cpu_start: Starting scheduler on PRO CPU.[0m
[0;32mI (0) cpu_start: Starting scheduler on APP CPU.[0m
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! errors started here
[0;31mE (1718) sccb: i2c write reg=0xa7 err=0x107[0m
[0;31mE (1718) sccb: i2c write reg=0xa7 err=0xffffffff[0m
[0;31mE (1718) sccb: i2c write reg=0xa7 err=0x107[0m
[0;31mE (1718) sccb: i2c write reg=0xa7 err=0xffffffff[0m
[0;31mE (1718) sccb: i2c write reg=0xa7 err=0xffffffff[0m
[0;31mE (1728) sccb: i2c write reg=0xa7 err=0xffffffff[0m
[0;31mE (1738) sccb: i2c write reg=0xa7 err=0xffffffff[0m
[0;31mE (1738) sccb: i2c write reg=0x7f err=0xffffffff[0m
[0;31mE (1748) sccb: i2c write reg=0xe5 err=0xffffffff[0m
[0;31mE (1748) sccb: i2c write reg=0xe1 err=0xffffffff[0m
[0;31mE (1758) sccb: i2c write reg=0xdd err=0xffffffff[0m
[0;31mE (1758) sccb: i2c write reg=0xc2 err=0xffffffff[0m
[0;31mE (1768) sccb: i2c write reg=0xff err=0xffffffff[0m
[0;31mE (1768) sccb: i2c write reg=0x12 err=0xffffffff[0m
[0;31mE (1778) sccb: i2c write reg=0x03 err=0xffffffff[0m
[0;31mE (1778) sccb: i2c write reg=0x32 err=0xffffffff[0m
[0;31mE (1788) sccb: i2c write reg=0x17 err=0xffffffff[0m
[0;31mE (1788) sccb: i2c write reg=0x18 err=0xffffffff[0m
[0;31mE (1798) sccb: i2c write reg=0x19 err=0xffffffff[0m
[0;31mE (1798) sccb: i2c write reg=0x1a err=0xffffffff[0m
[0;31mE (1808) sccb: i2c write reg=0x3d err=0xffffffff[0m
[0;31mE (1808) sccb: i2c write reg=0x35 err=0xffffffff[0m
[0;31mE (1818) sccb: i2c write reg=0x22 err=0xffffffff[0m
[0;31mE (1828) sccb: i2c write reg=0x37 err=0xffffffff[0m
[0;31mE (1828) sccb: i2c write reg=0x34 err=0xffffffff[0m
[0;31mE (1838) sccb: i2c write reg=0x06 err=0xffffffff[0m
[0;31mE (1838) sccb: i2c write reg=0x0d err=0xffffffff[0m
[0;31mE (1848) sccb: i2c write reg=0x0e err=0xffffffff[0m
[0;31mE (1848) sccb: i2c write reg=0xff err=0xffffffff[0m
[0;31mE (1858) sccb: i2c write reg=0x05 err=0xffffffff[0m
[0;31mE (1858) sccb: i2c write reg=0xe0 err=0x107[0m
[0;31mE (1868) sccb: i2c write reg=0xc1 err=0xffffffff[0m
[0;31mE (1868) sccb: i2c write reg=0x8c err=0x107[0m
[0;31mE (1878) sccb: i2c write reg=0x53 err=0xffffffff[0m
[0;31mE (1878) sccb: i2c write reg=0x54 err=0xffffffff[0m
[0;31mE (1888) sccb: i2c write reg=0x51 err=0x107[0m
[0;31mE (1888) sccb: i2c write reg=0x52 err=0xffffffff[0m
[0;31mE (1898) sccb: i2c write reg=0x55 err=0xffffffff[0m
[0;31mE (1898) sccb: i2c write reg=0x57 err=0x107[0m
[0;31mE (1908) sccb: i2c write reg=0x86 err=0xffffffff[0m
[0;31mE (1908) sccb: i2c write reg=0x50 err=0xffffffff[0m
[0;31mE (1918) sccb: i2c write reg=0xd3 err=0x107[0m
[0;31mE (1918) sccb: i2c write reg=0x05 err=0xffffffff[0m
[0;31mE (1928) sccb: i2c write reg=0xe0 err=0xffffffff[0m
[0;32mI (1928) camera_demo: Detected OV2640 camera, using JPEG format[0m
[0;31mE (1938) sccb: i2c write reg=0xff err=0xffffffff[0m
[0;31mE (1948) sccb: i2c write reg=0xe0 err=0x107[0m
[0;31mE (1948) sccb: i2c write reg=0xda err=0xffffffff[0m
[0;31mE (1958) sccb: i2c write reg=0xd7 err=0xffffffff[0m
[0;31mE (1958) sccb: i2c write reg=0xe1 err=0xffffffff[0m
[0;31mE (1968) sccb: i2c write reg=0x44 err=0xffffffff[0m
[0;31mE (1968) sccb: i2c write reg=0xe0 err=0x107[0m
[0;31mE (3008) sccb: i2c write reg=0xff err=0x107[0m
[0;31mE (3008) sccb: i2c write reg=0x05 err=0xffffffff[0m
[0;31mE (3008) sccb: i2c write reg=0x5a err=0xffffffff[0m
[0;31mE (3008) sccb: i2c write reg=0x5b err=0xffffffff[0m
[0;31mE (4008) sccb: i2c write reg=0x5c err=0x107[0m
[0;31mE (4008) sccb: i2c write reg=0xff err=0xffffffff[0m
[0;31mE (4008) sccb: i2c write reg=0x11 err=0x107[0m
[0;31mE (4008) sccb: i2c write reg=0xff err=0x107[0m
[0;31mE (4008) sccb: i2c write reg=0x12 err=0xffffffff[0m
[0;31mE (4018) sccb: i2c write reg=0x03 err=0xffffffff[0m
[0;31mE (4018) sccb: i2c write reg=0x32 err=0x107[0m
[0;31mE (4028) sccb: i2c write reg=0x17 err=0xffffffff[0m
[0;31mE (4028) sccb: i2c write reg=0x18 err=0xffffffff[0m
[0;31mE (4038) sccb: i2c write reg=0x19 err=0xffffffff[0m
[0;31mE (4048) sccb: i2c write reg=0x1a err=0xffffffff[0m
[0;31mE (4048) sccb: i2c write reg=0x3d err=0xffffffff[0m
[0;31mE (4058) sccb: i2c write reg=0x35 err=0xffffffff[0m
[0;31mE (4058) sccb: i2c write reg=0x22 err=0xffffffff[0m
[0;31mE (4068) sccb: i2c write reg=0x37 err=0xffffffff[0m
[0;31mE (4068) sccb: i2c write reg=0x34 err=0xffffffff[0m
[0;31mE (4078) sccb: i2c write reg=0x06 err=0xffffffff[0m
[0;31mE (4078) sccb: i2c write reg=0x0d err=0xffffffff[0m
[0;31mE (4088) sccb: i2c write reg=0x0e err=0x107[0m
[0;31mE (4088) sccb: i2c write reg=0x42 err=0x107[0m
[0;31mE (4098) sccb: i2c write reg=0xff err=0xffffffff[0m
[0;31mE (5098) sccb: i2c write reg=0x05 err=0x107[0m
[0;31mE (5098) sccb: i2c write reg=0xe0 err=0xffffffff[0m
[0;31mE (5098) sccb: i2c write reg=0xc0 err=0xffffffff[0m
[0;31mE (6098) sccb: i2c write reg=0xc1 err=0x107[0m
[0;31mE (6098) sccb: i2c write reg=0x8c err=0xffffffff[0m
[0;31mE (6098) sccb: i2c write reg=0x53 err=0xffffffff[0m
[0;31mE (6098) sccb: i2c write reg=0x54 err=0x107[0m
[0;31mE (6098) sccb: i2c write reg=0x51 err=0x107[0m
[0;31mE (6108) sccb: i2c write reg=0x52 err=0x107[0m
[0;31mE (6108) sccb: i2c write reg=0x55 err=0x107[0m
[0;31mE (7118) sccb: i2c write reg=0x57 err=0x107[0m
[0;31mE (7118) sccb: i2c write reg=0x86 err=0xffffffff[0m
[0;31mE (8118) sccb: i2c write reg=0x50 err=0x107[0m
[0;31mE (8118) sccb: i2c write reg=0xd3 err=0xffffffff[0m
[0;31mE (8118) sccb: i2c write reg=0x05 err=0x107[0m
[0;31mE (8118) sccb: i2c write reg=0xe0 err=0x107[0m
[0;31mE (8118) sccb: i2c write reg=0xff err=0x107[0m
[0;31mE (8128) sccb: i2c write reg=0x05 err=0x107[0m
[0;31mE (8158) camera: Failed to set frame size[0
[0;31mE (8158) camera_demo: Camera init failed with error 0x20002[0m
!!!!!!!!!!!!!!!!!!!
I'm using the standard M5Stack Camera, nothing custom.
I browsed the setup in the menuconfig and everything looked OK. Did I miss something? Do I need to change any configuration info? Thanks for your help
4 years ago
Is the M5stack cam demo firmware required to be burned into the M5 camera? In other words, will the viewer software work with the M5Cam-test firmware already in the camera? Thanks alot for posting this project.
Reply 4 years ago
I left out some information. I'm using the standard M5Stack Camera, nothing custom.
I browsed the setup in the menuconfig and everything looked OK. Did I miss something? Do I need to change any configuration info? Thanks for your help.
Reply 4 years ago
the firmware is ok, I just fine tuned a little bit and changed the output resolution to 320x240.
4 years ago
Is there any Arduino IDE code that can be used to control the M5Cam? The demo code from M5Stack is for ESP-IDF only, while searching for "ESP32 camera" gave me code for ESP32 with OV7670 but not OV2640 which the M5Cam uses. It would make using the M5Cam a lot easier if it can be programmed using Arduino IDE, as I am having difficulties getting mDNS to work.