Cloudify: setup reprap 3D printer with octoprint, mjpg_streamer on raspberry pi
The process to 3D print a 3D model can be quite an obstacle, i.e need to have physical access to the 3D printer and a SD card handy, power hog, heat emission, UFP emission. What if we can remotely send a 3D model (in *.STL) to be 3D printed on a 3D printer and also observe the 3D printing process over the Internet? Definitely it is going to be convenient as everything can be done at the fingertips; godsend piece of technology for those can’t wait for the 3D printers to be locked down in a facility equipped with exhaust and medical grade filter that is capable of filtering Ultra Fine Particles (UFP) in the range of 100 nanomether that is much finer than PM2.5. The purpose of this article is to share a step by step guide of setting up 3D printer to print remotely.
Raspberry Pi is acting as the “brain”, wirelessly receiving GCODE (instructions for the 3D printer to work by processing a 3D model file in STL using software such as Slic3r http://slic3r.org/ ) from the front end that is interfacing between human and 3D printer via OctoPrint http://octoprint.org/ providing minute control over the 3D printer; feedback to human by streaming 3D printing process via MJPG_streamer http://sourceforge.net/projects/mjpg-streamer/ . Most 3D printers in the market have only 1 MCU, e.g 1 brain. Usually 3D printing is done by inserting a SD card that contains the GCODE and to be read by the 3D printer. Having a second brain opens up more opportunity to build computing capacity for the 3D printer. Cloudify, refers to scaling up this computing methodology to support more users and more 3D printers.
A quick note: Raspberry Pi is sensitive to power drop, especially when there are a few components drawing substantial amount of power to operate. One of the tell-tale sign is when a keyboard is plugged in to console the raspberry pi, the keystrokes appear to be non-responsive.
Another not so quick note: Throughout this process of setting up, yours truly learnt that apparently not all USB webcamera out there work out of the box on the raspberry pi. The details steps of configuring and observations done are recorded at the end of this article.
Parts needed
- RepRap 3D printer or equivalent, known baud rate of the 3D printer e.g 250000
- Powered USB hub, preferably 5V 1A; (tested with Belkin F4U020)
- USB webcam (tested both Creative VF0220; A1 pro M035 ); list of tested USB webcam on raspberry pi is here http://elinux.org/RPi_USB_Webcams
- Raspberry Pi as the controller/brain;
- WiFi adapter;
- WiFi Access Point; IFF necessary
Steps required
- If there is an existing pi setup and reflash the SD card image is not an option, build octoprint on your raspberry pi https://github.com/foosel/OctoPrint/wiki/Setup-on-a-Raspberry-Pi-running-Raspbian. Alternatively, download octopi image https://github.com/guysoft/OctoPi; it is a custom fit raspbian with the goodies such as octoprint, mjpg_streamer, and more!
- Setup WiFi access for the raspberry pi. Depending on the WiFi network connected to, the wpa_supplicant.conf will vary. Here are 2 examples of configuration http://shin-ajaran.blogspot.sg/2013/06/raspberry-pi-connecting-to-wifi-in-ucl.html ; http://shin-ajaran.blogspot.sg/2013/06/a-poor-lads-guide-to-install-raspberry.html
- Wire the parts according to the following picture that describes the wiring connection
- Turn on the powered USB hub, the reprap3D printer, the WiFi Access Point (If used)
- Console in via SSH using Putty or equivalent;
- Issue the command “lsusb” to verify the devices are mounted accordingly to raspberry pi
- Navigate to the ip-address using firefox or safari and be presented with the GUI of OctoPrint. On the upper LHS select the appropriate interface where reprap3D printer is connected e.g ttyUSB0 and the corresponding baud rate e.g 250000. Failure in doing so, the reprap 3D printer will not be interfaced. The following diagram describes the reprap 3D printer that is connected to octoprint
- Determine the control between the OctoPrint and reprap 3D printer by setting the temperature and observe the temperature over time. The following diagram describes the temperature recorded over time
- Click on the control tab. If the webcamera work out of the box, there should be a live feed in this tab as describe in the following picture. Otherwise, refer to the appendix on configuring USB webcams/troubleshooting
- Streaming of the 3D printing process can be observed from a browser pointing to http://IP-address/webcam/?action=stream
- The GCODE viewer tab is a visualization of GCODE used in progress. The following diagram depicts the progress of printing an Arduino Yun Bumper. The step by step guide to 3D print with this computing methodology is available here
Appendix: troubleshooting the webcam for streaming
Finding the right USB webcamera (model/make), the right picture format (JPEG;YUY2), the right resolution (640x320, etc), and the right frame per second (fps) for mjpg_streamer on Raspberry pi is a tedious process. Getting the usb webcam to work is a little bit trickier than expected. Having a usb webcam that is not listed on the supported webcam on raspberry pi doesn’t help either. So yours truly is left on his own to conduct a few rounds of A/B tests.
The location to configure the webcam daemon that uses mjpg_streamer included in octopi is available at “ /home/pi/scripts/” the parameters associated with the webcam can be modified in the script “webcamDaemon” available in that directory. After completing the changes, save the file and execute the script. If this screen is encountered, a reboot of the raspberry pi is required.
The following describes the parameters used to determine the best output with Creative VF0220
##VF0220
#YUY2 320x240 @10fps = green
#YUY2 320x240 @25fps = green, hang after a while
#JPEG 320x240 @10fps = varying colour according to light. hang after awhile;cannot boot complete
#JPEG 320x240 @15fps = partial works with varying colour
#JPEG 320x240 @25fps=same as above with more frames of lights
#JPEG 320x240 @1fps = cant open cam; cannot boot complete;hang.
#JPEG 640x480 @15fps = varying colour then hangs very fast
#JPEG 640x480 @1fps = varying colour then hangs afte a while; then throw 503
#JPEG 352x288 @8fps= throws 503
#YUY2 352x288 @8fps= throws 503
#YUY2 320x240 @10fps = green
#YUY2 320x240 @25fps = green, hang after a while
#JPEG 320x240 @10fps = varying colour according to light. hang after awhile;cannot boot complete
#JPEG 320x240 @15fps = partial works with varying colour
#JPEG 320x240 @25fps=same as above with more frames of lights
#JPEG 320x240 @1fps = cant open cam; cannot boot complete;hang.
#JPEG 640x480 @15fps = varying colour then hangs very fast
#JPEG 640x480 @1fps = varying colour then hangs afte a while; then throw 503
#JPEG 352x288 @8fps= throws 503
#YUY2 352x288 @8fps= throws 503
This is the best can be achieved with VF0220
Courtesy of TSO Mark, yours truly get to use an USB webcam that is marketed locally as A1 pro, but recognised as M035 on raspberry pi.
The following observations are recorded
##M035
#JPEG 352x288 @15fps = no disp
#YUY2 352x288 @15fps = ok; hang if move camera too often.
#YUY2 352x288 @8fps= ok; no hang
##M035
#JPEG 352x288 @15fps = no disp
#YUY2 352x288 @15fps = ok; hang if move camera too often.
#YUY2 352x288 @8fps= ok; no hang
1 comment:
Such an amazing innovation. Such types of technologies can bring true changes to the medical world. Some of the impossible ideas are now possible for such types of creative innovations. A living donor kidney transplant can be one of the most commonly seen examples.
Post a Comment