OV5640 module no i2c address - tried with multiple controllers

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
Menehune
 
Posts: 8
Joined: Wed Sep 22, 2021 5:20 pm

OV5640 module no i2c address - tried with multiple controllers

Post by Menehune »

I recently purchased the Adafruit OV5640 module and am unable to connect, code returns no i2c address. After multiple attempts with an RPi Pico using exact wiring and code in the Adafruit learn article, and double checking the wiring numerous times, the code always fails when creating the bus indicating no i2c found for the address. I ran an i2c scan on the same set up and no addresses are found. I even added pullups to SCL and SDA which should not be necessary with this module but results are the same. Figuring it may be an issue with the Pico, I tried with a Feathers3 ESP32-S3 board and still no i2c address is found. I also tried using bitbangio instead of busio but results are the same.

Is there something I am missing or did I get a bad module?

User avatar
Franklin97355
 
Posts: 23902
Joined: Mon Apr 21, 2008 2:33 pm

Re: OV5640 module no i2c address - tried with multiple controllers

Post by Franklin97355 »

Can you post pictures of your connections? The board should work if you are following https://learn.adafruit.com/adafruit-ov5 ... a-breakout

User avatar
Menehune
 
Posts: 8
Joined: Wed Sep 22, 2021 5:20 pm

Re: OV5640 module no i2c address - tried with multiple controllers

Post by Menehune »

Thanks for the reply.

Here are images of the breadboard setup I am using. Since there are a lot of connections, some details might help:

- Blue (SCL) - GP9
- White (SDA) - GP8
- 2 short green - VS and HS
- 2 darker yellow - XC and PC
- Data 2-9 - Orange and light yellow
- Long black - RT

Also, since the OV5640 module covers some of the connections, I included an image without the module but leaving the wires in place.

This is what I get in REPL when I run the example code:

>>> %Run -c $EDITOR_CONTENT
construct bus
construct camera
Traceback (most recent call last):
File "<stdin>", line 40, in <module>
File "adafruit_ov5640.py", line 1060, in __init__
File "adafruit_ov5640.py", line 940, in __init__
ValueError: No I2C device at address: 0x3c

ov5640_breadboard.jpg
ov5640_breadboard.jpg (564.38 KiB) Viewed 188 times
ov5640_breadboard_nocam.jpg
ov5640_breadboard_nocam.jpg (312.17 KiB) Viewed 188 times
ov5640_breadboard_close.jpg
ov5640_breadboard_close.jpg (994.53 KiB) Viewed 188 times

User avatar
adafruit_support_carter
 
Posts: 29056
Joined: Tue Nov 29, 2016 2:45 pm

Re: OV5640 module no i2c address - tried with multiple controllers

Post by adafruit_support_carter »

Hey, sorry for the delay.

The OV5640 requires a bit more than power to come alive. It also needs a proper clock signal input on the XC pin:
https://learn.adafruit.com/adafruit-ov5 ... ns-3136945
That would explain why a basic I2C scan did not show the address.

Additionally, it looks like you are powering the camera module with 5V via the Pico's VBUS pin:
wiring1.png
wiring1.png (716.5 KiB) Viewed 141 times

instead of with 3.3V via the regulated pin:
wiring2.png
wiring2.png (491.16 KiB) Viewed 141 times
Above Fritzing wiring diagram comes from guide here:
https://learn.adafruit.com/adafruit-ov5 ... pico-usage

Definitely should make that wiring change. And hopefully feeding in 5V to the camera module did no damage.

User avatar
Menehune
 
Posts: 8
Joined: Wed Sep 22, 2021 5:20 pm

Re: OV5640 module no i2c address - tried with multiple controllers

Post by Menehune »

Thanks for the reply and nice catch regarding VBUS vs 3V. Thankfully, the extra voltage does not seem to have hurt board. However, this was not the cause of the issue. After way too much time spent checking and rechecking my wiring, I finally figured it out and got this to work.

The cause of the issue is an ERROR IN THE ADAFRUIT LEARN ARTICLE for RPi Pico (https://learn.adafruit.com/adafruit-ov5 ... pico-usage)

Specifically, the physical pin connections for XC and PC indicated in the article do not match the pin assignments in the example code.

Both the list of Pin Connections and the Breadboard image in the article indicate the following physical connections:

- OV5640 XC to Pi Pico GP11
- OV5640 PC to Pi Pico GP20

HOWEVER, the example CircuitPython Code included with the article REVERSES these pin assignment when constructing the camera:

clock=board.GP11,
vsync=board.GP7,
href=board.GP21,
mclk=board.GP20,

"clock" refers to the PC pin and "mclk" is the XC pin.

The list of pins and Fritzing diagram of the breadboard should be changed in the article to match the code.

When I reversed the physical connections to match the code, the module was finally recognized and worked perfectly.

It is worth noting that after getting everything working with an external clock, I tried using the internal clock on the module (broke the EXT trace and soldered the internal pads and set mclk=None). This resulted in rolling static on the LCD as if the internal clock was not connected. I checked for continuity and the solder joint appeared good, so I am not sure why the internal oscillator was not working. I ultimately re-soldered to use the external clock pin. I noticed that when using the external clock and setting the frequency explicitly in code, the rolling static occurred at 24MHz and I had to reduce to 20MHz.

Would love to use the internal clock if you have any ideas.

User avatar
jepler
 
Posts: 10
Joined: Wed May 08, 2013 12:47 pm

Re: OV5640 module no i2c address - tried with multiple controllers

Post by jepler »

I have tried to correct the errors in the wiring page for the RP2040.

User avatar
Menehune
 
Posts: 8
Joined: Wed Sep 22, 2021 5:20 pm

Re: OV5640 module no i2c address - tried with multiple controllers

Post by Menehune »

Thanks for the quick turnaround correcting the article. Adafruit Learn is a great resource. Hopefully, this will save someone else a little time and frustration.

User avatar
DaveDice
 
Posts: 6
Joined: Mon Feb 08, 2021 11:40 pm

Re: OV5640 module no i2c address - tried with multiple controllers

Post by DaveDice »

Thanks for catching this, Menehune. I'd tried connecting with an Adafruit feather rp2040, a few weeks ago, and encountered the same problem but didn't have time to chase down the issue.

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

Return to “Adafruit CircuitPython”