Open sgbaird opened 2 years ago
This repo isn't compatible with the Pico W in its current form. It's also not maintained (obvious from the user profile and the last commit 5 years ago).
What happens is no addresses are found during i2c.scan()
(addrs == []
), followed by:
Traceback (most recent call last):
File "<stdin>", line 41, in <module>
File "<stdin>", line 21, in main
File "/lib/ov2640/esp8266_ov2640.py", line 36, in __init__
OSError: [Errno 5] EIO
I also tried the PR here for the ESP-32: https://github.com/namato/micropython-ov2640/pull/4
The code hangs instead of producing EIO. I stopped the code after about a minute (note that this was using the 320x240 setting).
This was also after ensuring the proper Pico W pins were being used and changing the SPI IDs to match. I used the wiring described in the ArduCam docs.
Swapped the Pico W out with a Pico and got the same error:
>>> %Run -c $EDITOR_CONTENT
initializing camera
[48]
i2c device found at address: 48
writing to memory
Traceback (most recent call last):
File "<stdin>", line 43, in <module>
File "<stdin>", line 23, in main
File "/lib/ov2640/ov2640.py", line 63, in __init__
OSError: [Errno 5] EIO
Taking my first baby steps with microcontrollers and this camera - please take anything I say with a large grain of salt :)
Plugging into my Pico W, I've just taken my first photo using this library by configuring with these settings:
self.hspi = machine.SPI(0, baudrate=80000000, polarity=0, phase=0, sck=machine.Pin("GP2"), mosi=machine.Pin("GP3"), miso=machine.Pin("GP4"))
self.i2c = machine.I2C(0, scl=machine.Pin("GP9"), sda=machine.Pin("GP8"), freq=1000000)
I've connected the pins according to the suggestion here: https://www.uctronics.com/download/Amazon/B0067-B0068-Pico.pdf
The basics main.py I'm using is:
import time
import ov2640
import gc
import sys
FNAME = 'image2.jpg'
try:
print("initializing camera")
cam = ov2640.ov2640()
clen = cam.capture_to_file(FNAME, True)
print("captured image is %d bytes" % clen)
print("image is saved to %s" % FNAME)
time.sleep(10)
sys.exit(0)
except KeyboardInterrupt:
print("exiting...")
sys.exit(0)
@tbbuck, thanks for sharing! I might give this a try.
I'm interested in using the Pico W in an IoT-style with a low framerate video and various sensors. I'm thinking about using the CircuitPython PICO_SPI_CAM https://github.com/ArduCAM/PICO_SPI_CAM/issues/8 with Blinka as a compatibility layer so I can still use MicroPython, or doing a rewrite of my code to switch back to using CircuitPython (since there is now limited WiFi support on the Pico W).