Giter VIP home page Giter VIP logo

Comments (12)

indrekluuk avatar indrekluuk commented on May 29, 2024

Hey!

Can you run the Adafruit test program (the one that draws text and all kinds of lines one the screen) just to make sure that the issue is not with connection to the screen? The issue probably isn't with the screen, but it would be good to make sure because it is easy enough to check.

It seems that either pixel reading is a little out of sync or one or more pixel wires have bad connection. How long are the wires from the camera to Arduino?

If you try a slow version (for example 2 FPS) does this still have the stripes?

from liveov7670.

larsenglund avatar larsenglund commented on May 29, 2024

Hi!
The Adafruit test program and the 2 FPS version of your code shows no stripes. The wires are about 20cm from the camera to the Arduino.
Ratsnest

from liveov7670.

indrekluuk avatar indrekluuk commented on May 29, 2024

What does pixel clock signal look like from the Arduino's side if you measure it with oscilloscope? It should be PIN 12 if you connected it as shown in my schematic. On higher frequencies it may start distorting with longer cables and also the bread board connection in-between. I had everything mounted onto a PCB with very short connections.

Was the image brighter on lower FPS?

from liveov7670.

larsenglund avatar larsenglund commented on May 29, 2024

I have connected it as shown in your schematic, with the exception of not using level shifters. I only use a voltage divider on XCLK and pullups for SIOC and SIOD like in this image (the pin numbers in the image does not match your/my setup):
OV7670 hookup

The pixel clock looks like this (@10FPS):
Pixel clock

I think the image is equally dark, here is a comparison between 10 and 2 fps:
10fps vs 2fps

from liveov7670.

indrekluuk avatar indrekluuk commented on May 29, 2024

This looks OK.

Could you do the same measuring on the XCLK pin from the camera side. Maybe the voltage divider isn't fast enough. At 10FPS I am not checking the pixel clock PIN on each pixel because there is no time for that. I just detect the first pixel of a new frame and then start reading "blindly". If XCLK is uneven then it can get out of sync.

In lower frame rates code actually checks pixel clock pin.

from liveov7670.

larsenglund avatar larsenglund commented on May 29, 2024

The XCLK on the camera side did not look good:
XCLK with resistor voltage divider

I change the voltage divider to a mosfet based bi-directional level shifter:
Level shifter
and got this:
XCLK with resistor voltage divider

The streaks disappeared (yay!) but now I get some kindof "animated/scrolling" purple/cyan errors in bright areas of the image and some weaker stripes all over the image:
Pixel errors

from liveov7670.

indrekluuk avatar indrekluuk commented on May 29, 2024

The new one actually seems worse than the voltage divider version. At least some of the bumps may count as clock cycle. It is probably because of the wire length.

I used the same kind of level shifter. For me it looks like this:
xclk

Maybe you can try voltage divider with lower resistor values? Arduino PIN can handle up to 40mA. Maybe 20mA to be safe. 5V/0.02A = 250 Ohm total (instead of 20k).

from liveov7670.

larsenglund avatar larsenglund commented on May 29, 2024

That did the trick! Found a couple of 330 Ohm resistors first so tried with them and got this signal:
330 ohm

I can't thank you enough for helping me debug this! I hope it will help someone else in the future!
On a side-note, what FPS did you get with the STM32?

from liveov7670.

indrekluuk avatar indrekluuk commented on May 29, 2024

You are welcome!

Not much higher than Arduino. Maximum reliable image I got was at 12FPS.

With Arduino I got the camera and Arduino to be in perfect sync so I could read pixel data while ignoring pixel clock.

For some reason I could not do that with STM32.
There is a topic for OV7670 on http://www.stm32duino.com/ forums. I read that it is probably possible to capture pixels on hardware level with STM32. So I believe it is possible to go higher than 12FPS but I haven't tried it since my initial goal was to get it working with Arduino. I ported it to STM32 just to see if I can get it working.

Is the image still too dark? The camera object has methods "setContrast" and "setBrightness" you can try those. Although for me the default settings work pretty well.

from liveov7670.

larsenglund avatar larsenglund commented on May 29, 2024

Ok, thanks for the STM32 info!

It's still a bit dark. I will try to fiddle with the histogram auto exposure thresholds.

I got an idea for improving framerate: since you are blindly reading pixels, could you not double the framerate for grayscale video by doubling the pixel clock, changing to YUV and only reading every other byte (the luma (Y)) from the YUYVYUYVYUYV.. byte stream? (I'll move this to a feature request)

from liveov7670.

larsenglund avatar larsenglund commented on May 29, 2024

I ordered a couple of your PCB:s from ALLPCB by the way :) They offer free world wide DHL shipping so I only paid $5.5 for 10pcs. Seems too good to be true, I guess time will tell :)

from liveov7670.

indrekluuk avatar indrekluuk commented on May 29, 2024

That does sound too good. Last time I ordered from PCBWay. They also have 5 USD for 10pcs (up to 10cm10cm size) but DHL delivery is around €25 (or China Post which is cheaper but takes over three weeks to arrive).

Next time I'll try ALLPCB. $5 isn't too much of a sacrifice if it isn't as promised.

from liveov7670.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.