Arducam Mini-2MP bare minimum init process needed for 2MP jpeg? (micropython)

Hi,

I am trying to use the Arducam Mini 2MP with ESP28266 (and later with ESP32) running micropython.

I have managed to get it talking (after wasting 2 days because included ribbon cable had a wire broken inside) via I2C and ESP.

I am very daunted by the fact that the init process so convoluted. I was hoping that I all I needed to do is hook the camera up and have basic presets, but no it requires hundreds of lines of registers writes.

My problem with this product is that I hate black boxes and I was trying to follow what registers are set from example C header codes. I could not find some of the values/registers in the datasheet for the sensor.

I found this project https://github.com/namato/micropython-ov2640 and unfortunately they simply translated the process from the example C header provided by Arducam.

I was hoping that the camera will have some sane defaults and will work out of the box with minimal setup. In my limited knowledge opinion I would think with all the effort made by Arducam it would have been easy for them to include all those register settings as presets?
Having two buses with two independent configuration processes seems like a hack to me.

Rant aside what would be the bare minimum register set for a JPEG output at 2MP?

Otherwise I would give up and use rPi zero w with an UVC camera and just put bigger solar panel.

Hi,

Using Arducam SPI camera, these initial configurations are unavoidable.

This product is really disappointing in many aspects.
I have measured the power consumption and at 5V it sucks 100mA, with ESP8266 it pushes towards 180mA (total), and that is without doing anything.

For a test I hooked up a rPi Zero with a random UVC camera and whole thing consumed 200mA. Remember rPi Zero is way more powerful than an ESP8266 (and I don’t need to worry about some arcane bitbanging because I could simply ffmpeg the /dev/video0).

It seems that this product is really unfinished. Since the board has a micro on it already why do we as end users have to bitbang the undocumented registers to get the thing to bare minimum? Why doesn’t onboard micro take care of it?

It should only had one bus (SPI).

It also lacking quality control, as one of the wires that came with the camera was broken thus wasting half a day of my time going on the wild goose chase.

I still haven’t managed to get it going. The least arducam could have done is to provide official library for micropython.

For the money ($30USD) the camera is not worth it. Especially when it comes with broken wires, and poor documentation.

To add insult to the injury this forum sign up/login process is utterly broken.

In Firefox the captcha often is not displayed (most of the time) and when clicked “I am not a robot” it still fails to loginl. In Chrome I barely managed to login (I had to fail first in the forum post so it would redirect me to dedicated login page). Not only this, but the verification email link went to 404?

In addition to that I haven’t got any reply from arducam staff (via contact form on this site).

Saying all that I am still after a camera solution with which I can simply grab jpeg stills at reasonable resolution, any recommendation are welcome. It has to be low power otherwise I would simply just fitted an IP CCTV camera at the location be done with it.

I am powering this with a small solar battery and 2Ah 4S 12V LiFePO4 pack.

@sergei.nz

First of all I have to apologize you have so many problem with our camera.

I have measured the power consumption and at 5V it sucks 100mA, with ESP8266 it pushes towards 180mA (total), and that is without doing anything.
The best way to save power, you have to control the power to the camera. When idle you have to switch off the camera power supply, so that there will be no power consumption from the camera.
For a test I hooked up a rPi Zero with a random UVC camera and whole thing consumed 200mA. Remember rPi Zero is way more powerful than an ESP8266 (and I don’t need to worry about some arcane bitbanging because I could simply ffmpeg the /dev/video0).
The SPI camera is different from the UVC camera, becaues you can not connect a UVC camera to ESP8266.
It seems that this product is really unfinished. Since the board has a micro on it already why do we as end users have to bitbang the undocumented registers to get the thing to bare minimum? Why doesn’t onboard micro take care of it?
It is quite old product indeed, which is designed during 2012~2015. We provide source code for Arduino library and examples and modify based on them. Actually there is no onboard micro, it is just a camera controller using FPGA, it can't too much work, so need micro like Arduino to handle other tasks. You can find the document and all registers from the link: https://www.arducam.com/docs/spi-cameras-for-arduino/
It should only had one bus (SPI).
Like I mentioned above, there are lot of register need to be written before normal working, sowe leave the sensor intialization procedure for the Arduino due to the architecture constrain. Single SPI bus is a good idea, we have such customized camera for other private projects.
It also lacking quality control, as one of the wires that came with the camera was broken thus wasting half a day of my time going on the wild goose chase.
Sorry for the cable, but you can email us for help to do quicker diagnose, we have very experienced engineers here. Or even a short phone call for remote support.
I still haven’t managed to get it going. The least arducam could have done is to provide official library for micropython.
The camera is designed for Arduino standard library many years ago. We are new to micropython, but we heard there is some else ported our library to micropython already.

https://github.com/namato/micropython-ov2640

For the money ($30USD) the camera is not worth it. Especially when it comes with broken wires, and poor documentation.
Yes, it is retail price is 25.99USD with free shipping, might be expensive compared to some of the other cameras. But it also has advantage that you can use it on any microcontroller like Arduino, ESP8266, ESP32, Raspberry pi and many others, no hardware platform constrain. And you can use even 4 of this camera on the same microcontroller as well. Although there are cheap UVC camera, but you can't use it on Arduino or ESP boards. We have several online Youtube tutorials and documents from : https://www.arducam.com/docs/spi-cameras-for-arduino/ Any advice on improving our document is appreciated.

https://www.arducam.com/docs/spi-cameras-for-arduino/

To add insult to the injury this forum sign up/login process is utterly broken.

In Firefox the captcha often is not displayed (most of the time) and when clicked “I am not a robot” it still fails to loginl. In Chrome I barely managed to login (I had to fail first in the forum post so it would redirect me to dedicated login page). Not only this, but the verification email link went to 404?


Yes, we faced a lot of problem when updating our website/forum, there might be accessing problem during this time. Our engineer is working hard to fix it, and now it is working as normal.

In addition to that I haven’t got any reply from arducam staff (via contact form on this site).
I am not sure which email address you are using, why we missed your email. We have hundreds of email every day from different email account, we might miss something. But from the auto reply, we left our phone number or skype ID, that you can reach us more easily and fast.
Saying all that I am still after a camera solution with which I can simply grab jpeg stills at reasonable resolution, any recommendation are welcome. It has to be low power otherwise I would simply just fitted an IP CCTV camera at the location be done with it.
We will try our best to help you with your application. As you know there are too many aspect sto be discussed for a given application, it is more wise and efficent to contact us with skype and talk over the phone.

Thanks for your patience so far.

Lee

Hi Lee,

 

Thank you for your reply. I have found that github project before making the original post, the reason I haven’t used it is because:

  1. it is too large for my use case
  2. it stores image locally which potentially will wear out the flash memory
  3. I would like to build my own solution. I take pride and joy from understanding the projects I am working on. There is no sense of accomplishment using pre-made solution.

Since I was not getting anywhere (the documentation for OV2640 does not match the init exactly as I understood) I tried the namato solution. While it “worked”, I am not happy about the image quality (more on this below) or the fact that it I waited one hour before I gave up when I tried to capture a 2MP image (not sure if it is the limitation of ESP8266, Arducam or the libary, the baudrate was set to 2M, so it should have been quicker than that, a lot quicker)…

It took ~45s to pull 320x240 12kB image:
320x240

~3 minutes for 46k 640x480 image:640x480

~6min30sec for 116kB 1024x768 image:
1024x768

For 1600x1200 image I ran out of patience at 1 hour mark.

These times seem unreasonable (the SPI is set to 2M so it should be quicker?), with the speed working out to be just over 300bytes/s or 2400bits/s. I am fairly sure it is no fault of Arducam, but it would not been an issue if I didn’t rely on random library off github.

Regarding image quality: The image is overexposed, unfocused, and noisy. A $20 CCTV IP camera off aliexpress produces better image. Regarding the exposure and compression, probably issue with the init (but how the hell I am supposed to control that when it is so arcane?). While the focusing - how does one practically focuses the camera when there are minutes between snapshots?

Hence I am going back to original question:
What is the minimal init needed to set the camera for JPEG output at the highest resolution with everything on auto (exposure, white balance, etc)?

I don’t like reverse engineering other people’s code, as a lot of times I do this for my job, and I hate when my hobby turns into a job. Reverse engineering a very long list of registers is not fun.

At this stage I consider this project a failure and will look to ditching the whole thing in favour of a RPi Zero W with USB UVC camera, alternative is to go with VGA UART camera and keep the micro.

 

 

Hi Lee,

 

Thank you for your reply. I have found that github project before making the original post, the reason I haven’t used it is because:

  1. it is too large for my use case
  2. it stores image locally which potentially will wear out the flash memory
  3. I would like to build my own solution. I take pride and joy from understanding the projects I am working on. There is no sense of accomplishment using pre-made solution.

Since I was not getting anywhere (the documentation for OV2640 does not match the init exactly as I understood) I tried the namato solution. While it “worked”, I am not happy about the image quality (more on this below) or the fact that it I waited one hour before I gave up when I tried to capture a 2MP image (not sure if it is the limitation of ESP8266, Arducam or the libary, the baudrate was set to 2M, so it should have been quicker than that, a lot quicker)…

It took ~45s to pull 320x240 12kB image:
320x240

~3 minutes for 46k 640x480 image:640x480

~6min30sec for 116kB 1024x768 image:
1024x768

For 1600x1200 image I ran out of patience at 1 hour mark.

These times seem unreasonable (the SPI is set to 2M so it should be quicker?), with the speed working out to be just over 300bytes/s or 2400bits/s. I am fairly sure it is no fault of Arducam, but it would not been an issue if I didn’t rely on random library off github.

Regarding image quality: The image is overexposed, unfocused, and noisy. A $20 CCTV IP camera off aliexpress produces better image. Regarding the exposure and compression, probably issue with the init (but how the hell I am supposed to control that when it is so arcane?). While the focusing - how does one practically focuses the camera when there are minutes between snapshots?

Hence I am going back to original question:
What is the minimal init needed to set the camera for JPEG output at the highest resolution with everything on auto (exposure, white balance, etc)?

I don’t like reverse engineering other people’s code, as a lot of times I do this for my job, and I hate when my hobby turns into a job. Reverse engineering a very long list of registers is not fun.

At this stage I consider this project a failure and will look to ditching the whole thing in favour of a RPi Zero W with USB UVC camera, alternative is to go with VGA UART camera and keep the micro.

Hi Lee,

 

Thank you for your reply. I have found that github project before making the original post, the reason I haven’t used it is because:

  1. it is too large for my use case
  2. it stores image locally which potentially will wear out the flash memory
  3. I would like to build my own solution. I take pride and joy from understanding the projects I am working on. There is no sense of accomplishment using pre-made solution.

Since I was not getting anywhere (the documentation for OV2640 does not match the init exactly as I understood) I tried the namato solution. While it “worked”, I am not happy about the image quality (more on this below) or the fact that it I waited one hour before I gave up when I tried to capture a 2MP image (not sure if it is the limitation of ESP8266, Arducam or the libary, the baudrate was set to 2M, so it should have been quicker than that, a lot quicker)…

It took ~45s to pull 320x240 12kB image:

~3 minutes for 46k 640x480 image:

~6min30sec for 116kB 1024x768 image:

For 1600x1200 image I ran out of patience at 1 hour mark.

These times seem unreasonable (the SPI is set to 2M so it should be quicker?), with the speed working out to be just over 300bytes/s or 2400bits/s. I am fairly sure it is no fault of Arducam, but it would not been an issue if I didn’t rely on random library off github.

Regarding image quality: The image is overexposed, unfocused, and noisy. A $20 CCTV IP camera off aliexpress produces better image. Regarding the exposure and compression, probably issue with the init (but how the hell I am supposed to control that when it is so arcane?). While the focusing - how does one practically focuses the camera when there are minutes between snapshots?

Hence I am going back to original question:
What is the minimal init needed to set the camera for JPEG output at the highest resolution with everything on auto (exposure, white balance, etc)?

I don’t like reverse engineering other people’s code, as a lot of times I do this for my job, and I hate when my hobby turns into a job. Reverse engineering a very long list of registers is not fun.

At this stage I consider this project a failure and will look to ditching the whole thing in favour of a RPi Zero W with USB UVC camera, alternative is to go with VGA UART camera and keep the micro.

@sergei.nz
Actually we didn’t test the micro python version on our side, so not sure about the performance.
Our original library and C examples are working well on Arduino, only few (2~15)seconds to save an image to external SD card.
In our examples we use 4MHz SPI speed on Arduino UNO board, and there is also some overhead between each transfer, still can get 2~15 seconds performance.

The image sensor was designed 12 years ago, it has build-in Auto exposure function, and I see your images looks not too bad. It might not as good as current CCTV cameras indeed.

In terms of the focus, we have a Windows GUI to help you streaming the VGA like resolution at 5~10fps speed. Check this video
https://youtu.be/hybQpjwJ4aA

It seems that you are looking for ready to use camera and use it as is. But our camera is target to be compatible with different platforms and the SDK library is very bulky and need to tweak in this case.
If you still want to stick to micro, you have to list a spec of what you want, then our engineer can evaluate your requirement and build a custom example if possible.

Oof - same here with needing to replace the ribbon cable (bought from Amazon). Also wasted a lot of time that way.

  • sparks-baird/self-driving-lab-demo/issues/93
    • ArduCAM/PICO_SPI_CAM/issues/9
    • namato/micropython-ov2640
      • namato/micropython-ov2640/issues/8
    • ArduCAM/PICO_SPI_CAM/issues/8
    • lemariva/micropython-camera-driver/issues/74
    • edwardwebster/Micropython-Arducam/issues/2
    • edwardwebster/Micropython-Arducam/issues/1
    • Xraydylan/Arducam-OV2640-Pico-Package/issues/3
    • lemariva/uPyCam/issues/21

I can only get the CircuitPython example running. Even if I were to get one of the MicroPython examples running like mentioned above, 45s for a low-resolution image is unreasonable for my application.