This mount is OpenSCAD designed to hold a smartphone in landscape orientation with the camera aimed right at the extruder. Mounting on the gantry allows the camera to follow the extruder up and down the z-axis for a perfect view of what's being printed throughout the print.
There are two parts to make it easy to print, and for ease of tweaking the angle and position of the phone. The "clip" attaches to the X-motor, and the "holder" slides into the clip and holds the phone. If you are editing the SCAD, I recommend printing individually because I haven't done the math to figure out how to get the two pieces to always line up on the z axis after changing parameters.
If you have an old Android phone lying around, it is really easy to convert it to a webcam by installing IP Webcam. The STL that is included is sized for a Moto X 2014, which is a smaller phone, but the included scad is completely parameterized.
The most important parameter is the distance from bottom of camera to phone and phone dimensions. There is a previsualization model so you can see right where the camera will end up pointing on the bed. It helps to move the virtual hot end around (search for "hot_x") and see where the cooling block gets in the way of visibility. Because the x direction is so large, you have to find a balance between looking down on the bed and losing visibility when the hot end is near the phone.
render_ parameters to choose what is shown.
Description of the top parameters:
// Place the phone in the x/y/z planes
// distance from the "bottom" of the phone to the camera lens
// (whichever side is bottom when placed the the holder)
bottom_to_camera = 72.5/2;
// How far over into the phone is front of motor mount
y_off = -145;
// Phone rotation on y axis (looked at from front)
phone_roll = -8;
// Phone rotation on z axis (looked at from top)
phone_yaw = 190;
// Distance of holder from mount plate
x_off = 30;
// Height adjust (higher will get blocked by cooling on hotend)
z_adj = 10;
// Phone dimensions
// phone horizontal dimension
phone_h = 140.5;
// phone vertical dimension
phone_w = 72.5;
// fudge factor, allows adding some softening material?
depth_fudge = .2;
// MotoX 2014 has a curved back, model this by beveling the back
// set phone_d2 = phone_d1 to remove bevel
// Phone depth at edge (6 for moto x)
phone_d1 = 6 + depth_fudge;
// Phone depth at bevel_w mm into the phone
phone_d2 = 10.2 + depth_fudge;
// Width of the bevel (14 for moto x)
bevel_w = 14;
Things might get funny with some more extreme parameters. Parameter x_off (x_offset) will help to keep the phone away from the gantry.
Finally, the Moto X 2014 has a rounded back, so I beveled the shape of the phone to match. To undo this bevel, just give the same number for phone_d1 and phone_d2.
If the Customizer doesn't work (it didn't when I tried it), don't be afraid to download OpenSCAD, open the scad file, hit F6 to render, and then export to STL. Edit the parameters in the text editor before rendering if you want to change something. Hit F5 to preview before rendering if you'd like. You'll need to render one m
I've included a screenshot of the phone's view while printing.