Thursday, November 6, 2014

Some thoughts on the .314 Atlas

If you follow 3D printing news, or just geeky technical news in general, you've probably seen mention of the "new bullet" that will "make 3D printed guns a reality". Sadly, as with most reporting about the intersection between 3D printing and firearms, the reporting on this topic has been long on emotion and quite short on information. Let's change that.

I should disclaim that although I know something about 3D printing, guns and mechanical design, and I believe I'm reasonably able to read and understand things as varied as dimensioned drawings and firearms laws, I am not an engineer, gunsmith or lawyer. Take anything I might say here with the appropriate serving of salt.

First, let's dispense with the immediate inaccuracy: the .314 Atlas, which is the name given to the project by its creator, Michael Crumling, is not a "new bullet". The bullet is the bit that goes downrange; that is, the thing that the gun shoots out of its barrel. In a modern, breech-loading gun the bullet is combined with three other parts in order to make a round or cartridge of ammunition: the case, the primer and the powder. What Mr. Crumling has designed, and deserves full credit for, is an innovative case. The bullets appear to be ordinary lead balls, the primers and powder appear to be ordinary commercial parts. In fact, calling the .314 Atlas a cartridge design might be very important, as I'll get to a little later.

To understand what the innovative part is, you need to know something about ordinary ammunition. The case is typically made of brass, with a fairly heavy base and thin walls in the form of a tapering cylinder that's open at the top. The primer fits into a machined recess at the bottom, the bullet in the open top, and the powder is contained inside. The Wikipedia page has plenty of pictures and a couple of cutaway drawings. The case can be made of brass because even though the powder is going to burn inside of it, it doesn't have to contain the pressure. When the round is loaded for firing it is pushed into a carefully machined chamber at the back of the gun, a part known as the receiver. It can be a separate piece of metal, or integral with the barrel. The shape of the chamber precisely matches the shape of the case, with the bullet extending just into the barrel and the primer end of the case flush with the edge of the receiver, or protruding just a little (so the ejector can grab it, but that detail isn't important). When the round is fired, a metal pin crushes the primer to ignite it, the primer ignites the powder, the powder burns into hot gas at very high pressure which pushes the bullet down the barrel, and the bullet goes downrange. Afterwards most cases can be reloaded and reused, though some are designed to be disposable.

Of course, where the case is light and relatively weak, the receiver and barrel are heavy and strong. Machined out of steel, they can withstand the pressure of the hot gases thousands of times. The barrel also contains spiral grooves called rifling that cut into the softer bullet and cause it to spin, which dramatically increases accuracy. In the process, the bullet is formed to the barrel so that the hot gas doesn't leak past it; any leakage means lost energy.

Readily available 3D printers, the kind that use Fused Filament Fabrication (FFF) with spools of plastic filament, can't make strong receivers or barrels. The best they can do is make big blocks of plastic that will hopefully not shatter the first time that a cartridge is fired inside them, and even then are only able to handle a small, low-powered round. 

Now let's look at the gun that Mr. Crumling designed to go with the .314 Atlas cartridge. He chose to use a manufactured trigger, its associated parts, hammer and firing pin. That's not important; those things could be 3D printed as well, at least the trigger parts; in his design a heavy hammer and stiff spring may be necessary, and those might have to be metal. But that's a minor detail. The key is the case design, which replaces the thin brass with heavy steel. Effectively, what he's done is combined the cartridge, receiver and barrel into one unit, each of which fires one shot (though his design is readily reloadable after it is used).

I have no doubt that this is an innovation. However, it is also a compromise in several important areas. I'll try to explain everything that I've observed so far; keep in mind that there may be workarounds for some of these complaints, but also that other issues might come up as more experience is gained with the new design.

First, the feature touted for most 3D printed guns is that they can be made entirely out of plastic, and therefore be difficult to detect. That's never actually been true; although the gun can be plastic, the ammunition still needs to have metal in it. But since the ammunition can be brass, copper and lead, it may be more difficult to detect that the typical steel gun. Clearly that will not be the case for this design, since the ammunition will itself contain substantial amounts of steel. I'm also doubtful that the hammer and its spring can be plastic, because of they way the gun works. When it is fired, the hammer briefly holds the cartridge in place, until the bullet has exited, and then the cartridge is "ejected"; really, it is allowed to fly out of the top of the gun. I don't think that a plastic hammer and spring would have nearly enough force to keep the cartridge in place, and it would likely move even before the bullet was out, an obviously dangerous situation. Of course, the hammer and spring should be easy to obtain and this is not an objection for the ability to manufacture the gun, only to conceal it. Those of us who would prefer that guns be detectable will view it as a feature.

Second, this gun doesn't really have much of a barrel. The part of the Atlas case that extends beyond the bullet as it is seated prior to firing is the only effective barrel, and it looks to be about an inch based on this drawing. Short-barreled guns are nothing new. As with anything they have both strengths (small size, light weight, lower cost) and weaknesses. They're substantially less accurate, for at least three reasons: the short barrel doesn't do as good a job of getting the bullet spun in its rifling, the light weight means the gun will be less steady when aimed, and the short distance between front and rear sights makes aiming less precise. They also don't impart as much energy to the bullet, because the hot gases from the burning powder don't push on the bullet very long, and the powder doesn't have enough time to burn before the bullet leaves the barrel. This last problem certainly affects the prototype gun, as can be seen in this picture from Mr. Crumling's website. The spray of sparks is grains of powder that were blown out of the cartridge and burned in the air; they didn't contribute anything to the energy of the bullet. Now, Mr. Crumling says that he's still working on the "load", which is the combination of bullet weight, powder type and amount, and he may very well be able to reduce the amount of unburned powder, but that doesn't give the bullet more energy.

Third, manufacture of the .314 Atlas cases is a precision machining job. Mr. Crumling is obviously a skilled machinist and has been able to turn out quite a few, at relatively low materials cost but a considerable investment in his time. They could also be manufactured by a machine shop, though there is some question about what legal hoops would need to be jumped through for that to be acceptable. In any event, though, there are two possible choices for obtaining Atlas cases: become a machinist (if you aren't already one), or buy them. It's also true that those are the two choices for obtaining conventional gun parts, and have been for some time. So if you're going to need to invest skills or money, why not just make or buy a regular pistol barrel and design a 3D printed gun around it? It might not be as cool, but it would likely be a much better gun. Or you could make a crude gun with little or no machining skill; something like a Colt Liberator or the "zip guns" that have been occasionally manufactured even in prison.

Fourth, the barrel portion of the Atlas case isn't rifled. The drawings show a couple of gun frame designs that include printed barrel sections with rifling, but it's obvious that they won't have any effect on the bullet. If they are sized to actually engage the bullet, they'll be broken off by the first shot; if they're larger, the raised rifling won't do anything and will be worn away by the hot gas in just a couple firings.  It might be possible to machine rifling into the case, though that would be very difficult; I'm not confident that it could be done at all in the current one-piece design. Perhaps if the case were threaded so that the "barrel" portion could be separated from the base, but then the design would be much more complex. An unrifled gun with a one-inch barrel is going to be inaccurate at anything but extremely short distances, a matter of a few feet; even for close-range use like home defense I would not want to trust its accuracy.

Finally, the lack of rifling may be the downfall of this entire concept. I can't see how anyone would make the case that the printed barrel has any function, and therefore the only barrel that this gun has is the smooth interior of the case. Entirely apart from the issues with accuracy and power, that appears to create a serious legal problem. There are a whole class of guns with smooth barrels, called shotguns; they generally fire a cluster of tiny round pellets, or a single bullet that has rifling grooves molded into its exterior to provide some spin. They're perfectly legal and used by thousands of sport shooters and hunters. But the law says that they have to have long barrels. Pistols with smooth barrels aren't part of what the law considers "firearms"; instead, they're in a category called "any other weapon" or AOW. They can be legally manufactured in many states, but must be registered and a fee of $200 paid for each gun. If that isn't done, the owner is liable for severe penalties. And in states with restrictive gun laws, AOWs aren't legal at all. Whether a gun based on the .314 Atlas is an ordinary pistol or AOW is certainly not for me to decide, but the question is undeniable and the chance of running afoul of the law isn't worth the risk, to me.

What's the conclusion of all this? I think that the .314 Atlas is an interesting and innovative idea, though not especially practical. It might become a stronger influence if it causes a realization that a fully 3D printed gun is a dead end, and that it makes more sense to incorporate 3D printing where it has a strong role, for example in producing customized grips and accessories, rather than trying to make it serve in roles for which it isn't suited. Perhaps there will also be a new direction of producing metal parts that are specifically designed to be used with 3D printed components; there could certainly be interesting designs made that way. But this isn't the dramatic development that the popular press would have us think.

Thursday, January 16, 2014

3D Editing the Hard Way

Last spring I was digging around Thingiverse, looking for cool things to print, and came across Dizingof's version of a Klein bottle. It was good timing; a week later he decided to remove all his models from the site, but it was also at a point in my 3D printing experience where such a complex print seemed far too difficult.

In the intervening months, the file sat on my hard drive, up until this week when I finally decided that we'd done enough printing, tuning and fixing to attempt it. I fired up Slic3r, tweaked the config a little to drop down to 0.2 mm layers for all the fine details, and exported the file. This took some time. The result was a 34.5 MB file; I uploaded it to the OctoPrint instance controlling the printer, crossed my fingers, and pressed Print.

The initial result was disappointing. I watched the printer make something that looked very much like this:

The solid line is a double skirt, which simply gives the extruder time to start extruding (double because this printer has a Bowden tube, so it tends to drool a bit while heating up). The little blue dots are the beginning of the print, but they're very small, and oddly asymmetric. And then the Z axis went up a step, and printed this - or tried to:

That looks a bit thin but more like what I expected, albeit with a serious problem: most of those dots didn't have anything underneath them, and the printer was dutifully trying to print them in mid-air. That doesn't generally work. I killed the print, and set about figuring out how to fix it.

The simulated print pictures are from Repetier-host, which lets you step through a print layer by layer. The next two layers were loops and circles but I found a nice solid ring at layer five:

That's what I wanted to have for my first layer, but it was already a millimeter in the air.

Keeping in mind that this is a piece of sculpture rather than a machine part, I didn't have any qualms about modifying it a little to make it print better. I'm sure there are ways to slice off the bottom millimeter of the STL in Meshlab or Netfabb or some other program that I don't know how to use, but I was looking for something I knew, and it would be nice to avoid having to re-slice. Did I mention that the slicing process was slow? I actually left it running overnight, so I'm not sure how slow, but I really wanted to avoid reslicing. So I opened up the .gcode file in my favorite editor, vi, to see what I could do.

I should stop here and point out that there's no need to use vi for this task. Use anything that can edit a text file without adding formatting and font changes and paragraph styles; something that advertises itself as a "programmer's editor" or "text editor" will likely work. The biggest advantage of vi for this task is the ability to repeat a command a specified number of times, which comes in handy a little later.

The first few lines of the file are comments, laying out how Slic3r was configured. The next few are a kind of preamble, with calibration, temperature settings for the heated bed and hotend, etc. I was looking for the first lines that commanded the printer to move, using the G1 command:

G1 F1200.000 E-3.00000
G92 E0
G1 Z0.200 F7800.000
G1 X78.016 Y84.757 F7800.000
G1 E3.00000 F1200.000
G1 X78.736 Y84.197 E3.03034 F1200.000

The "G1 Z0.200" is key, that's where the printing actually begins. The first layer consists of everything between that line and the next move command for the Z axis:

G1 F1200.000 E0.04300
G92 E0
G1 Z0.400 F7800.000
G1 X89.870 Y115.575 F7800.000
G1 E3.00000 F1200.000

This print is using 0.2 mm layers, so every time a new layer starts the Z height jumps by that much. I can keep searching through the file for "G1 Z" and find the start of each layer; since I want the print to begin at layer five, I"ll look for when the height reaches 1 mm:

G1 F1200.000 E2.72067
G92 E0
G1 Z1.000 F7800.000
G1 X96.349 Y83.331 F7800.000
G1 X93.815 Y86.897 F7800.000

It happens to be line 4328. Jumping back to the beginning of the first layer, I note that it's on line 38, so I use vi's delete line command to get rid of 4289 lines between them. That gives me back-to-back Z moves, but I don't want the printer going up to 1 mm; I need it to stay at 0.2 mm and print the old fifth layer as the new first. So I have to fool it with another G-code command, one that Slic3r uses all the time for the extruder but never for the XYZ axes:

G1 Z0.200 F7800.000
G92 Z1.000 ; fool the printer into thinking that it's at 1 mm already
G1 Z1.000 F7800.000
G1 X96.349 Y83.331 F7800.000
G1 X93.815 Y86.897 F7800.000

This makes the second Z move command do nothing, but I've left it there as a place marker. Now I can upload the modified file, and watch as the print gets a nice, solid foundation.

For some reason the first layer is slightly different color, but that made it easier to photograph so I won't complain. I'm quite pleased with the finished product, too!

Incidentally, this trick of editing gcode can also be used to salvage a part that's gone bad, especially if it's mostly finished with just a little more to do, and the remainder is in one piece. You'll need a way to figure out which layer the printer was working on when it failed, probably by measuring the height of the partial print with your calipers. Then find the closest layer to that height by searching for Z moves, delete everything between the beginning of the first layer and that point, and use G92 to reset the Z height as above. With a little luck, and glue, you may save yourself a lot of frustration. . .

Wednesday, January 1, 2014

You Need a Vernier Caliper

... if you're trying to run a 3D printer, that is.

For the last couple of months our two operational printers have been spending most of their time printing parts for other printers; the OB1.4 has been especially busy since it can handle the larger parts, and has been upgraded with a heated bed to prevent warping (highly recommended, even if you only print PLA). But those parts are all done, so they've been looking for work. A couple of weeks ago I saw a jumbo-size geared heart printed by a friend, and decided that it would make a fine Christmas gift; I picked the PLA Heart Gears and put the OB to work. The first part looked great, and the next, but soon things started to go awry. The printer couldn't go more than a few minutes without the extrusion slowing, causing weak layers; sometimes it would stop entirely and ruin the print.

We'd had some similar issues printing the first GUS Simpson prototype, but I replaced the extruder with an improved version and a much better hobbed bolt, and since then had gone through three 2 kg spools of filament with no stoppages. So I started by tweaking the hot end temperature, then lowering the printing speed, trying to use shorter retractions, stopping retraction entirely, and a few other minor tweaks. Nothing really improved the situation, the print had failure after failure. I finally finished the heart late on Christmas Eve by editing the G-code files for two of the parts and printing just the portions after the jams, then gluing the pieces together.

Needless to say, this was very frustrating, not to mention painful - I had been babysitting the printer waiting for it to have a problem and my thumb was sore from trying to push the filament each time it began to jam! I knew that the printer wasn't having hotend issues, because every time I pulled back the jammed filament, cut it off and reloaded, it would extrude with very little pressure. After everything was done, I was determined to find the problem. I went back to the pieces that I'd cut off, the 30 cm or so that was inside the Bowden tube between the extruder and the hotend. It didn't look bad, but when I got out my trusty vernier caliper, here's what I saw. . .

When I first unwrapped this filament I measured it, as usual, and saw that it was elliptical rather than circular; that is, it was significantly thinner measured one way than the other. That isn't a good sign, but it also isn't typically a big problem, as long as the average cross-section is consistent. In this section of the filament however, the measurements at those two points were 1.43x1.55 mm, and 2.03x1.92 mm. Keeping in mind that this is supposed to be 1.75 mm filament, that kind of variation is no good - on several levels.

When an object is sliced, the extruder movement commands are calculated based on an assumption about the volume of plastic that will be extruded for each millimeter of filament pushed forward. I'd told Slic3r to expect a circular cross-section with a diameter of 1.75 mm, so the volume in a linear millimeter is 2.41 mm3. On this filament where it measures 1.43x1.55 mm, the volume is 1.74 mm3 (28% too low) and at the fat section, 2.03x1.92 mm, it's 3.09 mm3 (28% too high). Such wide variation is going to result in weak spots that can allow the print to split apart and blobs that can cause the nozzle to drag through lower layers and pull the part loose from the printbed.

But what was killing my prints was the fat section. Our OB uses a J-Head hotend (a real one, from the designer) and it is drilled out to 2.00 mm diameter. The extra diameter doesn't sound like much, but when I tried pushing that section of filament into a spare J-Head, it wouldn't go in more than a centimeter without a lot of force, and pulled a section of the PTFE liner out when I removed it. It wouldn't fit in an Aluhotend or a Ubis either. The problem is that if you make the inside diameter of the hotend large enough to accommodate these kinds of variations, the filament will kink and jam.

By the way, I'm not going to name the manufacturer of this filament, because I bought it almost six months ago and it's possible they've improved their product. It was purchased on eBay at a very low price, $27.99 with free shipping, so I thought it was worth a try, but I've since discovered that the seller (who is apparently just reselling from an overseas factory) offers no guarantees on the filament diameter, and even goes so far as to claim that if their filament doesn't work it must be the fault of the printer, not the material. So this filament is going in the trash. I will name some of the places where we've bought high quality filament: ProtoParadigm, MakerGeeks, Printed Solid and Printrbot. They're all more expensive than the eBay seller, as much as twice the cost, but the key is that their product works (and won't end up in the garbage can). And even with those sellers I still measure the filament before the first print, just to see. . .