Camera focus not working and not detected on I2C bus with Raspberry Pi 3B

Hi everyone, I’m stuck with the focus control on this Raspberry Pi camera (SKU B0176) and I can’t figure out what I’m doing wrong.

The camera itself works, I can capture images with it. The problem is I cannot use the focus function over the I2C bus at all, and the camera address never shows up when I run i2cdetect.

Setup:

I followed the manual and read everything I could, but honestly I never got it to work. Any pointers would be appreciated.

Hi, thanks for the detailed report. Let’s dig in.

First thing we need to understand on a Pi 3B is which I2C buses actually exist, because the camera muxes things around and the numbering is not what people expect.

Can you run these two commands and paste the output?

i2cdetect -l

and the one you already tried:

i2cdetect -y 0

Also, can you confirm the exact detect command you used? I want to make sure we’re scanning the right adapter.

Sure, here’s what I get.

i2cdetect -l:

i2c-11 i2c bcm2835 (i2c@7e205000) I2C adapter
i2c-0 i2c i2c-11-mux (chan_id 0) I2C adapter
i2c-10 i2c i2c-11-mux (chan_id 1) I2C adapter

And i2cdetect -y 0 gives me a completely empty grid, nothing detected at all.

That output is actually the key.

Look at the name of the adapters: i2c-11 is the physical bcm2835 bus, and it gets split through a mux into two channels:

  • chan_id 0 → i2c-0
  • chan_id 1 → i2c-10

The focus controller is not on the i2c-0 channel. That’s why i2cdetect -y 0 comes back with dashes everywhere.

Can you paste the full grid from i2cdetect -y 0 so we can confirm it’s empty, and then also run:

i2cdetect -y 10

That’s the command that should actually be used on this setup. There’s also an updated manual here: https://www.uctronics.com/download/Amazon/B0176R_Manual.pdf

Here’s the i2cdetect -y 0 output, all dashes as I said:

     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

I’ll try i2cdetect -y 10 next and report back.

Perfect, that confirms it. The empty grid means the scan ran fine, there’s just nothing on that channel.

So two things to keep in mind for this board:

  1. Use the right bus number. Replace i2cdetect -y 0 with i2cdetect -y 10.
  2. Refer to the updated doc when in doubt: https://www.uctronics.com/download/Amazon/B0176R_Manual.pdf

Let us know what i2cdetect -y 10 shows and we’ll continue from there.

OK, i2cdetect -y 10 does show an address now, so the “can’t see the camera on the I2C bus” part is solved.

But I hit two more things:

  1. The camera only shows itself on the bus if it’s actually powered on. I have to run raspistill -t 0 first, then it appears and only then I can send focus commands. Is that expected?

  2. The Focuser.py example refers to I2C 7. It needs to be modified to work with i2c0 (or rather the correct bus on this setup), otherwise it just errors out for me.

In my opinion the documentation and the example programs should be revised, this is pretty confusing for an end user.

Both observations are correct, and they’re good feedback.

On the power-on point: yes, the focus controller on the camera module is only present on the I2C bus once the sensor/camera has been activated. So raspistill -t 0 (keeps the camera open) makes the device appear so you can then talk to it over I2C. Without that, the address won’t respond.

On Focuser.py: that example hardcodes a bus number (it references I2C 7), so on your setup it has to be changed to match the muxed channel you actually detected. That’s a documentation/example issue rather than a hardware problem.

Could you do one more thing for us? Confirm which bus had the address in the output of i2cdetect -y 10 so we can note whether the change should be to i2c-0 or keep i2c-10 in your case.

The address shows on i2c-10 (the mux channel 1 one), not i2c-0. So in Focuser.py I’m currently adjusting the bus reference so it points at the right adapter.

One last question: are the instructions in B0176_Manual.pdf to command the focus through I2C actually the only ones needed for this board? Or do they need to be integrated with the updated ones? I want to know if I’m missing a step or if the manual is just outdated.

Thanks, that matches what we expected on this mux setup, so to summarize the state of things:

  • i2c-11 is the physical bcm2835 bus and it’s split through a mux into chan_id 0 → i2c-0 and chan_id 1 → i2c-10.
  • The focus controller is on the i2c-10 channel, so the correct detect command here is i2cdetect -y 10, not i2cdetect -y 0.
  • The camera must be powered/activated (e.g. raspistill -t 0) before its address appears on the bus and focus commands can be sent.
  • Focuser.py references a hardcoded I2C bus (I2C 7), so it has to be edited to point at the correct bus for your configuration.

As for the manual: the B0176 instructions alone aren’t sufficient/current for this muxed numbering, so use the updated B0176R manual: https://www.uctronics.com/download/Amazon/B0176R_Manual.pdf and treat the bus number as i2c-10 in your case. We’ve noted your feedback that the docs and the example programs should be revised to avoid this confusion for other users. If you still can’t get the focus commands through after fixing the bus in the script, post the exact error and we’ll keep digging.