Raspberry Pi RepRap Print Server[edit | edit source]
One goal of MOST is to improve upon the efficiency of RepRap 3-D printers, facilitating powering the printer with solar photovoltaic cells. A significant hurdle is the requirement of a host computer to operate the printer, which greatly increases power consumption. The printer as-designed can be made stand-alone with the addition of an LCD screen, SD card reader and buttons or rotary encoder, but this option is presently challenging to implement with the Melzi control board as it has insufficient i/o. Additionally, this method requires loading g-code onto a micro-SD card and then inserting the card into the controller.
A more attractive approach is employing a web enabled print server such as Repetier Server running on the Raspberry Pi, an inexpensive Linux-based computer. This allows g-code to be uploaded and queued for printing by any device sharing a network connection with the print server and having a web browser. It eliminates the need for sneaker-netting g-code via micro-SD and even allows for the printer to be wirelessely connected to the network.
The steps for assembling and configuring the print server follow. This is a WIP and there will be changes - I'm writing this as I go.
Do Not proceed without available internet connection[edit | edit source]
Everything that follows assumes that the RPi will be attached to a network either by wire or wirelessly. An internet connection is essential as several different packages will be installed on the RPi. Some basic knowledge of the network is essential (netmask, gateway IP address, whether dhcp is used, etc.) will be helpful. At present, this is written assuming a wireless network having dhcp enabled is available to the RPi to connect to.
With the exception of the installation of a VNC viewer on the client and checking the functionality of Repetier Server, all of the following is completed on the RPi.
Note that a wireless connection will consume one of the two USB ports on the RPi, making it impossible to connect a mouse, keyboard and printer without a usb hub. The VNC option is therefore recommended as that makes connection of keyboard, mouse and monitor to the RPi unnecessary. For the initial setup, an unpowered USB hub can be employed, plugging the mouse and keyboard into it and the wireless adapter directly into the remaining RPi USB port.
Hardware[edit | edit source]
- A working RepRap printer
- Raspberry Pi Model B w/ 512kb memory 
- SD card with minimum 8gb capacity 
- A 5V power supply with or able to be connected to a USB microB cable - the RPi is powered via micro-USB. this and this will work but note that some phone, GPS and tablet power supplies and cables also work.
- Appropriate USB cable to connect RPi to printer
Required for setup:
- Monitor, either composite video (quality is really bad, not recommended) or HDMI input. Appropriate cable for same.
- USB keyboard
Recommended for setup:
- USB hub (powered is preferred but not necessary - if an unpowered hub is used, plug mouse and keyboard into it and wireless adapter directly into RPi.)
- USB mouse
Software[edit | edit source]
- Raspberry Pi Raspbian distro, currently "wheezy" 
- Follow instructions for creating a bootable SD image here.
Initial setup[edit | edit source]
Follow the procedure for setting up the RPi here. In a nutshell:
- Hook peripherals up (not power, yet) to the RPi and insert the prepared SD card.
- Apply power to the RPi - it should display boot-time info on the monitor.
- When the raspi-config screen appears, choose the following:
- expand_rootfs (increases the size of the partition, filling capacity of SD card)
- change_timezone (set to your time zone)
- ssh (enable ssh for remote access)
- boot_behavior (boot to the desktop for the duration of the setup)
Tab to the Finish button and press enter.
A prompt to reboot should appear - reboot. If the screen instead opens to the command prompt, type sudo reboot followed by the enter key.
The RPi will reboot to the LXDE desktop.
(Optional) Wireless Network Setup[edit | edit source]
- Start the WiFi Config icon on the desktop.
- Click the Scan button
- Click the Scan button in the Scan results window that opens
- Double click on the wireless network to join
- Enter the passphrase and accept
Update Raspberry Pi Software[edit | edit source]
Open a terminal and enter as root the following:
apt-get update # only downloads current versions of package lists, not the software itself apt-get upgrade # update all packages, including MOST RepRap print server
(Optional) Rename Raspberry Pi[edit | edit source]
The default hostname for the RPi is raspberrypi which isn't bad, but could be troublesome if there ends up being more than one on the network. Rename the RPi whatever you wish; repserver is used in the following code. Open a terminal and enter the following:
sudo su echo repserver > /etc/hostname /etc/init.d/hostname.sh start hostname repserver reboot
When the RPi reboots, open a terminal and note the new hostname.
(Optional) Static IP Address for Wireless[edit | edit source]
Still a WIP - having issues resolving hostname with the method provided here. This assumes:
- The network is 192.168.1.0
- Gateway is 192.168.1.1
- The static IP for the RPi will be 192.168.1.2
Open a terminal and enter:
sudo cp /etc/network/interfaces /etc/network/interfaces.orig sudo leafpad /etc/network/interfaces
When the text editor opens, change:
iface default inet dhcp
iface default inet static address 192.168.1.2 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1
Save the file and close leafpad. At the terminal promt enter:
sudo su ifdown wlan0 ifup wlan0 exit
Ping the gateway:
If the response includes "destination host unreachable" then retry the above or revert to interfaces.orig:
sudo cp /etc/network/interfaces.orig /etc/network/interfaces
Install VNC[edit | edit source]
Virtual Network Computing (VNC) allows the RPi to be accessed by any other computer on the netwrok that has a VNC viewer installed. It is very handy as the RPi can then be operated without a keyboard, monitor or mouse. This frees up the USB ports for printer(s) and wireless adapter and allows one to perform most of the following tasks without needing a mouse, keyboard and monitor attached to the RPi.
At this point, it would be best to open the Midori browser from the RPi and open this page. Many of the commands to follow are best copied and pasted at the terminal prompt (select text in browser -> ctrl-c to copy -> right click on terminal window and select paste).
If after installation and configuration the RPi boots to a login screen and refuses to start the desktop, press ctrl-alt-F1 to drop to the command prompt. Login with u/n: pi, p/w: raspberry. At the command prompt, enter:
cd ~ sudo chown pi .Xauthority sudo reboot
Upon reboot, the RPi should start the desktop.
Note that a VNC viewer is required to attach to the RPi VNC server. Follow the instructions provided in the above link to install the correct flavor of VNC viewer on a client. Once a VNC session has been achieved, the RPi can be reconfigured to boot to the command prompt (disable desktop at boot time in the raspi-config tool) and the keyboard, mouse and monitor are no longer required. (Leave them connected until everything is working, though.)
Install Repetier Server[edit | edit source]
Download the binary version for Raspberry Pi from this page (scroll down some for download link). Extract the files noting that the Midori web server saves downloads in the home folder (the file manager opens to the home folder by default - look for the downloaded file there). After extracting the files, right-click on the Repetier-Server-Pi folder and choose 'Open in Terminal'. The following will be completed at the terminal prompt:
sudo su cp RepetierServer /usr/local/bin cp repetier-server.conf /etc mkdir -p /var/local/lib/Repetier-Server /var/local/lib/Repetier-Server/configs mkdir -p /var/local/lib/Repetier-Server/www /var/local/lib/Repetier-Server/storage /var/local/lib/Repetier-Server/languages cp -r www/* /var/local/lib/Repetier-Server/www cp languages/* /var/local/lib/Repetier-Server/languages cp Repetier-Server.init /etc/init.d/Repetier-Server chmod 755 /etc/init.d/Repetier-Server update-rc.d Repetier-Server defaults /etc/init.d/Repetier-Server start
Check that the server is operating by opening a browser tab and entering repserver:8080 (from the RPi, open Midori and enter 127.0.0.1:8080) in the address bar. The Repetier Server web application should be rendered in the browser - there won't be any printers listed as none have been configured yet.
Configure Printer[edit | edit source]
Plug the printer USB cable into the RPi. Locate the name of the serial interface by opening a terminal and entering the following at the prompt:
ls /dev/serial/by-id > ~/usb.txt
This creates a listing of all of the USB devices attached to the RPi by their unique id.
Open the file manager and double click on usb.txt in the home folder. Look for an entry containing something similar to this:
Select that id and ctrl-c to copy it. In the file manager, navigate to Repetier-Server-Pi/configs and double click on mendel.cfg to open it in the text editor. Make the following changes:
active=true; name="HSPrusa"; slugName="hs_prusa"; protocol=0;
Locate the line containing device=. Delete everything between the quotations and replace with /dev/serial/by-id/ followed by pasting the ID copied from usb.txt such that the string looks something like:
Save the modified document as HSPrusa.cfg and close the text editor.
In the file manager, right click on the configs folder in Repetier-Server-Pi and select 'Open in Terminal'. At the terminal prompt, enter the following:
sudo cp HSPrusa.cfg /var/lib/Repetier-Server/configs/HSPrusa.cfg sudo /etc/init.d/Repetier-Server restart
Refresh the server web page and HSPrusa should now appear in the printers list.
Finishing Touches[edit | edit source]
Run the raspi-config tool again to change the password for the pi user to something memorable and change the boot behavior to not start the desktop environment by opening a terminal session and entering the following at the prompt:
- change_pass and enter a new password at the prompts
- change_behaviour and select No to Boot directly to desktop?
Reboot the RPi and use the VNC viewer.