Interesting Tech Projects
Setting up Raspberry Pi for 3D Printing with RepRap
Having a 3D printer is cool, but requires a PC to be attached to it for control and monitoring (things like jogging, setting temperatures and even sending the gcode). Wouldn’t it be nice if the PC was a small circuit board attached to the printer making it a compact all-in-one solution? Here is how to use a Raspberry Pi $25 PC to do exactly that!
Goals:
- Use VNC to remotely view the desktop on the Raspberry Pi
- There are two scripts on the desktop – starting pronterface and shutting down.
- gcode files on a server are automatically available on every boot
- 250000 baud works fine
- Set up without connecting a TV, keyboard or mouse
1. Download the current version of Raspian. Beginning sometime in September an important USB problem was solved. I used the September 18th version and it works fine.
2. Download an application to copy the image file to an SD card. I used Win32DiskImager along with an 8GB SDHC SanDisk card. A fast card is important.
3. Insert the SD card into the Raspberry Pi, attach to a wall-wart USB power source, connect an ethernet cable and turn on the power.
The LEDs will turn on and flash a lot. The boot process should finish after a couple of minutes.
Now you have to find out the IP address that has been assigned to the Raspberry Pi. Probably the easiest way is to log into your router and look at the connected devices. If your router is like mine then it shows “raspberry pi” as the device name and clicking on it gives the IP address.
Next connect using a SSH terminal application. I recommend PuTTY. Enter the IP address and log in with username “pi” and password “raspberry”. Then enter:
sudo apt-get update sudo apt-get dist-upgrade sudo apt-get install git-core sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update && sudo chmod +x /usr/bin/rpi-update sudo rpi-update sudo reboot
After the reboot log back in and:
sudo apt-get install tightvncserver tightvncserver vncserver :1 -geometry 1024x728 -depth 24
When prompted for a password enter what you want to use to protect access to the printer. For example I used “reprap”.
Test you can connect and view the desktop by installing TightVNC on your PC and connecting using the IP address with “:1” after it. For example my Raspberry Pi was at 192.168.1.150:1.
Follow the instructions given here to assign a static IP address and start the TightVNC server on boot. Test by rebooting and connecting using TightVNC.
You can edit /etc/hostname and /etc/hosts to change the name from raspberrypi to something like reprap, if you desire.
Create a script on the desktop to shut down the Raspberry Pi when it is double-clicked:
cd ~/Desktop touch Shutdown.sh chmod 777 Shutdown.sh nano -w Shutdown.sh
Enter into it:
#!/bin/bash shutdown -h now
Test that double-clicking on the file and choosing “Execute” causes the Raspberry Pi to shut down.
Add the user pi to the dialout group so that the USB serial ports can be used:
sudo usermod -G dialout pi
Expand the filesystem to use the entire SD card:
sudo raspi-config
Choose the item from the menu to expand the root partition.
Run raspi-config again and choose the overclocking option and select a faster speed. Currently I’m not sure which are unreliable (if any!).
Download printrun and put it somewhere useful, for example /home/pi/3DPrinting.
Install the dependencies for printrun:
sudo apt-get install python-serial python-wxgtk2.8 python-tk git-core
Create a script on the desktop to run pronterface when it is double-clicked:
cd ~/Desktop touch 3DPrinter.sh chmod 777 3DPrinter.sh nano -w 3DPrinter.sh
Enter into it:
#!/bin/bash cd ~/3DPrinting ./pronterface.py
Test it by double-clicking on the file.
Follow these instructions to remove the graphical display from pronterface.py so it uses less CPU time.
I wanted to be able to put gcode files on my server and immediately have access to them on the Raspberry Pi. This avoids the need to copy files around. I achieved that by mounting a Samba share on the Raspberry Pi on every boot. This is mostly cribbed from here.
sudo mkdir /etc/sambapasswords sudo chmod 700 /etc/sambapasswords sudo nano /etc/sambapasswords/myserver
Enter into the file:
username=windowsusername password=mypassword
Save and then:
sudo chmod 600 /etc/sambapasswords/myserver sudo mkdir /mnt/myserver sudo nano -w /etc/fstab
Enter a new last line with (change the IP address to that of your server):
//192.168.1.52/3DPrintingFiles /mnt/myserver cifs credentials=/etc/sambapasswords/myserver 0 0
Test with:
sudo mount -a
That’s it!
Print article | This entry was posted by Andy on September 29, 2012 at 2:59 pm, and is filed under 3D Printing, Linux. Follow any responses to this post through RSS 2.0. Both comments and pings are currently closed. |
Comments are closed.
about 12 years ago
Your instructions were very helpful in getting my RPi set up as my reprap server. My only question is this: how did you get the 250k baud to work? You mention it works fine, but it doesn’t for me. I can get the 115200 baud setting to work, but the 250k setting gives me the same error that Ubuntu does, and that the good folks at the Reprap forums say that this is a problem with the kernel that us linux users have to just deal with.
about 12 years ago
It did just work. My kernel is Linux reprap 3.2.27+ #247 PREEMPT Tue Oct 16 01:49:18 BST 2012 armv6l GNU/Linux. If yours is not 27+ then you need to upgrade your Raspberry Pi distro using dist-upgrade.
Andy
about 12 years ago
My uname returns “Linux pex 3.2.27+ #257 PREEMPT Mon Nov 5 00:01:55 GMT 2012 armv6l GNU/Linux” and still doesn’t work. It sounds like most linux flavors don’t support it, and technically pyserial doesn’t, but every once in a while someone gets lucky and it works. I guess you’re one of the lucky few!
about 12 years ago
Maybe it was broken again between Oct 16th and Nov 5th?
What is the significance of your Kernel name containing “armv6l” and mine doesn’t?
Perhaps it is a Raspberry Pi hardware issue and on my hardware it works?
Sorry I can’t offer further details. I didn’t do anything special to get it working. I suggest you start again with setting up the Raspian distro to see if that helps.
about 11 years ago
Thank You for this tutorial. I think something is not correct. The adress of the server in fstab needs to be with two backslashes instead of normal slashes. –> \\192.168.1.x/Folder
about 11 years ago
I double-checked the contents of my /etc/fstab and it’s ‘//’.
about 10 years ago
Hello,
Your explenation is very helpful.
I get a error on the rpi when i put the line in the rpi:
sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update && sudo chmod +x /usr/bin/rpi-update
Verbibding maken met goo.gl z9goo,gl) | 173.194.65.100|:443 … verbonden. HTTP-verzoen=k is verzonden; wachten op antwoord… 404 Not Found 201405-07 05:26:10 fout 404: Not Found.
Can you help me please in am a newby in this RPI
Thanks in advance Ton Rijnaard
about 10 years ago
If I click on the goo.gl link my browser takes me to the script, so it works for me. FYI the destination URL is: https://raw.githubusercontent.com/Hexxeh/rpi-update/master/rpi-update