Raspberry Pi Pico -...
 
Notifications
Clear all

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

72 Posts
21 Users
40 Likes
9,715 Views
(@jasline123)
Eminent Member
Joined: 1 year 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)
Eminent Member
Joined: 1 year 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)
Eminent Member
Joined: 1 year 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)
Illustrious Member
Joined: 3 years ago
Posts: 5520
 

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

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
ReplyQuote
(@jasline123)
Eminent Member
Joined: 1 year 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)
Illustrious Member
Joined: 3 years ago
Posts: 5520
 

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

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
ReplyQuote
(@jasline123)
Eminent Member
Joined: 1 year ago
Posts: 20
 

@zander Ok, Thanks a lot.


   
ReplyQuote
Ron
 Ron
(@zander)
Illustrious Member
Joined: 3 years ago
Posts: 5520
 

@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.

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
ReplyQuote
Ron
 Ron
(@zander)
Illustrious Member
Joined: 3 years ago
Posts: 5520
 

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

Arduino says and I agree, in general, the const keyword is preferred for defining constants and should be used instead of #define
"Never wrestle with a pig....the pig loves it and you end up covered in mud..." anon
My experience hours are >75,000 and I stopped counting in 2004.
Major Languages - 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting


   
ReplyQuote
(@jasline123)
Eminent Member
Joined: 1 year 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)
Noble Member
Joined: 4 years ago
Posts: 1987
 

@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)
Famed Member
Joined: 2 years ago
Posts: 2507
 

@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.

I had a psychic girlfriend but she left me before we met.


   
Ron reacted
ReplyQuote
Page 5 / 5