Pages

Thursday, May 07, 2009

4D Printing


Wot? Another coat hook? So what's new here?

The fact that it was printed in four dimensions, that's what. I've upgraded the Java host software and the Arduino/Sanguino G-code firmware so that the system treats the filament length to be extruded in each movement as another independent movement variable, like X, Y, and Z (as proposed here; you've got to have a stepper-driven extruder - like the pinch-wheel extruder - for this to work).

That is to say, the DDA in the firmware, which previously generated straight lines in (X, Y, Z) space, now generates straight lines in (X, Y, Z, E) space, where E is the growing length of extrudate needed.

From the outside, this means that everything works exactly as before. So why bother? The reason is that it makes it a lot easier to do tricks like accelerating and decelerating the extrude head as it moves, which means that it can both go faster and run on less current. This will be the next thing that I do.

I've done a new release of the host software in the repository available here, and written an upgrade to the Arduino/Sanguino firmware called FourD_GCode_Interpreter available here. To turn on 4-dimensional behaviour, simply set the flag FourD=true in the reprap.preferences file. Set it false to make the machine work as it did before.

Perhaps surprisingly, the firmware doesn't need to know if it is being driven in 4D mode or 3D mode. Lines in the G-code now look like:

G1 X23.9 Y39.0 Z0.2526 E66.5 F3000.0 ;print segment
G1 X23.9 Y39.7 Z0.2526 E67.2 F3000.0 ;print segment


So, for example, the second line is saying move 0.7mm in Y from where you last were and extrude 0.7mm of filament while doing so, all at 3000 mm/minute. But if you leave the Es out and turn the extruder on and off separately, everything works just as before (so old G-code files will still work). You can still control the extrude rate separately too - just set the extruder to go at a different speed to the carriage, and everything comes out right automatically.

Unsurprisingly in retrospect, this taught me something about the control of the stepper which drives a pinch-wheel extruder: you don't want to turn the current off between plotted segments. If you do, the stored spring energy in the compressed filament and the pressure in the melt chamber cause the stepper to slip back (as no current is flowing to hold it) at the end of one line segment and before the start of the next, resulting in a poor-quality build. The new firmware turns the current on when the extruder is first used, and leaves it on until the temperature is set to cool. The latter is a bit of a hack (and we could easily add a "current off" M-code instead), but in practice it works very well. The resulting build quality is excellent.

One final thing: I have only tried the firmware in the Sanguino, and not the Arduino. I can see no reason why the latter shouldn't work, though. Let me know...

13 comments:

  1. Adrian, I love this approach-- i have taken the same approach on my extruder.

    This approach appealed to me because when the extruder is the 4th axis, it should make it possible to do melt-flow compensation by using the 'position' and speec of the 4th axis.

    in my case i switched to incremental units to avoid a potential size issue with the ever-growing value of the axis.

    is that what you did?

    ReplyDelete
  2. Could the incremental distance be used instead of the total distance? Using the incremental distance would mean a smaller distance variable and probably less calculation time on the Sanguino.

    ReplyDelete
  3. > incremental distance

    Yes - you get that automatically, as there's a G-code to switch from absolute to incremental positioning, and another to switch back. Now it does that for all four axes, of course.

    ReplyDelete
  4. Thoughts for what they are worth.

    Is it worth having an E1 to En so as to be able to run more than one extruder at once say for example two extruders at once. I am thinking here of running two feed stocks through independent barrels and nozzles set in a common heater block. One as the build material the second as a support material.

    Sort of a 2 in 1 extruder......

    ReplyDelete
  5. That's really neat Adrian.

    Should we now be describing the RepRap as a 4D printer?

    Vik :v)

    ReplyDelete
  6. I like the scary idea of running a number of extruders simultaneously to mix resins or colours or whatever. I won't make that addition for a while; I just want to add an accelerate/decelerate option, then we'll leave it to bed in for a bit. But we should definitely bear that in mind for the future.

    Calling RepRap "4D" - great for geeks; off-putting for keegs*, whom ultimately we want to be our main users, I think :-)

    *According to this new-fangled world-wide-cobweb thing, there is no antonym for the word "geek". The nearest is e-tarded, which doesn't quite cut the mustard. So I just coined that neologism. Remember, you saw it here first...

    ReplyDelete
  7. Much as I like your suggestion of mixing on the fly it wasn't quite what I was thinking of.

    Nophead has done some great work with different polymers. But most striking was that when he was working with the same polymer but different colours the physical properties ie melt temperature and adhesion were different. They were affected marginally by the pigment added to colour the base polymer. The pigment was acting as a dopeant.

    Theoretically if you have two independent extruders and nozzles sharing a single heater assembly with the common heater block set up for the temperature of the polymer to be used as the build material. If the second material is doped (coloured) to be less sticky at the same temperature it can be used as a detachable support material.

    By keeping the nozzles close together the amount of head travel needed when switching between materials will be minimised. As each layer is printed.

    Because you are relying on the differing properties of the two polymers you will not need to change the heater temperature from it's set value during the run. This means you will not be waiting for the temperature change when you switch materials.

    Eh voilĂ  detachable support material.

    Thoughts for that they are worth.

    Cheers

    aka47

    ReplyDelete
  8. i see a potential problem with the two print heads, the second head might go over a section that has already been printed ans so is slightly higher.

    not sure how common those collisions would be, or if they can even happen, but it is a potential soure of problems. What is the clearance between the printed plastic and the print-head? what happens if one of the two nozzels is half a millimeter higher or lower?

    ReplyDelete
  9. Catty

    Less of a problem than it might first appear fortunately. But well observed.

    Both nozzles have to be adjusted to be exactly level.

    Even printing with one nozzle the nozzle is spaced from the work piece by at least the thickness you want to print. This is how one nozzle printing avoids smudging and colliding with what it has already printed.

    If the two nozzles are exactly level the second nozzle has the same clearance as the first and is no more likely to collide and smudge the print than was the first.

    Nophead also had a strategically placed brush to occasionally wipe the nozzle and get rid of Klingons.

    Hope this helps.

    Cheers

    aka47

    ReplyDelete
  10. aka47,
    Bizarre, I had the same idea while out walking this weekend. I.e. using green ABS as a support for white.

    I have no idea if i will work, but worth a try when I have two extruders working.

    ReplyDelete
  11. ...

    Err, why are you extending G-code with an E keyword like it were a new axis? The extruder only goes one direction, right? (And even if you do need an axis, why not use one of the ones G-code already has defined, like C or B?)

    It seems more elegant to me if you used the S keyword to set the spindle speed, then tie the extruder feed rate (spindle speed) to the XYZ axis motion. For example, with S75 (75% rate), the extruder could extrude 75 mm of plastic for every 100 mm of motion on the XYZ axes. This would let you handle acceleration as well, since you can make extrusion match the instantaneous speed of the motion while accelerating, while not having to independently calculate out a distance to move on the E axis like you have now.

    When folks want to hand-tweak the G-code later for optimization, (and they eventually will), they'll thank you for the ease of use, and consistency with standard G-code.

    ReplyDelete
  12. ...

    Err, why are you extending G-code with an E keyword like it were a new axis? The extruder only goes one direction, right? (And even if you do need an axis, why not use one of the ones G-code already has defined, like C or B?)

    It seems more elegant to me if you used the S keyword to set the spindle speed, then tie the extruder feed rate (spindle speed) to the XYZ axis motion. For example, with S75 (75% rate), the extruder could extrude 75 mm of plastic for every 100 mm of motion on the XYZ axes. This would let you handle acceleration as well, since you can make extrusion match the instantaneous speed of the motion while accelerating, while not having to independently calculate out a distance to move on the E axis like you have now.

    When folks want to hand-tweak the G-code later for optimization, (and they eventually will), they'll thank you for the ease of use, and consistency with standard G-code.

    ReplyDelete