New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ESP-EYE +OV5640 - Vertical lines noise in the JPEG picture #172
Comments
I don't think that the issue is power, but I could be wrong. Image is taken at 10MHz XCLK QSXGA JPEG with the web server example in ESP-WHO |
I will investigate with a larger batch this week, and will inspect the signal quality with a scope. |
OK... now time to close this issue. |
try using a power bank. If it doesn't work, it is a problume in the code or the camara. Responding to the issue to help. |
Try this: #229 |
I had a lot of noise, I reduced xclk_freq_hz from 20 Mhz to 5 Mhz and noise reduced noticeable (below 10 Mhz also you'll have to increase some timeouts in driver to avoid error messages). |
Reducing the clock will expose the pictures more, but it takes longer to get the picture from the sensor. |
@Wassasin did you do analyze a batch of cams? any results? |
This issue appears to be stale. Please close it if its no longer valid. |
Did anyone manage to get rid of the noise? I'm seeing the issue in very bright outdoor conditions. I don't believe it's "pixel noise" because that wouldn't have such a vertical-line pattern, it would be more random (thermal) noise. I looks more to me like electrical noise/interference. Either the cheap ov5640 we get have crap sensors or the typical esp32-cam electrical environment is no good for this sensor (but then, why do the ov5640 not exhibit this?). Here's a crop from a full-frame USXGA. The pattern in the lines is always the same, frame after frame. That makes me believe it's a sensor issue. I would expect the electrical noise to vary... Hard to tell... |
Did you try my solutions? |
I have not reduced the clock freq, it's at 16.5Mhz. I'll give that a shot, but it's not really a solution 'cause it has a direct impact on frame rate, which is already not exactly high. |
I'm trying to troubleshoot this a bit further. Haven't hooked up the scope yet... I started by taking a look at the voltage regulators in the esp32-cam schematics. There's the main 3.3V regulator and then 2.8V and 1.2V regulators for AVDD and DVDD going to the image sensor in addition to the 3.3V for DOVDD. These are the digital core voltage, the analog voltage, and the I/O voltage respectively. The voltages were designed for the OV2640 and there's a liiitle problem with the OV5640, which is that DVDD needs to be 1.5V, not 1.2V. The reason it works anyway is that the OV5640 has an internal 1.5V regulator, which is enabled by default. So my understanding is that the 1.2V DVDD going to the sensor is unused. However, the 1.5V internal regulator uses DOVDD, and that is supposed to be 1.8V or 2.8V, not 3.3V (which is still within absolute max rating) and the data sheet has the following to say about the internal regulator (sec 2.7 Power Up Sequence):
I haven't done any experimental validation of any of this, but I know that the sensor gets bloody hot, to the point that the first thing I did was to stick it onto a heatsink. That still gets really hot! Obviously in an image sensor heat == noise... I clearly have more testing to do, but I'm starting to wonder whether I'll have to do some voltage regulator surgery on one of my esp32-cam to see whether that fixes things... |
Hi @tve , a few months ago I had same issues wit OV5640 |
@rotrico, thanks for the info! I did reduce XCLK to 5Mhz and you're correct that it reduces the noise. It also slows the frame rate down, which is an issue for me. Interesting that the 3660 doesn't have the noise problem, it also has 1.4um pixels and seems almost identical to the ov5640 except for sensor area. Weird that it behaves better... I only have one ov5640, so I can't judge sample-to-sample variation. WRT image quality, the lenses on these small sensors are crap and are not sharp except at the very center of the image. I'm planning on mounting an M12 lens to hopefully fix that. I'm going to review the exposure and gain settings to see whether there's a problem there. Otherwise, perhaps it is the heat and electrical noise produced by the on-chip JPEG compression that causes the problems, although, I don't really see why that would be different between ov3660 and ov5640... |
I spent a bunch of hours trying different settings, especially of the black-level compensation, all to no avail. The noise remains what it is. The only thing that makes a difference is to reduce the clock rate as rotrico suggests. An additional good news / bad news is that actually, at 6Mhz VCLK, if I set the jpeg quality high I end up with ~450-480KB frame sizes and at that point the data transmission is pretty much balanced with the frame acquisition at ~0.8fps. The esp32 transmits at about 2.8mbps, which seems to be the max the arduino framework allows for (the wifi data rate is 72mpbs and it's sending 2872 bytes data packets, so it's the s/w stack or PSRAM access that limits). tl;dr: if you want video that (mostly) doesn't have vertical streaks then reduce the clock rate to 6Mhz, crank up the jpeg quality, and "enjoy" 0.8fps... |
Sorry, I only loosely followed the thread. I had similar issues with an underpowered power source. |
If you had followed more closely ;-) you would have noticed that I redid the power regulators to try and improve things, to no avail... ;-) |
@tve |
@rotrico Thanks for the excellent suggestions! I'm "happy" right now in that the 6Mhz clock rate is sufficient to produce images fast enough for the wifi transmission to consume, i.e., the sensor read-out speed is not the bottleneck. I may give optimizing the data transmission a shot, but I suspect that I'm just hitting the psram bandwidth limit. With the arduino stuff I'm not even sure how to check that the processor is running at 240Mhz and the psram at 80Mhz/QIO... (I'm using https://github.com/easytarget/esp32-cam-webserver, maybe there's a simple esp-idf app I could use instead that streams the video in mjpeg more efficiently.) The pinephone suggestion is a good one. However, it uses a raw readout and does the debayering and follow-on processing in the phone cpu. There's an official linux driver for the ov5640, I looked at it and it uses the ov5640 setting verbatim from the app note. It would be worthwhile hacking esp32-camera to swap out the init sequence for the one from the app note. But that sounds like another day of work, at least... WRT using something other than an esp32: I'm doing that :-). I do have a bunch of rPi with cameras, but at that point it's much easier to use a better sensor to begin with, no need for in-sensor jpg... :-) Thanks for the suggestions and your work! |
FWIW - I power my board with 3.3V and also encountered the annoying lines. I soldered a 1,000uF capacitor to the 3.3V and GND pin and that fixed it. YMMV of course. |
My client has a large amount of OV5640's in use, and we notice just some units having this noise. They are discarded as being junk. I spent some time checking whether it was either a software or a hardware error, but with matching registers this still varies unit-by-unit. Our own hardware is not the problem, as plugging in a fresh OV5640 'solves' the issue. YMMV. |
@Wassasin any tips on where to get 5640's that have a chance of being good? Or what to look for? |
What IOVDD are you using to power OV5640?
…On Fri, Mar 18, 2022 at 11:57 AM Thorsten von Eicken < ***@***.***> wrote:
@Wassasin <https://github.com/Wassasin> any tips on where to get 5640's
that have a chance of being good? Or what to look for?
—
Reply to this email directly, view it on GitHub
<#172 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAD247OKE4ITX6F2AGY2ZTVASKUBANCNFSM4QLOVDRA>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
--
Regards,
*Luiz Vitor Martinez Cardoso*
"The only limits are the ones you place upon yourself"
|
The sensor manufacturer outlines the requirement for PGND(pwr ground), DGND and AGND. These needs to be tied up together, I've made the bridge near the VCC/PGND input far from everything else. Using a 24MHz oscillator (XO) powered on by 2.8V for XCLK. Everything drives from quality 10u tantalums (TAJR106K006RNJ). They aren't the easiest boards to design and route however if the requirements are followed it works flawlessly, nothing wrong with the sensor. Side note; I'm not familiar with the ESP32-CAM, but guessing if noise is an issue, 'it is what it is', and can't be solved. |
Here is a video to better demonstrate my problem |
So i adjusted my settings like so config.ledc_channel = LEDC_CHANNEL_0;
config.ledc_timer = LEDC_TIMER_0;
config.pin_d0 = Y2_GPIO_NUM;
config.pin_d1 = Y3_GPIO_NUM;
config.pin_d2 = Y4_GPIO_NUM;
config.pin_d3 = Y5_GPIO_NUM;
config.pin_d4 = Y6_GPIO_NUM;
config.pin_d5 = Y7_GPIO_NUM;
config.pin_d6 = Y8_GPIO_NUM;
config.pin_d7 = Y9_GPIO_NUM;
config.pin_xclk = XCLK_GPIO_NUM;
config.pin_pclk = PCLK_GPIO_NUM;
config.pin_vsync = VSYNC_GPIO_NUM;
config.pin_href = HREF_GPIO_NUM;
config.pin_sccb_sda = SIOD_GPIO_NUM;
config.pin_sccb_scl = SIOC_GPIO_NUM;
config.pin_pwdn = PWDN_GPIO_NUM;
config.pin_reset = RESET_GPIO_NUM;
config.xclk_freq_hz = 22000000;
config.frame_size = FRAMESIZE_SVGA;
config.pixel_format = PIXFORMAT_JPEG; // for streaming
config.grab_mode = CAMERA_GRAB_LATEST;
config.fb_location = CAMERA_FB_IN_PSRAM;
config.jpeg_quality = 8;
config.fb_count = 3; It streams fairly well now but i can't take a decent picture Here is my async webserver code for it server.on("/capture", HTTP_GET, [](AsyncWebServerRequest * request) {
camera_fb_t * fb = esp_camera_fb_get();
if(!fb){
request->send(500, "text/plain", "Camera capture failed");
return;
}
char ts[32];
snprintf(ts, 32, "%ld.%06ld", fb->timestamp.tv_sec, fb->timestamp.tv_usec);
AsyncWebServerResponse *response = request->beginResponse_P(200, "image/jpeg", fb->buf, fb->len);
response->addHeader("Content-Disposition", "inline; filename=capture.jpg");
response->addHeader("Access-Control-Allow-Origin", "*");
response->addHeader("X-Timestamp", ts);
request->send(response);
esp_camera_fb_return(fb);
}); The picture is really bad What can be the problem? |
XCLK of 22MHz could be the problem. Try 20MHz or less |
Yeah, it was XCLK but for some reason the picute on the left side is really white. |
Hi
I used the esp-eye + ov5640 to capture , i see the vertical lines and noise.
Adjust the XCLK to 5/10/15/20 MHz has no effect.
Does anyone know how to solve it?
Extra info:
.xclk_freq_hz = 10000000,
.pixel_format = PIXFORMAT_JPEG,
.frame_size = FRAMESIZE_QSXGA,
Thanks.
The text was updated successfully, but these errors were encountered: