• Models
  • Contests
  • Slicer
  • Login
  • Start Here
    thingiverse-iconprintables-iconcults3d-iconmakerworld-iconmyminifactory-icon

    3D GO

    3D ModelsContestsCollectionsSaved ModelsOn a mobile device?

3D GO

Privacy Policy
xTool P2 Raspberry Pi Camera Mount 3D Printer File Image 1
xTool P2 Raspberry Pi Camera Mount 3D Printer File Image 2
xTool P2 Raspberry Pi Camera Mount 3D Printer File Image 3
xTool P2 Raspberry Pi Camera Mount 3D Printer File Image 4
xTool P2 Raspberry Pi Camera Mount 3D Printer File Image 5
xTool P2 Raspberry Pi Camera Mount 3D Printer File Thumbnail 1
xTool P2 Raspberry Pi Camera Mount 3D Printer File Thumbnail 2
xTool P2 Raspberry Pi Camera Mount 3D Printer File Thumbnail 3
xTool P2 Raspberry Pi Camera Mount 3D Printer File Thumbnail 4
xTool P2 Raspberry Pi Camera Mount 3D Printer File Thumbnail 5

xTool P2 Raspberry Pi Camera Mount

Gizmo Goody avatarGizmo Goody

May 26, 2026

printables-icon
DescriptionCommentsTags

Description

Disclaimer

Follow all applicable safety precautions (consider watching xTool’s laser safety training) when operating a P2 or any other Class 4 laser. Monitor the laser cutter at all times.

Motivation

It is hard to get a good look at how a laser cut/engrave is going once the xTool P2’s lid is down/locked and the laser is in operation. The primary challenge is that the front of the lid obstructs a direct view of the workpiece while in operation.

Solution

Design and print a custom camera mount that achieves the following objectives:

  • Fit and securely mount a low-profile camera for video streaming (e.g. RTSP) and required accessories inside the P2 with zero interference to normal operation

    • Raspberry Pi Cameras have standardized sizing and mounting points in a small form factor and connect via a flat ribbon cable that can be easily managed out of the way of the laser assembly and through small gaps in the P2

  • Maximize the field of view (FoV) to cover as much of the work bed as possible in “Process on Slats” mode accounting for visibility of the tallest object possible (25 mm) placed all the way at the back limit.

    • Specifically, the Raspberry Pi Camera v3 Wide has a vertical FoV of 67° and a horizontal FoV of 102°.

This is what that Field of View translates to when installed using this mount:

Materials

  • Raspberry Pi Camera v3 Wide (not Standard)

  • Raspberry Pi (RPi) – I used a spare Raspberry Pi 3B+ but here are some key considerations for this project considering streaming video can be resource and bandwidth intensive:

    • RPi Cameras connect to an RPi via a ribbon cable (known as a CSI cable). The connector on RPi Cameras is a standard/wide 15 pin connector, but some RPi’s (e.g. all RPi Zero’s and the latest full size RPi 5) have a mini/narrow 22 pin connector. While there are standard-to-mini ribbon cables, I could not find one long enough (see below). Another option is to use an extender, but I did not want to introduce two more points of failure.

    • While some RPi’s have WiFi capability, streaming will be the most reliable and of the highest quality if you can connect to an Ethernet cable. Only the full sized RPi’s (i.e. non-zero version) have an Ethernet port.

    • Otherwise, the higher the CPU and more RAM you have, the better your chances of achieving good streaming results.

          For all of these reasons, the Raspberry Pi 4 Model B with at least 4 GB RAM is probably ideal for this project.

  • microSD Card

  • Raspberry Pi power supply – Provide sufficient power. You may be tempted to use an old iPhone USB power plug and think it’s working, but then later when you’re trying to configure your stream you may have issues which are not easily traced back to insufficient power.

  • CSI ribbon cable – I used a 1 meter 15 pin-to-15 pin cable which is probably the right length for this project. The link shows it in white, but the one I purchased was black as you’ll see in the pictures. Probably pick the color based on the color of your P2. Choose the proper cable connections (and optional extenders/adapters) based on the RPi you choose.

  • Printed parts

    • Mount Base

    • Mount Cover

    • (Optional) Raspberry Pi mount (not available as part of this model)

  • Small piece of ~1.25 mm thick double-side adhesive (~30 mm long x 1 in wide) – This thickness was a design parameter to achieve the same curvature as the inside of the lid. So, get as close to this as possible. Here is the tape I used (I could not find a link to this exact product on Amazon or I would have posted a link as well):

  • Small pieces of thin double-sided adhesive – I used a few off the sheet provided with the fire safety set sensor kit

Printing

See the attached .3mf for my settings and model orientation (no supports required).

Post-Processing

Assemble and disassemble the base and cover a few times to ensure they are a good fit. Clean up as necessary. The four posts for the camera board can be broken off if stressed at an angle, so use the indents to apply even force directly in the middle when separating. If the fit is too tight to separate with your fingers, there is a recess for slipping a small flathead screwdriver in and applying a slight torque to start the separation.

Installation

     1. Make a mark at 354 mm from the right edge of the lid just below the groove in the lid (see picture)

          a. This will laterally center the camera on the zone that can be imaged by the P2’s close shot camera, not the center of the entire “Process on Slats” work area. If you would prefer that, the measurement should be ~382 mm from the right edge of the lid.

     2. Apply the thick adhesive to the curved side of the mount base and remove the protective film

     3. While keeping both faces of the mount parallel to the inside surface of the lid and the larger gap oriented toward the back of the lid (down when open) adhere the mount base to the inside of the lid with the index centered on the mark from step (1).

     4. Connect the camera to the RPi

          a. Connect one end of the CSI ribbon cable to the RPi Camera

          b. Route the other end through the gap at the back of the P2’s lid without twisting it

          c. Connect the other end to the RPi

     5. Place the RPi camera onto the mount base pins

     6. Snap the cover onto the base

     7. Attach the ribbon cable to the underside of the lid glass with pieces of thin adhesive and continue so that it lays flat across the top of the back cover

Raspberry Pi, SSH, and Camera Configuration

Raspberry Pi Configuration

     1. Follow these instructions to Download and Install Raspberry Pi Imager then use it to flash your microSD card

          a. At the Choose OS step, you can either:

               i. Select the recommended Debian Bookworm or

               ii. (Suggested) Since the Raspberry Pi in this project will likely be installed headless (over the network and without keyboard, mouse, or display attached), the Lite version will save some storage space. To install the Lite OS, click “Raspberry Pi OS (other)” then “Raspberry Pi OS Lite (XX-bit).” To determine if your Raspberry Pi will support 64-bit (preferred), see this article.

          b. When presented with the Use OS Customization? window, choose EDIT SETTINGS and configure as follows substituting a custom hostname for the Raspberry Pi on your network, a good password to be used when configuring the Raspberry Pi, and your own WiFi network connection information. Then Save and proceed with writing the microSD card.

          c. When the write is complete, ignore any Windows pop-ups indicating you need to format the new drive. Windows just doesn’t know how to read it since it’s imaged with Linux.

     2. Continue by connecting the camera ribbon cable, Ethernet cable (if available), and then the power supply. Wait ~5-10 minutes while the Raspberry Pi configures itself for the first use, then continue.

     3. At this point, the Raspberry Pi should be on your network. You can check your Router to confirm and for more information like it’s assigned IP address, etc. Retrieve that information, then continue to configure the SSH connection.

SSH Configuration

     4. Follow these instructions to use PuTTY to SSH into your Raspberry Pi to configure it. Here is an example from my configuration.

Note, I could have used “lasercam.local” in place of the IP address, but since I configured a Static IP address for my Raspberry Pi, I just use the IP address when connecting via SSH. Don’t worry about any of the other configuration options in the left pane. You should be able to simply enter your Raspberry Pi’s hostname/IP address and click Open.

     5. Once the SSH connection is successful, you’ll be presented with a screen like this:

Congratulations, you are now connected via SSH over your network to your headless Raspberry Pi!

     6. The Raspberry Pi image you used is likely already out of date, so you need to first update a bunch of packages to ensure your Raspberry Pi has the latest and greatest software packages and install one required to stream. Type each of these commands (or Copy and Right-Click to Paste) and hit Enter after each one. When asked if you want to continue, select ‘y’ for Yes.

sudo apt update

sudo apt full-upgrade Go do something else for 5-10 minutes

sudo apt install vlc Go do something else for 5-10 minutes

sudo reboot

RTSP Configuration

     7. Now let’s start testing and configuring the camera…finally!

          a. First, reconnect via SSH using PuTTY since the reboot would have disconnected you.

          b. Test the camera connection and determine native sensor and output resolutions and framerates: rpicam-hello --list-cameras

          c. Test the RTSP stream.

               i. Stream Server – Raspberry Pi

                    1. This is the command that I’m currently using:


rpicam-vid -t 0 --mode 2304:1296:10 --width 1920 --height 1080 --framerate 30 --vflip --hflip --inline --level 4.2 --denoise cdn_off -o - | cvlc stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/stream}' :demux=h264


Parameter settings (--<parameter_name> <parameter_value>) for the ideal stream balance output resolution, framerate, field of view, bit rate, etc., and depend on external factors like available light, network bandwidth, etc. Please let me know if you have any suggestions to further optimize them (Messenger | Printables.com).

                    2. If the command is successful, a new command line will output with each new frame

               ii. Viewer Client

                    1. VLC on Windows

                         a. Download and Install

                         b. Ctrl-N

                         c. rtsp://<hostname or IP address>:8554/stream

                        d. Click “Play”

               iii. VLC on iOS

                         a. Install from the App Store

                         b. Click “Open Network Stream"

                         c. rtsp://<hostname or IP address>:8554/stream

                         d. Click “Open Network Stream”

               iii. Ctrl-C to stop the stream

     8. Now, you don’t want to have to enter this command every time you want to start the stream, so let’s put it in a file called a script:

          a. SSH in via PuTTY

          b. mkdir scripts

          c. cd scripts

          d. sudo nano lasercam.sh

               i. Line 1: #!/bin/bash

               ii. Line 2: Copy and Right-Click to Paste the entire camera configuration line from the RTSP test in the previous step (i.e. rpicam-vid …)

               iii. Ctrl-S

               iv. Ctrl-X

          e. sudo chmod +x lasercam.sh

          f. ./lasercam.sh (The stream should start again)

          g. Ctrl-C to stop the stream

     9. Our final step is to configure the script as a service to run automatically when the Raspberry Pi boots up and to restart the stream if something causes it to stop.

          a. sudo nano /etc/systemd/system/lasercam.service

          b. Copy and Right-Click to Paste this entire text block:

[Unit]
Description=Laser Camera Start Script
After=network.target

[Service]
ExecStart=/home/pi/scripts/lasercam.sh
Restart=always
RestartSec=10
User=pi

[Install]
WantedBy=multi-user.target

          c. Ctrl-S
          d. Ctrl-X
          e. sudo systemctl daemon-reload
          f. sudo systemctl enable lasercam.service
          g. sudo systemctl start lasercam.service

     10. That’s it, you should be good now. Please let me know if you have any questions (Messenger | Printables.com).

Notes

The RPi Camera lens and sensor assembly (highlighted with a red border below) is attached to the camera PCB board with a small foam spacer pad. This spacer can compress by even the slightest touch. If you’re trying to nail the alignment and wondering why you cannot center or eliminate skew in the image, this is probably the cause. Gently tap or rotate slightly on the silver part to encourage the lens to point closer to your intended aimpoint.

Next Steps

My testing indicates that the RPi Camera v3 Wide is likely the most ideal affordable small form factor camera for this application and that this mount positions it in the most ideal location to maximize the field of view. Using the configuration above, I have it successfully serving an RTSP stream that I can view on my desktop, iPhone, and even Home Assistant.

I will continue to optimize the camera configuration and make changes as necessary to these instruction.

Time lapses and other fun ideas are also possible with this setup.

Shameless Plug

If this model helped you solve a problem, save some time, or in any way made your life a little easier then please consider clicking the Like button and posting your Makes! If it fell short after clicking on the title of the model, please let me know (Messenger | Printables.com). Either way, Thank you!

Related

   Complete exhaust configuration

      Adapters - Convert machine exhausts to ducting diameter and/or MagDuct
  • xTool P2 Exhaust Duct Adapter (configured as 4 in)

  • MagDuct xTool F2 Ultra UV Slip Adapter

  • MagDuct CORE One Exhaust Adapter and Gasket

      Ducting
  • AC Infinity 4" ducting

  • AC Infinity 6" ducting

  • xTool pipe (included w/ xTool IF2 2.0 and xTool F2 Ultra UV)

  • xTool 72.5 mm ducting (included w/ xTool P2)

      Couplers - Convert flexible ducting or pipe/rigid ducting to MagDuct
  • MagDuct Flexible Ducting

  • MagDuct Pipe/Rigid Ducting

      Connectors - Convert ducting for attachment to inline fan or external surface
  • Duct Expander (configured as 4 to 6 in expander)

  • Ducting to Window Insert Connector (attached to a piece of 1/4" acrylic inserted in the channels of my double hung windows which allows for quick installation/uninstallation (configured as 148.0 mm (6") and 72.5 mm exhaust port)

      Inline Exhaust Fans
  • AC Infinity 6" Inline Fan (High CFM)

  • xTool IF2 2.0 Inline Fan (High Static Pressure/Suction)

      Mounts - Securely mount MagDuct components to a surface using a third-party mount
  • MagDuct Ring RAM Mount (1 in)

      Accessories
  • MagDuct Fume Extraction Nozzle and Screen - Direct smoke and fumes (e.g., soldering) into exhaust ducting

  • MagDuct Generic Accessories - Control airflow volume and chamber temperature (e.g., enclosed 3D printers)

   xTool Accessories

License:

Creative Commons — Attribution — Noncommercial — Share Alike

Related Models

Thor Mjolnir Hammer Bic Pen preview image

Thor Mjolnir Hammer Bic Pen

effektz profile image

effektz

9,093

Diverse Schilder / various labels  for hobby & makers preview image

Diverse Schilder / various labels for hobby & makers

RPK profile image

RPK

2

Cute Fluffy Puppy Figurine to Print preview image

Cute Fluffy Puppy Figurine to Print

bonowski. profile image

bonowski.

3

Vorpal The Hexapod Walking Robot preview image

Vorpal The Hexapod Walking Robot

vorpal profile image

vorpal

4,986

MakerZ – Open Source 1/28 RC Drift Chassis by Fails & Makes | Açık Kaynak 1/28 RC Drift Şasisi preview image

MakerZ – Open Source 1/28 RC Drift Chassis by Fails & Makes | Açık Kaynak 1/28 RC Drift Şasisi

Fails&Makes profile image

Fails&Makes

Customizable EU License Plate Keychain preview image

Customizable EU License Plate Keychain

John_M profile image

John_M

43

Snap-Together Mini Minecraft Jack-O-Lantern with integrated LED preview image

Snap-Together Mini Minecraft Jack-O-Lantern with integrated LED

scottrlindsey profile image

scottrlindsey

4,453

Small Parts Storage Drawers - Organizer preview image

Small Parts Storage Drawers - Organizer

GT 3D Makers profile image

GT 3D Makers

29

9