[Edit 6/18/2019]: added the proper M6 thread to the part razer cam mount - 2.stl so that its ready to use after printing without additional tools
Prusa MK3s Y axis camera mount with integrated light controllable from OctoPrint. You will need:
- Tripod screw https://amzn.to/2Kp1AeB
- 3-4 M4x30 screws and nuts, depending on how long you want your arm to be and if you need the swivel or not on top (you can just print the mount, the arms, and the camera tripod mount if you want)
- 1 M3x25 countersunk screw and nut, to fasten the Y Axis mount to the arm of the heatbead.
- Razer Kiyo camera from Amazon https://amzn.to/2WLnhqY, which has an integrated light ring. I will explain below how to control the light and turn it on and off programatically before and after each print. It is fair to say this parts will fit any camera with a standard tripod support, therefore, if you do not care for the light feature of this setup, you should be able to get any other camera that fits your requirements.
Included Left (Y-Axis_Mount-Left.stl) and Right(Y-Axis_Mount-Right.stl) versions for your choosing on which side to place the camera arm. Make sure you print the right one, otherwise you could damage your Y Axis or the heatbead.
100% for Y-Axis_Mount-Left.stl or Y-Axis_Mount-Right.stl, 30% for all the rest
Tripod thread for camera mount
When done printing the file "razer_cam_mount-2.stl", you will notice that the part already has the proper thread for the tripod screw, nonetheless my recommendation is to initially insert the screw from the other side (opposite to its final position as shown on the picture), that is so that the first layer of the part is not subject to a very strong force while initially carving the hole. Once this is done, just take the screw out and now insert it from the other side.
Razer Camera Light Ring control
Now, in order to control the camera light so it is not permanently on, you can use the below scripts to control both the start/stop of the camera, as well as setting a default focus on the lens to avoid constant refocusing during your timelapse.
Step 1 - Create the scripts
Create 2 scripts under your /home/pi/scripts folder named "startwebcam.sh" and "stopwebcam.sh". You might need to play with the focus_absolute parameter to fit your setup
sudo service webcamd start
sudo service webcamd stop
Step 2 - Execute permissions
Please grant execute permission to your script with "chmod 0700 startwebcam.sh" and "chmod 0700 stopwebcam.sh"
Step 3 - Sudoer
Grant permission to the "pi" user to run ONLY this scripts as sudo. Modify the file "/etc/sudoers.d/010_pi-nopasswd" to exactly the line below. Watch out, not following this step correctly could lock you out of your rasberrypi. Please copy/paste exactly as below, removing all content and leaving only the following line:
"pi ALL=(ALL) NOPASSWD: /home/pi/scripts/startwebcam.sh, /home/pi/scripts/stopwebcam.sh"
Step 4 - Command Setup
Install the plugin called "GCODE System Commands" (https://github.com/kantlivelong/OctoPrint-GCodeSystemCommands) and configure it as shown on the picture below
Step 5 - G-Code insertion
Insert the new G-Codes into your "Before print job starts" and "After print job completes" scripts in Octopi. Image also shown below
At this point, your camera should be starting and stopping with each print. Happy printing!