Autofocus issues


Thanks for your whole code. Tomorrow I will invite our engineer help you test it .



We try to run the code you send and get this error and we can’t install the matplotlib Please help

Sorry, I forgot to remove the library I used for debugging

You can import these library only, and I think it can also works.

import cv2
import numpy as np
import os
import time
import smbus2 as smbus

import picamera
from picamera.array import PiRGBArray


If there is any problem, please tell me and I’ll reply as soon as possible, thank you.

OK, I will test it next Monday. Now is weekend. Thanks for your patient.



Did you successfully run my code? I’ve tried many ways to fix the i2c filled up problem this week, but still not work.



Very very sorry for reply you so late, I am too busy recently. Please ry this test I attached for you.

Notice, Please ensure you have enable the i2c0 add dtparam=i2c_vc=on

This is the test demo I attached for you

Thank you so much for replying.

I have some questions here.

Why the test demo you attached set the camera like this:

camera.shutter_speed = camera.exposure_speed
camera.exposure_mode = ‘auto’

g = camera.awb_gains

camera.awb_mode = ‘auto’

camera.awb_gains = g


Does this mean we don’t have to disable the camera’s auto exposure and auto white balance if we set dtparam=i2c_vc=on?



Yes, now we use the same i2c adapter as the GPU, it seems the GPU will detected if the i2c0 is busy. So it will not exist write write error.

Before, we connect the i2c1 and i2c0 the same bus. which will exist occupied.

Have you tested this demo I attached for you?


Yes, it works very well.

Thank you so much!

You are welcome. Let me know if you need more help.