User Tools

Site Tools


raspberry-pi
A PCRE internal error occured. This might be caused by a faulty plugin

===== Using a Raspberry Pi as a Host ===== {{wiki:jitsbuild:with-raspberry-pi.png?800}} ==== Why? ==== The Raspberry Pi is very small (about the same size as the Azteeg) and could be embedded into the printer itself, making the Bukobot completely free-standing (except for monitor, keyboard, and mouse). It can also connect to a network, perhaps allowing the user to run the printer from a web browser on another computer. The cost to do all this is very small. Current US prices: * Raspberry Pi, $35 (order backlog for these is currently about a month, in the U.S. at least) * Power supply, $6 (adafruit has a nice one) * SD card, $8 * cables, case, keyboard, mouse, hub, maybe $50 total * monitor, maybe $150 Of course you may already have some of the above. ==== Parts Required ==== * Raspberry Pi, Model B, with 512MB of RAM * High quality power supply for same, 5V, at least 1A, plus micro USB cable to connect it to the Pi * SD card, at least 8GB, preferably class 10 or better * Powered USB hub * Keyboard, USB (must be a wired keyboard, don't try this with a wireless one, at least not at first) * Mouse, USB (wired, at least at first) * Monitor, HDMI, with HDMI cable * Ethernet cable, with Internet on the other end (do not try to use wireless, at least at first) * Mini USB cable to connect Pi to printer (should be included with printer) * Bukobot One of the primary reasons for having problems with a Raspberry Pi is the power supply. There are many different power supplies on the market (most smartphones and similar small devices use this type) and a lot of these power supplies are of poor quality. The Pi needs a high-quality power supply, rated at one amp or more. The adafruit unit (their #501) is recommended by Lady Ada, so it's a good one (and the price is good too). If you intend to connect the Azteeg, a keyboard, and a mouse to the Pi then you'll need a USB hub for sure (the Pi only has two USB ports). Might as well make that a powered hub and be sure you won't overwhelm the Pi's power supply. For not much more, you can get a powered hub that also has card slots (the Pi does have an SD card slot, but you boot from that and can't remove the card while the Pi is running). === Video Options === For best picture quality, use a monitor (or television) with an HDMI connection. If you have a monitor sitting around that has VGA input but not HDMI, you can use a [[http://www.farnell.com/datasheets/1669934.pdf|Pi-View]] adapter. (The system shown above is using one of these.) You can get these from any Farnell/element14 affiliate (Newark in the U.S. currently has these for about $33). Also now available from Adafruit: [[https://www.adafruit.com/products/1151|HDMI to VGA Video + Audio Adapter]], which also has audio output, and costs even less. Of course the Pi also has a standard-definition output on RCA jack, that can be connected to an old-fashioned television. It's low resolution, but perhaps sufficient to get the Pi set up and running headless. (Anyone try this?) You will need a monitor to get the Pi set up, and perhaps to administer and maintain it later. But if you set up the Pi to run headless (using a web interface, for example), you wouldn't need to keep a monitor connected all the time, so you could temporarily borrow a monitor from somewhere else and not have to buy one just for your Bukobot. ==== Getting Started ==== (In all of the following, it is assumed that you are using the default username, pi. If you use a different user name, you may have to change some of the things below, replacing pi with your username.) Download the latest version of [[http://www.raspberrypi.org/downloads|Raspbian Wheezy]] (not the soft-float version). Follow the directions on that page to put the image on the SD card. Note the default user name and password. Follow the directions to sync the filesystem so that the card can be safely removed from the computer. Insert the card into the Pi. Connect the powered USB hub to one of the two USB ports on one end of the Pi. Connect an Ethernet cable to the Pi's Ethernet jack next to the USB ports. Connect the other end of the Ethernet cable to a working Internet connection. Connect the wired keyboard and the wired mouse to the powered USB hub. Apply power to the hub. Don't connect the Azteeg controller to the hub yet. Connect the monitor to the Pi's HDMI jack with the HDMI cable. Turn the monitor on. Connect the Pi to its power supply using the micro USB cable, and plug the power supply in. Watch the monitor. See the text fly by as the Pi boots up. Eventually, a menu should appear. If it doesn't, troubleshoot. {{wiki:jitsbuild:raspi-config.png}} This menu is navigated with the up and down arrows, <Tab>, and <Enter>. First, try to update this menu program (update). Use the menu to set the graphics memory to 32MB (memory_split). Use the menu to tell the Pi to boot into the graphical user interface on next boot (boot_behaviour). Use the menu to tell the Pi to expand its file system to maximum size on next boot (expand_rootfs). Select your keyboard, locale, and time zone (configure_keyboard, change_locale, and change_timezone). (Remember that the Raspberry Pi comes from England, and the defaults assume UK and GB and the like, and you should change those values if you live somewhere else in the world.) Use the menu to reboot (tab over to <Finish>). Watch it boot again. It should boot into the LXDE desktop environment. If it doesn't, troubleshoot. Start the Midori web browser and verify that the Pi can see the Internet. Browse to this page. Follow the rest of these directions. At this point, it's probably safe to switch to a wireless keyboard and/or mouse if you prefer those. It's probably safe to switch to a wireless Internet connection too (but some wi-fi units may not work with the Pi, so do the research and do the testing). (If you want to run that configuration menu again at a later date, open a terminal and type: <code> sudo raspi-config </code> However, it may not work properly if you have heavily reconfigured the system in the meantime, so try to get all of the configuration choices set properly the first time you run it.) ==== Install more software ==== Start a terminal. (There's an icon for LXTerminal on the Desktop. Remember that for this terminal program, and for many other common ones, the keyboard shortcut for pasting text is Shift-Ctrl-V instead of Ctrl-V.) In all the following, if it asks questions, say yes. (Hitting <Enter> generally will work.) In the terminal window, use the following command to update the software: <code> sudo apt-get update && sudo apt-get upgrade </code> If it finds updated packages to install, and asks if it should do so, hit <Enter> to say yes. This may run for a while. (You should do this periodically to get the latest software.) When that's done, <code> sudo apt-get install arduino git libgtk2.0-dev synaptic pistore python-serial python-wxgtk2.8 \ python-pyglet python-tk build-essential libwxgtk2.8-dev libwx-perl libmodule-build-perl \ libnet-dbus-perl curl cpanminus gcc libsdl1.2-dev </code> (That's all one command, copy and paste the whole thing.) Next, this command will install lots of potentially useful things: <code> sudo apt-get install task-lxde-desktop </code> That command will install a variety of utilities that are handy for maintaining and managing this machine, and a collection of common applications. This includes the complete LibreOffice suite, and a web browser called IceWeasel (a version of Firefox). But, be warned: Both of these are heavy users of memory, which is in short supply on the Pi. They will probably run, but may run slowly. Don't even think of running these on a 256MB Pi. === Install software to run the Bukobot === == pronterface == Now, install pronterface (Printrun directory) into home directory: <code> git clone git://github.com/kliment/Printrun.git </code> If you have another computer to do slicing on, you can make a G-code file on that computer and transfer it to the Pi, and then you don't need skeinforge or Slic3r on the Pi. The Pi is network connected, and can also talk to USB drives, so there are lots of ways of getting files across. If you have the Azteeg X3, you can also put files on a microSD card and plug the card into the X3. You can put an icon on the Desktop for launching Pronterface. On the Desktop, create a new file (right-click in an empty area of the Desktop, select Create new... Blank file), name it pronterface.desktop, right-click on the file and select LeafPad, then paste the following text into it: <code> [Desktop Entry] Name=Pronterface Comment=3D Printer Exec=/usr/bin/python /home/pi/Printrun/pronterface.py Icon=/home/pi/Printrun/pronsole.ico Terminal=false Type=Application Categories=Application;Development; </code> and save the file. == skeinforge == If you want to run skeinforge on the Pi, get the latest version from [[http://fabmetheus.crsndoo.com/|here]]. Make a subdirectory called ~/Printrun/skeinforge/ and unzip the contents of the downloaded file into there. == Slic3r == If you want to try Slic3r, install it into another subdirectory of Printrun: <code> cd ~/Printrun git clone https://github.com/alexrj/Slic3r.git cd Slic3r sudo cpanm Boost::Geometry::Utils Math::Clipper \ Math::ConvexHull Math::ConvexHull::MonotoneChain Math::Geometry::Voronoi Math::PlanePath Moo Wx ./slic3r.pl </code> Slic3r will be installed and started, and will launch the Slic3r Configuration Assistant. You can use that tool, or instead you can cancel out of it and import some canned profiles already set up for the Bukobot; just download the zip file from {{:bukobot_profiles.zip|here}}, unzip it, and use Slic3r's menu (File >> Load Config...) to load the profiles you need, starting with the profile that matches your printer, then the profiles for the filament you use, and some print profiles. See [[host-slicing-settings|here]] for more information. If you are using pronterface, it will use skeinforge for slicing by default. To use Slic3r instead, you have to change some settings in pronterface. Start up pronterface, then do Settings >> Options, and widen the Edit Settings window enough so that you can see all of the values in it. Then change two values: slicecommand: <code> perl /home/pi/Printrun/Slic3r/slic3r.pl $s --load /home/pi/.Slic3r/slic3r.ini --output $o </code> sliceoptscommand: <code> perl home/pi/Printrun/Slic3r/slic3r.pl --load /home/pi/.Slic3r/slic3r.ini --ignore-nonexistent-config </code> Note that you can't use relative paths there. If you are using a username other than pi, substitute that in four places. If you decide to switch back to skeinforge, the settings are: slicecommand: <code> python skeinforge/skeinforge_application/skeinforge_utilities/skeinforge_craft.py $s </code> sliceoptscommand: <code> python skeinforge/skeinforge_application/skeinforge.py </code> On a low-resource machine like the Pi, it makes sense to run only one program at a time, as it saves memory. You can run Slic3r as a standalone program, and use it to transform a .stl file into a .gcode file that can later be used to print a part with a printer control program like pronterface. You can create a desktop icon to launch Slic3r; create a file on Desktop called slic3r.desktop as described above, and put the following text into it: <code> [Desktop Entry] Name=Slic3r Comment=Slic3r for 3D Printer Exec=perl /home/pi/Printrun/Slic3r/slic3r.pl Icon=/home/pi/Printrun/Slic3r/var/Slic3r.ico Terminal=false Type=Application Categories=Application;Development; </code> Some testing has been done with Slic3r on the Pi. It works, and runs fairly quickly; it can process a part much quicker than the printer can print it. More testing needs to be done to find out if Slic3r runs out of memory when dealing with really large complicated parts. Many people use the Pi only for controlling the printer, using a program like Pronterface, and do all their slicing on a different machine that has a lot more memory and speed. G-code files are generated on the other machine and transferred to the Pi through the network. It's trivial to access shared folders from the Pi: start the File Manager, and do Go >> Network Drives. ==== How to run the programs ==== === Arduino === To run Arduino (for example, if you want to put a different firmware on the Azteeg controller), find Arduino in the main menu (click the start icon at lower left): Start >> Programming >> Arduino. (Connect Pi to Azteeg first, of course. Use the powered hub.) If you don't have motors connected to Azteeg, don't run the Azteeg from the 12V power supply. Power it from USB instead. Move the Input Select jumper on the Azteeg (on the X3 it's under the daughterboard). See [[bukobot-assembly-documentation|Azteeg docs]]. You have to select the board type (Arduino Mega 2560), the COM port (probably only one listed there), and the baud rate (250000). For more details see [[http://reprap.org/wiki/Azteeg_X3|here]]. (You don't have to install any drivers.) === pronterface === Create a desktop icon as described above and use that to launch pronterface, or go to ~/Printrun and run pronterface.py: <code> cd ~/Printrun ./pronterface.py </code> The first time you run it, you have to tell it the board type and COM port. There is also a command-line interface (pronsole.py) and a web browser interface for pronterface. See [[https://github.com/kliment/Printrun|here]] for more information. ==== 256MB Raspberry Pi ==== (This section is here for completeness, but remember that the 256MB model has been out of production for months, and you can get a new 512MB model for only $35. Time and effort expended on getting things working on the obsolete model is not of great value -- how much is your time worth, anyway? In any case, some of the things described below may be useful to you no matter which model you use.) The original 256MB Raspberry Pi is capable of running Pronterface as well, following the instructions above (might be a good idea to use 16MB graphics memory instead of 32MB). It is possible, at least in some cases, to directly connect the Azteeg X3 to the Raspberry Pi without a powered hub (but this is risky -- if your print suddenly goes all pear-shaped and gets ruined, it's time to get a powered hub, they're not expensive). By installing tightvnc via: <code> sudo apt-get install tightvncserver xfonts-base </code> It is possible to connect to the Raspberry Pi running Pronterface from any computer on the network, providing a 'print over ethernet' type of capability. Additionally, it is possible to install usb-redirector, which can convert the Raspberry Pi into an ethernet-to-USB bridge, allowing any machine on the network to directly control the printer. This has been demonstrated to work with Pronterface, but efforts are still ongoing to use Repetier-Host in a similar manner. --------------------------- More experiments to come. //The contents of this page may be re-used under any of the following licenses: The [[http://creativecommons.org/licenses/by-sa/3.0/|Creative Commons Attribution-ShareAlike 3.0 Unported License (CC BY-SA 3.0)]], or the [[http://www.gnu.org/copyleft/fdl.html|GNU Free Documentation License (GFDL, version 1.2 or later)]].//

raspberry-pi.1362358430.txt.gz · Last modified: 2013/03/03 18:53 by jit