User avatar
Morgaine
Posts: 141
Joined: Mon Mar 12, 2012 1:13 am

Raspberry Pi and 3D Printers

Sun May 20, 2012 4:59 am

A 3D printer of the RepRap variety is essentially a fixed robot that moves two "arms" (extruder and platform) under numerical control to build up a shape out of fused thermoplastic filament. The vast majority of domestic 3D printers employ an Arduino for low-level realtime control, connected by USB to a powerful PC-type host which performs the 3D modeling and slicing and conversion of the model into the low-level G-code data format that is downloaded to the Arduino printer controller. This image gives some idea of the process.

Times are a-changing in the RepRap world though, and this is where the Pi can come to the party. :P

First of all, a 3D printer that isn't networked barely belongs in 2012 --- all of my 2D printers have been networked for over a decade. The same reasons why 2D printers are commonly networked are valid for 3D printing as well, the main ones being so that you can print from all of your networked devices, and so that printing is not dependent on one particular computer being up. Networking an Arduino is not particularly satisfactory though, because even though the Ethernet Shield and Arduino Ethernet exist, the 8-bit AVR is not a very suitable device for running a high quality TCP/IP stack. In any case, the AVR is already busy doing the realtime tasks required for high precision 3D printing, so asking it to do networking as well is not a particularly good idea.

Enter the Raspberry Pi !! (Or to avoid excessive fanboyism, at least enter low-cost ARM Linux boards with full-featured networking.)

There are numerous ways to apply a board like the Pi in a 3D printer. The simplest is to give the Linux board nothing but TCP/IP communication and high-level monitoring duties. This can be a lot of fun, giving your printer a face on the public web if you are so inclined, for example showing the design model and a webcam view of the action as it prints. (The modelling and slicing would still be performed on a separate PC host.)

It's also possible to perform the modelling and slicing directly on the Pi and to feed the Arduino from it, but there is a slight hitch here in that modelling and especially slicing can be rather CPU-intensive activities. Some reprappers are working on an approach in which the embedded Linux board stays in control of this process, but it sends out the intermediate STL file to an external server for slicing, which can be an effective approach.

It's worth noting that in terms of mechanical and software operation, a CNC machine is very similar to a 3D printer, despite using the exact opposite kind of manufacturing process -- subtractive rather than additive. There is a huge community of LinuxCNC enthusiasts whose approach is quite different to that used until now in RepRap, in that Linux is run in realtime mode and controls the hardware directly without assistance from a low-level microcontroller. This too is possible with the Pi, although perhaps not recommended on grounds of performance.

I'm currently assembling a 3D printer of the RepRap kind, albeit with a few mechanical differences in the interest of greater rigidity --- see the ShaperCube. Although I haven't yet planned how I intend my ShaperCube to evolve into the ARM and networking world, a Pi or other ARM Linux board is certain to be added somewhere into the design in due course.

I'd be most interested to hear from others with similar intentions! :)

PS. Here are some piccies of my 3D printer project so far: http://www.flickr.com/photos/morgaines/ ... 604533547/

Morgaine.
Intolerance is a failure of education. Education is predicated on tolerance of the uneducated.

JoeDaStudd
Posts: 274
Joined: Fri Jan 27, 2012 1:34 pm

Re: Raspberry Pi and 3D Printers

Mon May 21, 2012 2:04 pm

I was thinking of using a RasPi as a host then creating a cloud style service. Where the user logs in, enters the printing setting, registers there host and the server generates the G-Code then queues it onto the host.

However I failed at the first hurdle and forgot to order a HDMI to VGA converter as well as my RepRap needed rewiring (I had about 10m of extra cable).
Once my converter arrives I'll move to getting host software installed and running on the RasPi then its just a case of setting up a automation system.

PS the arm design looks to me like its going to be top heavy and have issues.

User avatar
Morgaine
Posts: 141
Joined: Mon Mar 12, 2012 1:13 am

Re: Raspberry Pi and 3D Printers

Mon May 21, 2012 10:10 pm

Reprappers haven't really embraced ARM yet, but I think it's bound to happen, if for no other reason than the very pragmatic one that a networked Arduino costs more than a Raspberry Pi, and is a LOT more hassle.

Your type of web service interface to a 3D printer is a good way in, so I expect many people to take that path. I probably will too

Morgaine.
Intolerance is a failure of education. Education is predicated on tolerance of the uneducated.

annodomini2
Posts: 33
Joined: Sun Feb 05, 2012 12:00 am

Re: Raspberry Pi and 3D Printers

Mon May 28, 2012 11:50 am

There are a number of Issues:

1. Reprappers are obsessed with the AVR 8 bit core as they think it's Open source.

2. The availability of the Arduino environment.

3. Cost is the driving factor atm, people are aiming for very cheap printers, electronics is currently the biggest cost. Adding another board is only going to drive costs up.

4. The BCM 2835 isn't really suited to real-time operations, it's not that it can't be done, just it's not designed for it.

5. Network support is nice, but not essential, USB has been on PC's for nearly 10 years, I accept Ethernet has been around longer, but at the same time USB is widely available, cheap, just as Ethernet. But the critical factor is USB (serial interface) is already implemented.

For RepRap, with the current setup, switching to Ethernet would require either:

1. Main board redesign
2. Interface hardware addition.
3. Software modification.

The key part is the software modification, they are focussed on getting the firmware for the machine working correctly, a different comms interface is a desirable, but non-essential feature.

User avatar
Morgaine
Posts: 141
Joined: Mon Mar 12, 2012 1:13 am

Re: Raspberry Pi and 3D Printers

Wed May 30, 2012 1:56 am

A Pi can't by itself replace the Arduino in a RepRap-type 3D printer, as it doesn't have sufficient hardware interfaces. Since you would have to give the Pi additional external interfaces to be able to handle the job, you might as well let the Arduino do that hardware interfacing in the first place, instead of trying to replace it with the Pi.

Pi and Arduino are not rivals but quite complementary, as Eben has often said. The Pi has far fewer hardware interfaces and Linux is poor at realtime control even when you use its realtime facilities, whereas the Arduino's AVR excels at both. In contrast, the Pi has all of the abilities of Linux and advanced graphics which the Arduino lacks totally, so they can each work within their own area of strength to provide a far superior combined solution,

It really doesn't make any sense to talk about the Pi replacing an Arduino, unless the task you're doing with the Arduino is really trivial. 3D printing is not trivial, it's demanding both in the number of hardware interfaces needed and in the tight realtime control required.

Morgaine.
Intolerance is a failure of education. Education is predicated on tolerance of the uneducated.

annodomini2
Posts: 33
Joined: Sun Feb 05, 2012 12:00 am

Re: Raspberry Pi and 3D Printers

Wed May 30, 2012 8:55 am

I appreciate your desire to promote the Pi into multiple areas, for RepRap it would be more beneficial to add the networking interface to the RepRap electronics than using the Pi as the interface.

The slicing operation can be done offline and the GCode supplied to the printer as a file.

Most of the current RepRap slicing solutions are Java or C# based which is currently an issue for the Pi.

Maybe that's a project for someone to write the slicing software in Python. (Albeit slow! ;))

I have been looking into a Cortex-M3 solution for the RepRap electronics for quite some time, but my availability with this has limited the output at this time.

You can, in theory, run some of the interfaces over SPI/I2C from the Pi, the ADC and PWM elements, which are slow anyway as they are heating systems. Stepper drivers can be driven from the GPIO pins, (9 are required for the basic system), so system performance is not limited by the databus.

The key element is actually the interrupt controller in the BCM2835 which is not designed for Realtime operation.

You can do it synchronously, but it requires careful timing management within the firmware.

User avatar
mkopack
Posts: 242
Joined: Mon Nov 07, 2011 8:46 pm

Re: Raspberry Pi and 3D Printers

Wed May 30, 2012 2:57 pm

What's wrong with Java on the Pi? It works...

User avatar
Morgaine
Posts: 141
Joined: Mon Mar 12, 2012 1:13 am

Re: Raspberry Pi and 3D Printers

Wed May 30, 2012 5:52 pm

annodomini2 wrote:for RepRap it would be more beneficial to add the networking interface to the RepRap electronics than using the Pi as the interface.
That's exactly what adding a Pi to an existing Arduino-driven RepRap printer achieves. The Pi does the nextworking while the Arduino does the realtime control.
The key element is actually the interrupt controller in the BCM2835 which is not designed for Realtime operation.
Which is why one should leave the Arduino in the printer doing its realtime control, while the Pi does the networking which has no realtime requirement.
Intolerance is a failure of education. Education is predicated on tolerance of the uneducated.

annodomini2
Posts: 33
Joined: Sun Feb 05, 2012 12:00 am

Re: Raspberry Pi and 3D Printers

Thu May 31, 2012 10:09 am

Morgaine wrote:
annodomini2 wrote:for RepRap it would be more beneficial to add the networking interface to the RepRap electronics than using the Pi as the interface.
That's exactly what adding a Pi to an existing Arduino-driven RepRap printer achieves. The Pi does the nextworking while the Arduino does the realtime control.
The key element is actually the interrupt controller in the BCM2835 which is not designed for Realtime operation.
Which is why one should leave the Arduino in the printer doing its realtime control, while the Pi does the networking which has no realtime requirement.
But If you had read my previous post, most RepRapper's aren't willing to make this extra leap in cost.

All RepRapper's will certainly have either a PC, Laptop or Netbook.

Most RepRap electronics solutions support SDCard self operation;

You slice the design and save the GCode onto the SDCard, then set the machine going.

A Pi with the extras required currently comes in at the £40-50 region. Not including Monitor, Keyboard and Mouse.

A typical RepRap electronics solution is in the £100 region. So you propose adding up to 50% to the purchase costs of the electronics, just for Ethernet?!

Note: Currently software does not exist for the Pi to control a RepRap electronics solution.

Most RepRap electronics solutions are fully Open Source. The designs are available for modification.

The communications operations of a RepRap operate quite happily on a 57kbaud serial connection. So the Ethernet by itself is of minimal functional benefit to the RepRap system.

A Pi could be adapted to control a RepRap, be that directly or via the existing electronics solution.

But there is no financial or technical benefit in doing so!

User avatar
Morgaine
Posts: 141
Joined: Mon Mar 12, 2012 1:13 am

Re: Raspberry Pi and 3D Printers

Thu May 31, 2012 9:09 pm

I really don't follow your argument there as it's a load of disconnected statements, and what you say about the Pi and networking is just plain wrong.

The Pi is currently the cheapest board that provides a complete Linux system with full networking, and all the software needed to link a Linux system with a RepRap printer already exists and is already being used daily every time that someone connects their printer to a Linux host via the USB port.

The only difference between that TOTALLY NORMAL SITUATION TODAY and the simplest "Pi-networked printer" is that all the print-related software that would normally run on your standard Linux PC now runs on the Pi, and the Pi is physically embedded in the printer and hence the printer becomes accessible over your LAN. There is no software change needed at all just to get a Pi-networked printer working, and even creating advanced networked interfaces like remote print monitoring and job control only requires configuring standard Linux software,

So why you claim it's hard is beyond me. And why you claim that it's too costly, given that there is no other full Linux system with networking that costs less than the Pi, is beyond me too. And why you're trying to factor in other costs like mice and keyboard makes even less sense, since the Pi would be on your network and you'd access it either through your existing PC's browser or else use Synergy or x2x to redirect your existing mouse and keyboard to it.

I really have no idea what you're trying to say, as it just doesn't hold together factually nor logically and doesn't attempt a cohesive argument.

If you don't want your printer networked, fine, just don't. Nobody is forcing you.

But arguing that adding a Pi to an existing printer is too costly or hard is just so wrong that it's plain silly.
Intolerance is a failure of education. Education is predicated on tolerance of the uneducated.

User avatar
mkopack
Posts: 242
Joined: Mon Nov 07, 2011 8:46 pm

Re: Raspberry Pi and 3D Printers

Thu May 31, 2012 9:40 pm

Morgaine:

Yeah, I think you're on the right track...

Use the RPi as the replacement for your existing PC that is doing the slicing and sending of data to the Arduino based controller.

Might not be as fast at doing the slicing, but no reason it shouldn't work just like your current PC does for that job.

The difference is that it's a lot smaller, uses a lot less power, and you can attach it directly inside/onto the printer so it's a lot more self contained/portable.

I don't think anyone is suggesting replacing the Arduino portion of the control system with an RPi - that's likely not going to work given that the RPi doesn't have the same sorts of IO and can't do the realtime timing contraints needed due to the heavy Linux stack running on it.

Use the two to their individual strengths TOGETHER.

mgburr
Posts: 2
Joined: Mon Jun 04, 2012 5:37 pm

Re: Raspberry Pi and 3D Printers

Mon Jun 04, 2012 5:38 pm

I think you're spot on for the interface to the existing hardware. I was thinking about that the other day when making space for my printrbot. Do I really need to "rebuild" my aging dying desktop, or woldn't it be better to utilize the USB/Network capabilities of the R-PI to function as the intermediary. Do the work on the laptop, slice it and generate it as if it's going to an SD card, send the file to the PI that can then interpret it and send it out the USB. Don't see why it couldn't work, Plus wouldn't have some of the speed access issues of the SD card.

Could even set the PI up as a cups server dedicated to the printer.

Just a thought.

User avatar
Morgaine
Posts: 141
Joined: Mon Mar 12, 2012 1:13 am

Re: Raspberry Pi and 3D Printers

Mon Jun 04, 2012 8:50 pm

@mgburr: Given the fumes emitted by the filament extrusion process, I certainly won't want my 3D printer to live in the same room as humans nor environmentally sensitive computers with spinning disks, so networking it makes sense on physical and health grounds too.

What's more, the fact that the Pi has graphics output makes it more useful in this application than a headless Linux board would be, because when you pop over to the printing room you can control the process directly through the Pi without needing to place an additional workstation there.

Once it's printing happily, you then go back to your more user-friendly workstation environment and monitor progress through the network.

Morgaine.
Intolerance is a failure of education. Education is predicated on tolerance of the uneducated.

mgburr
Posts: 2
Joined: Mon Jun 04, 2012 5:37 pm

Re: Raspberry Pi and 3D Printers

Tue Jun 05, 2012 8:23 pm

@morgaine,

Was thinking that over last night in an IRC. Add in an HDMI display with touch screen, display status information on the display and echo it to a web page. Have override controls on the local interface, in case you need to re-set a clogged nozzle etc.

You could monitor progress via the web page, have it sendmail alerts in case of a problem, and go check it out.

Sounds like it would be an interesting project to get off the ground.

Have to go pick up the printer tonight and build it though :-)

Return to “Automation, sensing and robotics”