Motorized Focus Camera Quick Start¶
Use this guide to connect an Arducam motorized focus camera to a Jetson, verify a live preview, and adjust focus. It covers the Jetson Nano, Xavier NX, Orin Nano, and Orin NX configurations listed in the compatibility guide.
| Camera | Start here | Focus methods in this guide |
|---|---|---|
| Native IMX219 motorized focus | IMX219 setup | Manual focus and autofocus |
| Native IMX477 motorized focus | IMX477 setup | Manual focus and autofocus |
| Jetvariety motorized focus, including IMX230 (B0324) | Jetvariety setup | Manual focus through V4L2 |
1. Check compatibility¶
- Identify your camera SKU, Jetson module, and carrier board.
-
Find your installed Jetson Linux (L4T) release.
head -n 1 /etc/nv_tegra_release -
Check that your Jetson, L4T release, and camera combination appears in the Arducam compatibility matrix. For a third-party carrier board, check the board vendor's camera and BSP instructions.
2. Connect the camera¶
Shut down the Jetson and disconnect its power before inserting or removing the CSI cable. Check the connector label, cable pin count, and contact orientation at both ends.
| Carrier board | Cable and connection reference |
|---|---|
| NVIDIA Jetson Nano / Xavier NX developer kit | Match the ribbon cable to your camera and carrier board. See the native camera hardware connection guide. |
| NVIDIA Orin Nano reference carrier board | The board has 22-pin bottom-contact CSI connectors. For a 15-pin camera, use a matching 15-to-22-pin conversion cable. For a 22-pin camera, check that the 22-to-22-pin cable matches your camera's pinout. See the NVIDIA hardware layout. |
| Orin NX on the NVIDIA Orin Nano reference carrier board | Follow the same connector guidance. If your Orin NX uses another carrier board, follow that board's wiring diagram. |
- Open the CSI connector latch gently.
- Slide the ribbon cable straight into the connector, with its exposed contacts facing the connector contacts. The cable should sit evenly across the connector.
- Hold the cable in place and close the latch. Repeat at the camera end if the cable is detachable, then reconnect power.
Jetvariety on the NVIDIA Orin Nano reference carrier board
Use the CSI connector closest to the DC barrel jack (CAM1) for Jetvariety cameras on Jetson Orin Nano and Orin NX. See the Orin compatibility and port notes.
3. Set up the driver and confirm the video device¶
Follow the driver instructions for your camera before testing video.
| Camera | Driver setup |
|---|---|
| Native IMX219 | Use the native driver on a supported Jetson Linux release. Follow the native camera guide for camera setup and preview. |
| Native IMX477 | Follow the native camera driver guide for your L4T release. |
| Jetvariety | Install the matching driver and preview dependencies. Follow the Jetvariety quick start. |
If v4l2-ctl is missing, install v4l-utils from the Jetson's configured package repository.
v4l2-ctl --list-devices
Identify the capture node for the connected camera. The examples below use /dev/video0. Substitute your actual node if it differs.
v4l2-ctl -d /dev/video0 --list-formats-ext
The output should show the formats and frame sizes reported for the selected node. If there is no matching device or capture format, start with Troubleshooting.
4. Set up and adjust focus¶
Start with one connected camera. Use a graphical desktop for the preview and a terminal for manual focus controls. Aim the camera at a stationary subject with visible detail so you can see the change in sharpness.
Install git if needed. The demo commands assume Python 3 and the dependencies required by your camera. The native demos also need NumPy, an OpenCV build with GStreamer support, the NVIDIA Argus/GStreamer camera stack, and access to the camera's I²C bus.
Run the following once in your home directory. If you already cloned the repository there, use that copy.
cd ~
git clone https://github.com/ArduCAM/MIPI_Camera.git
Find the I²C bus for IMX219 or IMX477¶
The native focus scripts take an I²C bus number with -i. The table gives reference values for Nano B01 and Xavier NX developer kits. Confirm the mapping for your carrier board, BSP, and physical camera port before running a demo. If the i2cdetect command is missing, install i2c-tools. See the Arducam focus demo README.
| Jetson configuration | CAM0 I²C bus | CAM1 I²C bus |
|---|---|---|
| Jetson Nano B01 | 7 | 8 |
| Jetson Xavier NX developer kit | 10 | 9 |
| Jetson Orin Nano / Orin NX | Confirm with the carrier board and BSP documentation | Confirm with the carrier board and BSP documentation |
i2cdetect -l
read -r -p 'Enter the confirmed camera I²C bus number: ' I2C_BUS
i2cdetect -l lists available adapters. Use your board's camera-port mapping to identify which adapter belongs to the connected camera. Run the focus commands in the same terminal where you set I2C_BUS. CAM0/CAM1 are physical connectors, while /dev/videoN identifies a Linux video device.
IMX219 motorized focus¶
- Follow the native CSI camera guide to verify the IMX219 preview using the supported native driver. Close that preview before running a focus demo, which opens its own capture stream.
- Select the I²C bus.
-
Open the manual focus demo. Use the arrow keys to change focus and press
qto quit.cd ~/MIPI_Camera/Jetson/IMX219 python3 FocuserExample.py -i "$I2C_BUS"
For autofocus, the upstream IMX219 script accepts -i but uses two Python 2-style print statements. In the same directory, copy it to Autofocus-py3.py:
cp Autofocus.py Autofocus-py3.py
Update the two lines in the copy, keeping their existing indentation:
- print gstreamer_pipeline(flip_method=0)
+ print(gstreamer_pipeline(flip_method=0))
- print 'Unable to open camera'
+ print('Unable to open camera')
Close the manual demo, then check the modified script and run autofocus:
python3 -m py_compile Autofocus-py3.py
python3 Autofocus-py3.py -i "$I2C_BUS"
Keep the subject still while the demo adjusts the lens. Press Esc to quit.
IMX477 motorized focus¶
- Verify the preview using the native camera guide, then close it.
- Select the I²C bus.
-
Run one of the following demos at a time.
Autofocus. Keep the subject still while the lens adjusts. Press
Escto quit.cd ~/MIPI_Camera/Jetson/IMX477/AF_LENS python3 Autofocus.py -i "$I2C_BUS"Manual focus. Use the arrow keys to adjust the lens, and press
qto quit.cd ~/MIPI_Camera/Jetson/IMX477/AF_LENS python3 FocuserExample.py -i "$I2C_BUS"
Jetvariety motorized focus¶
- Identify your video node. The preview and focus demos use
-dfollowed by the numeric suffix of the same node. For example, use-d 0for/dev/video0or-d 2for/dev/video2. -
Start the preview in the first terminal.
cd ~/MIPI_Camera/Jetson/Jetvariety/example python3 arducam_displayer.py -d 0 -
Keep the preview open. In a second terminal, check that the same device exposes
focus_absoluteand that the control is active.v4l2-ctl -d /dev/video0 --list-ctrls -
Start the manual focus demo in the second terminal. Press the arrow keys to adjust focus,
rto reset, orqto quit.cd ~/MIPI_Camera/Jetson/Jetvariety/example/focus python3 FocuserExample.py -d 0
The Jetvariety focus demo above adjusts focus manually. For an autofocus demo, check the instructions for your exact camera SKU. The repository's Focuser.py runs a lens movement test when executed directly.
Troubleshooting¶
| Symptom | What to check |
|---|---|
Camera is missing from v4l2-ctl --list-devices |
Power off and reseat both ends of the cable. Check cable orientation, the required CSI port, and the driver for the installed L4T release. |
| A video node exists, but the preview fails | Confirm it is the camera's capture node, check its reported formats, and close other software using it. For the native demos, also verify the Argus preview and OpenCV's GStreamer support. |
| Native preview works, but the lens does not move | Verify the actuator is present on your SKU, confirm the port-to-I²C mapping, and check access to the selected I²C device and the availability of i2cset. |
| Jetvariety preview works, but focus does not respond | Use the same video node in both terminals and check whether focus_absolute is present and active. |
IMX219 autofocus reports a SyntaxError at print |
Run the Python 3 copy after applying both edits in the IMX219 section. See IMX219 setup. |
When requesting support, include the camera SKU, Jetson module, carrier board, L4T release, CSI port, video node, exact command, and complete error output.