Maybe your raspberry pi is not getting enough power? many people have mentioned weird behavior on older 2b models?
I ran your test and I'm able to pass a value and changing the focus manually, still the arrows are greyed out but at least now I can set the focus on my 3d printer. I'd love to know why the plugin doesn't work on my configuration, that's weird. I can use the OctoPrint stream to check the focus, I also tried the 8080 port and it works too.
Thanks to your code snippet at least I can use the camera now at least!
All the control buttons are disabled in your view there. Are the buttons enabled when you aren't printing and connected to the printer?
Just took a quick look at the code and your printer has to be connected and in an operational state for the buttons to be enabled.
Ah ok, then I'll try later, my printer is in the garage and it gets hot so I was testing inside the house. Thanks for the clarification. Maybe I made up a problem that didn't even exist but at least I learned a tons thanks to you guys, really appreciate the support. Maybe include a disclaimer about this behavior?
glad we got it working
Halelujah! This finally got my Arducam OV5647 to focus AND I can see the result immediately in Octoprint. All previous attempts to use the Plugin failed as described in posts here. Buttons greyed, clicking them does nothing. Also, attempts to run the canned scripts provided by Arducam all failed as well with either "file not found" error or something to do with a keyboard; ELFCLASS32. The folks at Arducam claimed it was Octoprint interfering but the test.py script here works just fine and the results are being viewed in Octoprint sooooo....
Anyway, now to add some buttons in Octoprint to control focus.
I just ran into a problem with the plugin that needed changing. I installed the ArduCam on my OctoPi and I was able to change the focus with the tools provided by Arducam, but I was getting
"Trouble accessing camera. I2C bus failure. Is camera plugged in?"
When trying to run "ArduCam Focus". I looked all over the place and then listed my i2c devices here:
$ ls -l /dev/i2c*
crw-rw---- 1 root i2c 89, 0 Mar 26 16:40 /dev/i2c-0
crw-rw---- 1 root i2c 89, 1 Mar 26 16:40 /dev/i2c-1
crw-rw---- 1 root i2c 89, 10 Mar 26 16:40 /dev/i2c-10
crw-rw---- 1 root i2c 89, 11 Mar 26 16:40 /dev/i2c-11
And noticed there was nothing on /dev/i2c-0 and /dev/i2c-1 with the following command gave me those devices too.
$ i2cdetect -l
i2c-1 i2c bcm2835 (i2c@7e804000) I2C adapter
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
With the test.py program:
#!/usr/bin/env python
import smbus
import pprint
bus = smbus.SMBus(0)
pprint.pprint(bus);
bus.write_byte_data(0xc, 0x06, 0x40)
Did not work for me and I had to change the following line
from
bus = smbus.SMBus(0)
to
bus = smbus.SMBus(10)
I'm not sure what's on the 0 bus but it will not work for me. But after changing to bus "10", the test.py program works.
So I edited my
"/home/pi/oprint/lib/python3.7/site-packages/ArduCamFocus/__init__.py" script and changed the following
self.bus = smbus.SMBus(0)
to
self.bus = smbus.SMBus(10)
Now the "ArduCam Focus" plugin works great! I will be happy to work with you to share my Octopi's configs and anything else you need.
I'm just hopping in to say that I was experiencing the same error and it was driving me crazy. I went straight into the init.py file, made your suggested change, and it now works perfectly! Thank you for this information!
Ok itt seems im having the same issue, I have added the lines in ssh and get this
-bash: /boot/config.txt: Permission denied
I added them thru the telnet interface and double checked they are there.
I deleted and downloaded the plugin from the link you provided in another reply. Still same
I get the unable to use SMBus/I2C
This is driving me insane.
I even reinstalled octopi
Not sure what else to do
any suggestions
Chris
I use the plugin put out by arducam directly and it worked last time I tried it after finding one fix on the system side. I updated the instructions on the plugin's listing accordingly.
talking about the link to github in thread history cause I tried that too. I think I might be updating wrong config.txt maybe. I pulled sd card out of pi put in reader and added the lines to the config on the sd card...Is that the right one??? First pi never messed with before couple days ago so bear with me. I am having to do a lot of googling to keep up...
I think I may have found it, I did not do this part till just now...
sudo raspi-config
after fighting with this for a day, I finally got past unable to use smbus now I am getting
Trouble accessing camera. I2C bus failure. Is camera plugged in?
I have a pic on the app so YES camera is plugged in you goofy plugin...
Ok, Finally got it changing SMBus(0) to (10) did the trick.
Thanks
I am new to all of this, so I'm sorry if this is obvious - but how would I go about to edit the init.py file? Would I be able to edit it via SSH using Putty? Thank you so much!
I won't do this to code from someone else.
With the next update your changes are gone...
Better get in contact with the author and discuss an optimization by them. (Github)
Can someone help me im new to all this and im supper lost on my problem and like a week of looking.
i have a arducam imx708 auto focus and i about a week ago i just got it to work with octoprint with google ai (works well) but now im trying to use this focus plugin and im getting a i2c bus error i did follow some othe guides here but honesty i dont know any of this and need help
might help to share your system info bundle so we can see the same error you see. did you raspi-config and enable i2c? which exact camera?
Here is my system info. yes i have 12c enable that was my first problem after i fix that i got this error and i link the exact model camra i bought. thanks for the help
octoprint-systeminfo-20250607130915.zip (577.1 KB)
https://www.amazon.com/Arducam-Raspberry-Camera-Autofocus-15-22pin/dp/B0C9PYCV9S/ref=sr_1_4?crid=XSYB18MI4HHO&dib=eyJ2IjoiMSJ9.f3W5BgQppImbdI7czgkkpwe6RgjIIbgD-Mvya7Lo-euCPn3QQCPVaVfEde86kw-v-VYDT-WE6VHkJ76tI9Oc9K4-vnWjOxr-tqfm3czfD4pphN7kj515LRKx1UA-vA0talhqqhrdrJ3Plh4hVhcDxc5DOmbt7y9TZlrenSv8PO4zlEQYliVFMdkb6kl1TxnZQVMzScq6QN9-sKckjBNddxHGXV-zNtQ9X9_Q9uPicdc.X8crIdqZmGfi1UGBKw_cdicHlxvDGmEZIeIsLsv_MPw&dib_tag=se&keywords=arducam+imx708&qid=1749319804&sprefix=arducam+imx708%2Caps%2C130&sr=8-4
Ok, that camera's focus is automatic, but might be possible to control via libcamera options for camera-streamer plugin.