Raspberry Pi Pico and OV7670 camera - can't connect

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Tony9191
 
Posts: 13
Joined: Thu Jun 01, 2023 7:01 pm

Raspberry Pi Pico and OV7670 camera - can't connect

Post by Tony9191 »

Hello. I want to connect Raspberry Pi Pico to OV7670 camera. I'm trying to save a photo to a txt file, but it's always empty. Not even zeros.

Please tell me - what am I doing wrong?

I am using the camera connection library
https://github.com/adafruit/Adafruit_Ci ... hon_OV7670

Code: Select all

import board
from adafruit_ov7670 import OV7670
import time
import digitalio

cam = OV7670(
    bus,
    data_pins=[board.PCC_D0, board.PCC_D1, board.PCC_D2, board.PCC_D3, board.PCC_D4, board.PCC_D5, board.PCC_D6, board.PCC_D7],
    clock=board.PCC_CLK,
    vsync=board.PCC_DEN1,
    href=board.PCC_DEN2,
    mclk=board.D29,
    shutdown=board.D39,
    reset=board.D38,
)
cam.size = OV7670_SIZE_DIV16

buf = bytearray(2 * cam.width * cam.height)

try:
    with open("photobin.txt", "wb") as photo:
        while True:
            temp = cam.capture(buf)
            photo.write(temp)
            photo.flush()
            time.sleep(1)
except OSError as e:
    print("error")

User avatar
Tony9191
 
Posts: 13
Joined: Thu Jun 01, 2023 7:01 pm

Re: Raspberry Pi Pico and OV7670 camera - can't connect

Post by Tony9191 »

I remade the program, changed the pin numbers inside it (for Raspberry Pi Pico).

I also added the activation of the LED after instantiation.

The LED is off. Please tell me what is wrong?

Code: Select all

import sys
import time
import digitalio
import busio
import board
from adafruit_ov7670 import OV7670

cam = OV7670(
    bus,
    data_pins=[board.GP12, board.GP13, board.GP14, board.GP15, board.GP16, board.GP17, board.GP18, board.GP19],
    clock=board.GP11,
    vsync=board.GP7,
    href=board.GP21,
    mclk=board.GP20,
    shutdown=None,
    reset=board.GP10
) 

led = digitalio.DigitalInOut(board.LED)
led.direction = digitalio.Direction.OUTPUT
led.value = True
time.sleep(1000)

cam.size = OV7670_SIZE_DIV16

buf = bytearray(2 * cam.width * cam.height)
            
try:
    with open("photobin.txt", "wb") as photo:
        while True:
            temp = cam.capture(buf)
            photo.write(temp)
            photo.flush()
            time.sleep(1)

except OSError as e:
    print("error")


Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”