Tuesday, July 31, 2012

Reprap printing from Raspberry Pi

Raspberry Pi controlling my RepRap

I just received my Raspberry Pi a few days ago and after seeing fellow RepRap-er RichRap's success, I wanted to start printing from it.  Since the RPi runs Linux (Specifically a specialty distro of Debian called Raspbian) I wanted to lay out the steps it took for me to get running.

Items needed:

4GB SD card or larger. (Raspberrypi.org suggests atleast 2GB, but trust me you'll need more with the extra dependencies needed to run the needed Reprap programs)
Raspberry Pi
Micro USB powersupply (Its crucial to have at least 1A capacity, anything less and you'll have issues)
Powered USB Hub (make sure it provides plenty of power, mine is capable of 2A)
RepRap.  (I'm running RAMPS 1.4 w/Marlin Firmware, but anything that'll connect to Pronterface should be fine.)

Initial RPi set up:

First and foremost, upon initial starting up your RPi, expand the partition to the full SD capacity.  It'll save you a lot of hassle later on.

Optional:  Overclock the RPi.  This isn't 100% neccessary but it will make future steps quicker.  There are multiple tutorials on this but it's pretty easy. 

From your root terminal enter:

sudo nano /boot/config.txt

This brings up the config file and allows you to overclock easily. 
Scroll down to the bottom of the screen and type:


Then press Cntrl O to write the file.
Then press Enter.

This will bring you back to the first menu, so now you can exit by pressing Cntrl X.
You should be back at the normal terminal screen now so it's time to reboot:
Type reboot and press enter.

Once you reboot you should be running an overclocked Pi.  You can adjust the arm_freq higher (up to ~900.)  I have mine currently running at 850.  It worked at 900, but I started to have some booting issues. 

Installing Dependencies:

You'll need a few dependencies to run Pronterface.
Once again go back to root terminal and type: 

sudo apt-get install python-serial

Note:  After all terminal commands you need to press enter.  This should be obvious so I won't list that in the directions from this point on

This will install PySerial.  Once this is done type:

sudo apt-get install python-wxgtk2.8

This will install wxPython.
Both of these will take a bit to download and install so be patient.  You'll know your done when you get back to the main terminal prompt.

Now is a good time to reboot.  Once again this can be done from terminal by simply typing "reboot" or "sudo reboot" if your not in sudo.

Downloading Pronterface:

Open up the web browser and navigate over to PrintRun on github.  Click downloads and save. (I'm sure there is a way to do this from terminal, I just didn't know how.)

Now open up the file manager and open up /home/pi  and find kliment's folder. 

Scroll all the way down until you see pronterface.py and double click.  Then click execute and wait a few seconds. 

Pronterface should now be up and running.  

Connecting to printer.

On another computer change the baud rate on your firmware to 115200 if it isn't already.  250000 won't work.

Some of these steps may not be needed but they don't take too much time so just go ahead and follow along.

Close Pronterface if you have it open. 

Reboot (I like to make sure everything is fresh and clean before trying to connect.  I had some issues before.)

Plug in your printer.  Then open Pronterface.  You should see the appropriate port in the port box.

Assuming you haven't run any other serial com ports yet, it should end in 0.   

Now click connect.

This is where I've had some difficulties.  I'm not sure if they stem from power issues or if its a bug in the system some where.

It may take a bit to connnect.  Or it may not connect.  Sometimes I need to close pronterface and restart a couple times before it finally connects.  But eventually it will connect. 

From this point on, it's the same as it would be on any other computer.  Set your temps, load your G codes and print yourself a yoda. 

I have attempted to install Slic3r but no luck so far.  I'm sure Skeinforge would be easier to install since it's python, but thats slow on my regular computer so I figure it'll put it off for now. 

Next we'll download the Android IDE.

This is pretty easy, since some very smart cats putting together the Raspbian distro included it in the available packages.  All you have to do is go to the terminal again and type

sudo apt-get install arduino

This should install Arduino.   Then once again everything is just like any other computer. 

One thing to note, the compiler used in this Arduino IDE is slow, so be patient.  It'll get there. 

Now its time to buy one of these 7" screens and integrate it all into my new MendelMax build.  With a wireless adapter, soon i'll be remotely logging in and starting a print before I leave work. 

Follow along with all of the RPi RepRap development here.


  1. I'm trying to do something very similar, but am getting stuck at the point of connecting to the RepRap. My controller electronocs are Sanguinololu. The RPi (running raspbian) recognizes the FTDI USB UART device in the the 'lsusb' display, but pronterface won't connect. Occasionally I hear the RepRap "twitch" when trying to connect. I'm guessing it's possibly a driver incompatibility between the /dev/ttyUSB driver and the FTDI interface. I'd be interested to learn if anyone else has tried this combination.

  2. For the web... I managed to get my setup working withpronterface and Pronsole. Initially, if I didn't start X-windows, and just used Pronsole, it worked fine. I was using a hi res (1920x1200) HDMI monitor, so I speculated that it was taking up too much memory for frame buffering or similar. Later, I tried using a composite video monitor with all other details unchanged, and Pronterface works fine.

  3. Nice post with great details. I need a Plastic card printing machine for home use. Where i can get the best one?

  4. This seems clear and goes a long way toward creating a stand alone RepRapPi.

    My thought would be; use the already successful methods to access the RepRapPi remotely,
    and avoid the need for that pesky bulky expensive monitor, keyboard and mouse.
    Both Remote Desktop, FTP, VNC and commandline PuTTY all seem to work well with RasPi
    and have easy installs and work up. Start by getting PuTTY working remotely.

    This way you can take the laptop to a warmer quieter room and still run 3D prints just connecting
    over the LAN.

    RasPi also provides Samba to SHARE a USB flash drive or even part of your Main OS SD card.
    This means easy GCode file transfer from your laptop.
    This is all looking very good.

    My wish list would be to add a USB camera to provide visual oversight.

  5. Really appreciating post....i need this for Plastic card printing!!!

  6. When you reach the step where you need to download pronterface:
    cd ~
    git clone https://github.com/kliment/Printrun.git
    cd Printrun
    and you should have all the files