Close



Results 1 to 10 of 232

Threaded View

  1. #1
    Technologist dacb's Avatar
    Join Date
    Aug 2014
    Location
    Edmonds, WA
    Posts
    139

    Lightbulb Using a Raspberry Pi + Octopi to manage your printer

    It didn't take me long to get tired of uploading files to the SD card via sneaker net. Moreover, I really wanted to be able to control the printer more easily than the LCD/knob interface and some control options were not available via the LCD/knob. Finally, I really wanted to be a be able to check out prints when I wasn't in the same physical location as the printer and to be able to record prints so that when something goes wrong, I have a way to get some visualization around the time of the problem.

    I happen to have a Raspberry Pi B from another project that was severely underutilized. The current models come in two flavors: B & B+. I would recommend the B+ for someone who might be purchasing one new for this project. It has more USB ports so it is possible to plug in a WiFi USB dongle, the Arduino/RAMPS, and a USB web cam (more on all that later). The Pi is cheap, ubiquitous and there is a lot of support for it on the web. There are alternatives such as the newly introduced Intel Galileo, but again, there are so many Pis out there that support is great and the community is vibrant.

    The above needs and the fact that I happen to have a Pi led me to try out a few different solutions, including Repetier-Server (RS), Printrun (pronterface), and Octoprint in the form of OctoPi.

    For RS & Printrun, I used a fresh install of Raspbian on a 32GB SD card setup with Apple Pi Baker. I used to prep SD cards for the Pi with dd, etc. but tools like APB are just easier. UNetbootin also works well and seems to work on Windows and Linux, too. To setup Printrun, check out a site like this one. Printrun's pronterface works as it does everywhere. Unfortunately, it ran like a dog on the Pi. To use it, I had to ssh -Y into the Pi and display the interface using X-windows. If that sounds like greek to you, probably should skip Printrun. To setup RS, download the Pi tarball from their site and follow the directions. In my hands, however, RS never really worked properly. It would disconnect or not connect at all. The web interface (in my opinion) was ugly and the functionality not intuitive.

    To setup OctoPi, on the other hand, all I had to do was download the SD card image, load on to SD card with APB and plug it all in. It came preconfigured with the web server all setup and the web cam service ready to go once a cam was plugged in.

    For RS, Printrun and OctoPi, before plugging the Pi into my printer, I had to enable the WiFi dongle. I was too lazy to plug my Pi into an HDMI monitor and find a USB keyboard so I just plugged the Pi into my router via ethernet, found the DHCP assigned IP and configured the WiFi, and did it via ssh (see below). You could just as easily do it with an HDMI monitor/TV & USB keyboard - just leave out the ssh commands below.

    Code:
    # first, ssh in and setup passwords and root ssh
    ssh pi@192.168.X.Y
    password: raspberry
    
    # setup pi password (change from raspberry)
    passwd
    # setup root password for root ssh
    sudo passwd
    
    # configure the installation
    sudo raspi-config
    # Select: 1. Expand File System (Fill SD card)
    sudo reboot
    Once the Pi rebooted, I was able to ssh in as root and setup the WiFi client:

    Code:
    # ssh in as root
    ssh root@192.168.X.Y
    
    # always useful to have vim!
    sudo apt-get install vim
    Y
    
    # now populate the SSID information for the Pi's WIFI client:
    cat << EOF >> /etc/wpa_supplicant/wpa_supplicant.conf
    
    network={
        ssid="yourSSID"
        psk="your_passwd”
        key_mgmt=WPA-PSK
    }
    EOF
    
    sudo reboot
    
    I also took a moment to have my router assign the Pi's WiFi MAC address a single IP via DHCP. I do this so that I will always know the address of the Pi on the network. I also forced the router to assign the octopi hostname to the Pi. You may or not be able to do this with your router.

    As I mentioned, I'm using a web cam. I happened to have had an old (maybe 8 years?) web cam: Logitech QuickCam Pro 9000. I didn't expect it to work given its age and the possibility of no drivers for the Pi, but it fired right up. I am also exposing a port on my router that will redirect to the web cam on the Pi so that I can watch the printer when I'm away from home. The OctoPi distribution ships with a preconfigured mjpg-streamer that just works. It does, however, expose a web interface that allows the camera settings to be modified. I didn't like this so made the default page that mjpg-streamer serves a simple stream on white background page (see below). In addition, I also copied back the stream.html that OctoPi wants to find for the embedded stream:

    Code:
    ssh pi@octopi
    cd mjpg-streamer
    mv www www.back
    mkdir www
    cp www.back/stream_simple.html www/index.html
    cp www.back/stream.html www/stream.html
    sudo /sbin/shutdown -r now
    


    Finally, I wanted to update to the latest OctoPi (at this time 0.10.0) which has some new features. Here are some directions and my commands:

    Code:
    ssh pi@octopi
    cd ~/OctoPrint
    git pull
    ~/oprint/bin/python setup.py install
    sudo service octoprint restart
    Now, go to http://octopi (or whatever IP you used) and you will see the basic OctoPi interface. On the first connect, it will ask you to setup a username/password and to turn on security. I did this to keep my kids from canceling prints so I can make more star wars stuff. Then you will need to select the FTDI serial port and set the baud (250000). Click save settings and then connect.

    When I installed Cura it broke everything. It requires a gcc upgrade that causes OS updates to compile but fail to run correctly, bricking the SD. Why should I slice on the Pi anyway?

    The web interface works with every device I've thrown at it, including an iPad, iPhone, Windows Phone, Chrome, Firefox, Safari, IE. The mjpg-streamer works on all of the browsers except the Windows Phone.

    I'm sure I've missed stuff here so I will edit this page to add anything - it is basically just a dump of my notes from a Google Doc. Please ask questions because it will help make this more useful. If people want, I can throw up some screenshots.

    Edit: It is also nice to be able to add firmware remotely: see post #14
    Last edited by dacb; 09-23-2014 at 10:59 PM. Reason: Changed SSID to be generic; added no Cura tip; added link to post with uploading firmware info

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •