Raspberry Pi Pico -...
 
Notifications
Clear all

Raspberry Pi Pico - Control the (I/O) World

72 Posts
21 Users
40 Likes
11.8 K Views
(@jasline123)
Member
Joined: 2 years ago
Posts: 20
 

The above is the code i am using.

My error is

Traceback (most recent call last):
File "<stdin>", line 29, in <module>
ValueError: GP10 in use

I am not able to add any attachment.I am not sure why.

The camera i am using is https://www.robotshop.com/uk/ov2640-camera-board.html?gclid=Cj0KCQjw9ZGYBhCEARIsAEUXITVoIsq87Ol3shMcmhhp3bgYjo3AgtSdrHoNA4uRH7UJ65aMXgrmDIwaApj5EALw_wcB

The MicroSD card with pins - CS,SCK,MOSI,MISO,VCC,GND

The connection I used is as follows

Pico - Camera

3V3 - 3V3 | GP9 - SIOC | GP7 - VSYNC | GP11 - PCLK | GP19 - D9 | GP17 - D7 | GP15 - D5 | 

GP13 - D3 | GP10 - RESET | GND - GND | GP8 - SIOD | GP21 - HREF | GP20 - XCLK | GP18 - D8 | 

GP16 - D6 | GP14 - D4 | GP12 -D2

Pico - SD card

CS - GP13 | SCK - GP10 | MOSI - GP11 | MISO - GP12 | VCC - VBUS | GND - GND


   
ReplyQuote
(@jasline123)
Member
Joined: 2 years ago
Posts: 20
 

@zander The SD card is working fine and camera is working fine.I am getting error while connecting the both.Any tips?I have given everything in detail above 😐 😐 


   
ReplyQuote
(@jasline123)
Member
Joined: 2 years ago
Posts: 20
 
WhatsApp Image 2022 08 23 at 9.25.16 PM
WhatsApp Image 2022 08 23 at 9.25.15 PM

@zander this is how i did my connection


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6968
 

@jasline123 I am confused, first you say it is working, then you say it is not. Pick one. 

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@jasline123)
Member
Joined: 2 years ago
Posts: 20
 

My aim is to connect the camera, capture image and save to an SD card which is not working and throwing the error 

image
import os
import board
import busio as io
import digitalio
import storage
import adafruit_sdcard
import sdcardio
import adafruit_ov2640
import microcontroller
from time import sleep
import time
from displayio import (
    Bitmap,
    Group,
    TileGrid,
    FourWire,
    release_displays,
    ColorConverter,
    Colorspace,
)
SD_CS = board.GP13

spi = io.SPI(board.GP10, board.GP11, board.GP12)
cs = digitalio.DigitalInOut(SD_CS)
sdcard = adafruit_sdcard.SDCard(spi, cs)
vfs = storage.VfsFat(sdcard)
storage.mount(vfs, "/sd")

with digitalio.DigitalInOut(board.GP10) as reset:
    reset.switch_to_output(False)
    time.sleep(0.001)
    bus = busio.I2C(board.GP9, board.GP8)
    
cam = adafruit_ov2640.OV2640(
    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,
)  

cam.colorspace = adafruit_ov2640.OV2640_COLOR_JPEG
cam.size = adafruit_ov2640.OV2640_SIZE_QQVGA
buf = bytearray(cam.capture_buffer_size)

jpeg = cam.capture(buf)
print(f"Captured {len(jpeg)} bytes of jpeg data")
try:
    with open("/sd/jpeg.jpg", "wb") as f:
        f.write(jpeg)
except OSError as e:
    print(e)
    print(
        "A 'read-only filesystem' error occurs if you did not correctly install"
        "\nov2640_jpeg_kaluga1_3_boot.py as CIRCUITPY/boot.py and reset the board"
    )
print("Wrote to CIRCUITPY/jpeg.jpg")



   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6968
 

@jasline123 WOW, what the heck are all those wires. I can't help, I don't have a camera like that.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@jasline123)
Member
Joined: 2 years ago
Posts: 20
 

@zander Ok, Thanks a lot.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6968
 

@jasline123 First time I saw this sketch. I have no experience with that hardware so I will have to bow out. I do see GP10 mentioned in your code, so the first thing I would do is use another GPIO pin. Good luck.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6968
 

@jasline123 Is that an ARDUCAM camera? If so ask over at their site especially if it's one of their sketch's.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@jasline123)
Member
Joined: 2 years ago
Posts: 20
 

This is slightly different from Arducam actually. Anyways il try that as well. Thanks a lot for the help.


   
ReplyQuote
robotBuilder
(@robotbuilder)
Member
Joined: 5 years ago
Posts: 2042
 

@jasline123 

Certainly a mess of wires making it easy to make a mistake.  I would check to see if there is any ribbon connection available?  I agree the error seems to involve a GPIO conflict perhaps with the SD module? The old RPi I use you can just plug a camera into it.

RPiCamera

 


   
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2531
 

@jasline123 

I don't use this equipment nor do I use Python, but I notice that you ARE trying to use GP10 twice in the same sketch ...

Camera: GP10 - RESET

SD card: SCK - GP10

That may have something to do with your problem.

Anything seems possible when you don't know what you're talking about.


   
Ron reacted
ReplyQuote
Page 5 / 5