M5Cam X M5Stack

2,755

6

15

About: Make it yourself if you cannot buy one!

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:

  1. make menuconfig
  2. 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!

Share

    Recommendations

    • Plastics Contest

      Plastics Contest
    • Optics Contest

      Optics Contest
    • Make it Glow Contest 2018

      Make it Glow Contest 2018

    15 Discussions

    0
    None
    dpcons

    7 weeks ago

    Thanks very much for fixing the issues I described. Everything works very well. I appreciate your quick response. Thanks for posting.

    0
    None
    RodrigoU5

    Question 8 weeks ago

    I would like a scketh for m5cam where I can take a photo every 6 hours and write to a server.

    Would you have a template or could you help me?

    2 more answers
    0
    None
    陳亮RodrigoU5

    Answer 8 weeks ago

    I think many people want someone can make it and share it, will you try to contribute to make one?

    0
    None
    RodrigoU5陳亮

    Reply 8 weeks ago

    My badge has not arrived yet.

    But I think my knowledge is still small, but I'll try.

    0
    None
    dpcons

    8 weeks 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

    m5cam.jpgviewer.jpg
    2 replies
    0
    None
    陳亮dpcons

    Reply 8 weeks ago

    I have recompiled with latest ESP-IDF, all goes well.
    P.S. I also pushed some changes to github

    0
    None
    陳亮dpcons

    Reply 8 weeks 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

    0
    None
    dpcons

    8 weeks 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

    I (171) boot: ESP-IDF v3.2-dev-1016-gd56a40070 2nd stage bootloader

    I (172) boot: compile time 14:42:02

    I (173) boot: Enabling RNG early entropy source...

    I (193) boot: SPI Speed : 40MHz

    I (206) boot: SPI Mode : DIO

    I (219) boot: SPI Flash Size : 4MB

    I (232) boot: Partition Table:

    I (243) boot: ## Label Usage Type ST Offset Length

    I (265) boot: 0 nvs WiFi data 01 02 00009000 00006000

    I (289) boot: 1 phy_init RF data 01 01 0000f000 00001000

    I (312) boot: 2 factory factory app 00 00 00010000 00100000

    I (336) boot: End of partition table

    I (348) esp_image: segment 0: paddr=0x00010020 vaddr=0x3f400020 size=0x18c5c (101468) map

    I (596) esp_image: segment 1: paddr=0x00028c84 vaddr=0x3ffb0000 size=0x03354 ( 13140) load

    I (629) esp_image: segment 2: paddr=0x0002bfe0 vaddr=0x3ffb3354 size=0x00000 ( 0) load

    I (631) esp_image: segment 3: paddr=0x0002bfe8 vaddr=0x40080000 size=0x00400 ( 1024) load

    I (654) esp_image: segment 4: paddr=0x0002c3f0 vaddr=0x40080400 size=0x03c20 ( 15392) load

    I (718) esp_image: segment 5: paddr=0x00030018 vaddr=0x400d0018 size=0x6e134 (450868) map

    I (1691) esp_image: segment 6: paddr=0x0009e154 vaddr=0x40084020 size=0x0e5e8 ( 58856) load

    I (1844) esp_image: segment 7: paddr=0x000ac744 vaddr=0x400c0000 size=0x00000 ( 0) load

    I (1845) esp_image: segment 8: paddr=0x000ac74c vaddr=0x50000000 size=0x00000 ( 0) load

    I (1932) boot: Loaded app from partition at offset 0x10000

    I (1932) boot: Disabling RNG early entropy source...

    I (1935) cpu_start: Pro cpu up.

    I (1945) cpu_start: Starting app cpu, entry point is 0x40081104

    I (1) cpu_start: App cpu up.

    I (1978) heap_init: Initializing. RAM available for dynamic allocation:

    I (1999) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM

    I (2018) heap_init: At 3FFB9438 len 00026BC8 (154 KiB): DRAM

    I (2037) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM

    I (2057) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM

    I (2077) heap_init: At 40092608 len 0000D9F8 (54 KiB): IRAM

    I (2096) cpu_start: Pro cpu start user code

    I (28) cpu_start: Starting scheduler on PRO CPU.

    I (0) cpu_start: Starting scheduler on APP CPU.

    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! errors started here

    E (1718) sccb: i2c write reg=0xa7 err=0x107

    E (1718) sccb: i2c write reg=0xa7 err=0xffffffff

    E (1718) sccb: i2c write reg=0xa7 err=0x107

    E (1718) sccb: i2c write reg=0xa7 err=0xffffffff

    E (1718) sccb: i2c write reg=0xa7 err=0xffffffff

    E (1728) sccb: i2c write reg=0xa7 err=0xffffffff

    E (1738) sccb: i2c write reg=0xa7 err=0xffffffff

    E (1738) sccb: i2c write reg=0x7f err=0xffffffff

    E (1748) sccb: i2c write reg=0xe5 err=0xffffffff

    E (1748) sccb: i2c write reg=0xe1 err=0xffffffff

    E (1758) sccb: i2c write reg=0xdd err=0xffffffff

    E (1758) sccb: i2c write reg=0xc2 err=0xffffffff

    E (1768) sccb: i2c write reg=0xff err=0xffffffff

    E (1768) sccb: i2c write reg=0x12 err=0xffffffff

    E (1778) sccb: i2c write reg=0x03 err=0xffffffff

    E (1778) sccb: i2c write reg=0x32 err=0xffffffff

    E (1788) sccb: i2c write reg=0x17 err=0xffffffff

    E (1788) sccb: i2c write reg=0x18 err=0xffffffff

    E (1798) sccb: i2c write reg=0x19 err=0xffffffff

    E (1798) sccb: i2c write reg=0x1a err=0xffffffff

    E (1808) sccb: i2c write reg=0x3d err=0xffffffff

    E (1808) sccb: i2c write reg=0x35 err=0xffffffff

    E (1818) sccb: i2c write reg=0x22 err=0xffffffff

    E (1828) sccb: i2c write reg=0x37 err=0xffffffff

    E (1828) sccb: i2c write reg=0x34 err=0xffffffff

    E (1838) sccb: i2c write reg=0x06 err=0xffffffff

    E (1838) sccb: i2c write reg=0x0d err=0xffffffff

    E (1848) sccb: i2c write reg=0x0e err=0xffffffff

    E (1848) sccb: i2c write reg=0xff err=0xffffffff

    E (1858) sccb: i2c write reg=0x05 err=0xffffffff

    E (1858) sccb: i2c write reg=0xe0 err=0x107

    E (1868) sccb: i2c write reg=0xc1 err=0xffffffff

    E (1868) sccb: i2c write reg=0x8c err=0x107

    E (1878) sccb: i2c write reg=0x53 err=0xffffffff

    E (1878) sccb: i2c write reg=0x54 err=0xffffffff

    E (1888) sccb: i2c write reg=0x51 err=0x107

    E (1888) sccb: i2c write reg=0x52 err=0xffffffff

    E (1898) sccb: i2c write reg=0x55 err=0xffffffff

    E (1898) sccb: i2c write reg=0x57 err=0x107

    E (1908) sccb: i2c write reg=0x86 err=0xffffffff

    E (1908) sccb: i2c write reg=0x50 err=0xffffffff

    E (1918) sccb: i2c write reg=0xd3 err=0x107

    E (1918) sccb: i2c write reg=0x05 err=0xffffffff

    E (1928) sccb: i2c write reg=0xe0 err=0xffffffff

    I (1928) camera_demo: Detected OV2640 camera, using JPEG format

    E (1938) sccb: i2c write reg=0xff err=0xffffffff

    E (1948) sccb: i2c write reg=0xe0 err=0x107

    E (1948) sccb: i2c write reg=0xda err=0xffffffff

    E (1958) sccb: i2c write reg=0xd7 err=0xffffffff

    E (1958) sccb: i2c write reg=0xe1 err=0xffffffff

    E (1968) sccb: i2c write reg=0x44 err=0xffffffff

    E (1968) sccb: i2c write reg=0xe0 err=0x107

    E (3008) sccb: i2c write reg=0xff err=0x107

    E (3008) sccb: i2c write reg=0x05 err=0xffffffff

    E (3008) sccb: i2c write reg=0x5a err=0xffffffff

    E (3008) sccb: i2c write reg=0x5b err=0xffffffff

    E (4008) sccb: i2c write reg=0x5c err=0x107

    E (4008) sccb: i2c write reg=0xff err=0xffffffff

    E (4008) sccb: i2c write reg=0x11 err=0x107

    E (4008) sccb: i2c write reg=0xff err=0x107

    E (4008) sccb: i2c write reg=0x12 err=0xffffffff

    E (4018) sccb: i2c write reg=0x03 err=0xffffffff

    E (4018) sccb: i2c write reg=0x32 err=0x107

    E (4028) sccb: i2c write reg=0x17 err=0xffffffff

    E (4028) sccb: i2c write reg=0x18 err=0xffffffff

    E (4038) sccb: i2c write reg=0x19 err=0xffffffff

    E (4048) sccb: i2c write reg=0x1a err=0xffffffff

    E (4048) sccb: i2c write reg=0x3d err=0xffffffff

    E (4058) sccb: i2c write reg=0x35 err=0xffffffff

    E (4058) sccb: i2c write reg=0x22 err=0xffffffff

    E (4068) sccb: i2c write reg=0x37 err=0xffffffff

    E (4068) sccb: i2c write reg=0x34 err=0xffffffff

    E (4078) sccb: i2c write reg=0x06 err=0xffffffff

    E (4078) sccb: i2c write reg=0x0d err=0xffffffff

    E (4088) sccb: i2c write reg=0x0e err=0x107

    E (4088) sccb: i2c write reg=0x42 err=0x107

    E (4098) sccb: i2c write reg=0xff err=0xffffffff

    E (5098) sccb: i2c write reg=0x05 err=0x107

    E (5098) sccb: i2c write reg=0xe0 err=0xffffffff

    E (5098) sccb: i2c write reg=0xc0 err=0xffffffff

    E (6098) sccb: i2c write reg=0xc1 err=0x107

    E (6098) sccb: i2c write reg=0x8c err=0xffffffff

    E (6098) sccb: i2c write reg=0x53 err=0xffffffff

    E (6098) sccb: i2c write reg=0x54 err=0x107

    E (6098) sccb: i2c write reg=0x51 err=0x107

    E (6108) sccb: i2c write reg=0x52 err=0x107

    E (6108) sccb: i2c write reg=0x55 err=0x107

    E (7118) sccb: i2c write reg=0x57 err=0x107

    E (7118) sccb: i2c write reg=0x86 err=0xffffffff

    E (8118) sccb: i2c write reg=0x50 err=0x107

    E (8118) sccb: i2c write reg=0xd3 err=0xffffffff

    E (8118) sccb: i2c write reg=0x05 err=0x107

    E (8118) sccb: i2c write reg=0xe0 err=0x107

    E (8118) sccb: i2c write reg=0xff err=0x107

    E (8128) sccb: i2c write reg=0x05 err=0x107

    E (8158) camera: Failed to set frame size[0

    E (8158) camera_demo: Camera init failed with error 0x20002

    !!!!!!!!!!!!!!!!!!!

    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

    0
    None
    dpcons

    2 months 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.

    2 replies
    0
    None
    dpconsdpcons

    Reply 8 weeks 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.

    0
    None
    陳亮dpcons

    Reply 8 weeks ago

    the firmware is ok, I just fine tuned a little bit and changed the output resolution to 320x240.

    0
    None
    pfromen

    3 months 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

    0
    None
    vivian-ng

    3 months 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.

    2 replies
    0
    None
    陳亮vivian-ng

    Reply 3 months ago

    Hi vivian-ng, I think it is a long way to go. Since Arduino library still not included all required library. On the other side, what you want to control? This sample no need to use mDNS at all.

    0
    None
    vivian-ng陳亮

    Reply 3 months ago

    I guess it is still difficult to control the M5Cam using Arduino. I managed to edit the C code with parts from ESP-IDF example on mDNS to add mDNS to the M5Cam. This makes it easier to connect to the camera without having to make it an access point.