USB cameras in robots: what UVC is and why it is easy to use
Atlasbot · 18/8/2026 · 11 min read
For robots to "see", rather than just measure distances like the LiDAR (studied at LiDAR), cameras are the cheapest and most versatile sensors — that detect colors, objects, barcodes, or run visual AI models. The easiest type of camera to use on Linux/ROS2 is USB Standard UVC Camera.
Key concepts
UVC (USB Video Class) is a general USB communication standard for — webcam, low-cost industrial camera — video devices that is Linux pre-supported in the kernel via the uvcvideo driver. This allows most USB cameras to "root" in Ubuntu without the separate drivers needed for many other embedded devices.
How it works
When a UVC camera is plugged into a Linux machine, the system creates the device as /dev/video0 (or /dev/video1, /dev/video2... if there are multiple cameras) — which is the standard interface that both the command - line tool, OpenCV, and the ROS2 camera package use to read frames.
ls /dev/video* # list current camera devices
v4l2-ctl --list-devices # view device name for each /dev/videoN
Technical details
Formulas
the USB bandwidth required to transmit raw (uncompressed) video increases rapidly with resolution and frame frequency — factors determining whether the camera is "slip smooth":
bandwidth (bytes/s) = Width × Height × Number of bytes per pixel × FPS
VD: 640×480, YUYV format (2 bytes/pixel), 30 FPS
bandwidth ≈ 640 × 480 × 2 × 30 ≈ 18.4 MB/s
USB 2.0 (theoretical bandwidth ~35-40MB/s real-world) is sufficient for this configuration,
but higher resolution (1920×1080) at the same FPS may exceed
USB 2.0, MJPG or USB 3.0
Parameters
| Reason for choosing USB Camera | Details |
|---|---|
| Unnecessary separate driver | Use the uvcvideo driver available in the Linux kernel |
| Cheap, diverse options | From commercial webcam to high resolution UVC industrial camera |
| ROS2 pre-compatibility | Package usb_cam/v4l2_camera straight reads /dev/videoN, publish standard topic |
Practical applications
The package usb_cam or v4l2_camera reads straight from /dev/videoN and publishes to the standard ROS2 topic (sensor_msgs/Image), ready for OpenCV or further visual AI models — which is the same type of camera used in the Atlas A2 project in the showcase section of this page, combined with YOLOv8 for real - time object recognition. Between the two popular packages, v4l2_camera straight calls the V4L2 API (the next article) as being lighter and less dependent, while usb_cam has several more convenient options (auto-publish camera_info for calibration) — with newly started DIY robots, v4l2_camera is usually the simple option for fast boot.
Practical example
# Check received camera, see supported format/resolution
v4l2-ctl --list-devices
v4l2-ctl -d /dev/video0 --list-formats-ext
# Run node ROS2 publish image from camera
ros2 run v4l2_camera v4l2_camera_node --ros-args -p video_device:=/dev/video0
ros2 topic echo /image_raw --once
Typical output from --list-formats-ext:
[0]: 'YUYV' (YUYV 4:2:2)
Size: 640x480 Interval: 1/30 (30.000 fps)
Size: 1280x720 Interval: 1/15 (15.000 fps)
[1]: 'MJPG' (Motion-JPEG, compressed)
Size: 1920x1080 Interval: 1/30 (30.000 fps)
Note: MJPG (pre-compressed in camera) usually supports higher resolution/FPS than raw YUYV at the same USB bandwidth — as calculated in the Formula section.
Common mistakes
-
Mis-selected ROS2 package for real-world demand— uses
usb_camfor a pipeline that does not needcamera_inforendering redundant configuration unnecessary, or vice versa lackingcamera_infowhen actually needed calibration (Camera Calibration). -
Requires resolution/FPS over USB real-world bandwidth— as calculated in the Formulary section, causing node or picture errors; check
--list-formats-extfirst to see if the camera combination actually supports it. -
Assessment of raw YUYV format with compressed MJPG when estimating bandwidth— two formats that have vastly different bandwidth requirements at the same resolution/FPS.
-
Don't check that
/dev/videoNis the correct desired camera when multiple cameras are plugged in at once— the order number/dev/videoNcan change between bootstarts, requiring confirmation withv4l2-ctl --list-devicesrather than a fixed assumption. -
Select very high resolution industrial cameras for applications that only need basic identification — wasting bandwidth and unnecessary processing resources if real-world applications do not require that level of detail.
Conclusion
The UVC Standard Camera USB is the simplest starting point for adding vision to the ROS2 — robot that does not require drivers, is low-cost, and has a built-in ROS2 tool/package ecosystem. Properly understanding USB bandwidth limits helps to choose the correct resolution/FPS/compression format from the start, avoiding diagnostic errors later. The next article delves into the V4L2 — communication layer below the UVC that Linux uses to control the camera.
Get new articles and lessons by email
When a new technical article or course module is published, Atlas Robotics sends you a short email. No spam.
Unsubscribe any time with the link in each email. See our Privacy policy.