Cameras for Raspberry Pi

  1. Home
  2. Docs
  3. Cameras for Raspberry Pi
  4. Native Raspberry Pi Cameras
  5. How to use Arducam Motorized Focus Camera with OctoPi to monitor 3D printers

How to use Arducam Motorized Focus Camera with OctoPi to monitor 3D printers

Why add a camera to your 3D printers?

Most 3D models take more than a few hours to print, so you may wish to leave the 3D printer at some point in the printing process. Using an Arducam camera to monitor 3D printing can make you pay close attention to your creation. Since most cameras are not made specifically for the use of 3D printing software, it is impossible to obtain proper support from the manufacturer. Fortunately, Arducam can help you solve all installation and setup problems. For the actual 3D printing scene, we have introduced the motorized focus camera module, you can click the following part to learn more.

In this document, we will introduce the method to use Arducam motorized focus camera modules to monitor 3D printers.

By the way, you may be want to know How to use Arducam PTZ Camera with OctoPi to monitor 3D printers.

1. Do you know OctoPi

1.1. What is OctoPi

The snappy web interface for your 3D printer.

OctoPrint is an open-source web interface for controlling and monitoring 3D printers. OctoPrint allows users to control their 3D printers from within their local home network. OctoPrint is maintained by Gina Häußge, the original creator. Out of the box, OctoPrint is compatible with most of the available consumer 3D printers. And its powerful plugin system allows extending its functionality in various ways. Control and monitor every aspect of your 3D printer and your printing jobs right from within your browser. OctoPrint is Free and Open Source Software released under the GNU Affero General Public License (AGPL). All its source code is available in its Github repository and everyone can modify it to their own needs.
To learn more about OctoPrint, please click here!

1.2. Download and install OctoPi

If you have been accomplished OctoPi installation and WiFi setup, please go to the chapter on How to use the motorized focus camera.

1.2.1. Download OctoPi 0.18.0

Download link: https://octoprint.org/download/

The page also includes basic installation directions as well as a video describing the installation process.

1

1.2.2. Configure WiFi

After you have successfully downloaded the OctoPi image and “burned” it onto your SD card, you can start to set up WiFi. More about WiFi setup and troubleshooting refer to here!

2
3
4
5

2. How use the motorized focus camera

2.1. Hardware setup

12
Wiring diagram

Reboot

After the hardware is complete, please enter the following command reboot.
sudo reboot

2.2. Detect the camera

vcgencmd get_camera 
7

2.3. Download and Install Arducam camera focus control plugin

2.3.1. What is Arducam camera focus control plugin

There is a plugin to control an Arducam motorized focus camera using the OctoPrint Control tab. 

19

It utilizes these custom commands from your slicer to adjust focus while printing:  @ARDUCAMFOCUSSET <ABS-FOCUS> to specify an absolute focus. This command is handy to reset the focus when starting a new print after a power failure.

Example: @ARDUCAMFOCUSSET 100 will move the focus to 100.

The entire range is 0~1023. Setting 0 corresponds to infinity, and setting 1023 corresponds to a close focal length of about 5CM.

2.3.2. Enable I2C Interface

The plugin uses I2C to communicate with the camera. However, I2C is not enabled by default. The Arducam Focus plugin will not function until you enable I2C. 

Please ssh to your Octopi and enter these commands (This only needs to be done once):

if ! grep -Fxq "^#ArduCamFocus$" /boot/config.txt; then
sudo cat << end_of_file >> /boot/config.txt
#ArduCamFocus
dtparam=i2c_vc=on
dtparam=i2c_arm=on
end_of_file
fi

After executing the above command, the file /boot/config.txt should now have the commands to enable I2C. In addition, you have to enable the I2C kernel module using the raspi-config Tool. Again, ssh to your octopi, and then enter this command:

sudo raspi-config
  1. select “5 Interfacing Options”
  2. select “P5 I2C”
  3. raspi-config will ask, “Would you like the ARM I2C interface to be enabled?”
  4. select “Yes”
  5. you should see, “The ARM I2C interface is enabled”
  6. select “Finish”

After you reboot, the camera should become operational in OctoPrint.

2.3.3 Download the Plugin

/home/pi/oprint/bin/pip install https://github.com/arducam/ArducamCameraControl/archive/master.zip
1 2

Open up the Octopi login page: http://[IP]/#control

Note

[IP] is replaced with the following IP address shown in the figure below( After the Wifi configuration is complete, power on, and the IP address will pop up).

2 2

Now you can use the tab as the following figure to adjust focus.

3 2

2.4. Show results

A video can clearly show you how to use the Arducam focus control tab after the plugin is installed successfully. From the video, you can drag the Arducam Focus Control tab to adjust the focus, you can clearly see that the shooting picture changes from blurry to clear.

3. Troubleshooting

3.1 Failed to run camera with raspstill

8

The raspistill requires full access to the camera device when it runs, which is being locked by the webcamd service. You would have to stop the webcamd service in order to use the raspistill. Otherwise, you will not be able to open the camera as the following figure.

If you want to use our motorized focus camera, please refer to this doc to access Arducam Motorized Focus Camera on OctoPi.

Was this article helpful to you? Yes No