## Saturday, December 22, 2012

### Test Wax Castings with Pourable OOGOO

My early experiments with casting focused on OOGOO, a low-cost casting material made from cornstarch, silicone caulking and food coloring.  By adding Xylene (or in my case, lighterfluid) the putty-like consistency can be thinned to a pouring consistency.  The result is a very cheap molding fluid, with the drawback that the molds appear to shrink considerably over the course of several days.  However, since the stuff sets quite quickly and is relatively cheap, it should be no problem to let the molds set for a few hours and then immediately cast some parts.  To this end, I decided to try the process out with wax, as a kind of dry run.  The two molds (after a wax casting) are below:

The molds were still quite soft when I tried this and I didn't mix enough silicone to properly cover the parts so they deformed under their own weight a bit.  However the results were pretty decent, the white parts were the printed masters and the green were cast with candle wax.

It's evident on the smaller gear that some air bubbles were caught in the gear teeth.  I could probably improve this by brushing the part with mold material first.  If I were casting actual parts I would also add patterns for the bolt holes.

I'm not sure that this process is all that practical for actually making useful parts mostly because the molds are not dimensionally stable for more than a day or so.  But it does help to get a feel for the process and challenges.  These parts are already miles ahead of the previous resin casting I made despite being considerably more detailed.  This leads me to believe that it's a good idea to use single-piece, open-topped molds when possible since it allows air to escape.  With resin, it should also allow me to poke about in the concavities to dislodge any trapped bubbles.

## Wednesday, December 19, 2012

### Parametrically Designed Gearboxes

Using my Python CSG and Gear libraries, I've been able to start parametrically designing parts.  This can sort of be done with OpenSCAD, but the lack of proper variables and functions makes it difficult.  Recently I tried designing a full gearbox.  The script is shown below: it's a bit messy, but you get the idea:

import gears
import pyPolyCSG as csg

def make_clamp_hub( B ):
thickness = 9
hub = csg.cylinder( B/2.0+6, thickness, True )
hub = hub + csg.cylinder( 4.0, B+10, True ).rotate( 90.0, 0.0, 0.0 ).translate( B/2+3, 0, 0 )
hub = hub - csg.cylinder( 2.0, 100, True ).rotate( 90.0, 0.0, 0.0 ).translate( B/2+3, 0, 0 )
hub = hub - csg.box( B/2+6, thickness, 2, True ).translate( B/2+3.5, 0, 0 )
return hub.rotate(90,0,0).translate( 0, 0, thickness/2-0.01 )

def make_gear( pressure_angle, pitch, teeth, thickness, bore ):
px, py = gears.gears_make_gear( pressure_angle, teeth, pitch )
coords = []
for i in range( 0, len(px) ):
coords.append( ( px[i], py[i] ) )
gear = csg.extrusion( coords, thickness ) + make_clamp_hub( bore ).translate( 0, 0, thickness )
gear = gear - csg.cylinder( bore/2.0, thickness*100, True ).rotate( 90.0, 0.0, 0.0 )
return gear

pressure_angle = 20.0
pitch          = 0.8
N1             = 12
B1             = 8.0+0.7
T1             = 10.0

N2             = 36
B2             = 5.0+0.7
T2             = 5.0

backlash       = 1.0

dp1 = gears.gears_pitch_diameter( pressure_angle, N1, pitch )
dp2 = gears.gears_pitch_diameter( pressure_angle, N2, pitch )
do1 = gears.gears_outer_diameter( pressure_angle, N1, pitch )
do2 = gears.gears_outer_diameter( pressure_angle, N2, pitch )
dc  = ( dp1 + dp2 )/2.0 + backlash

gear1 = make_gear( pressure_angle, pitch, N1, T1, B1 )
gear1.save_mesh("gear_%gdeg_P%g_%d_tooth.obj" % ( pressure_angle, pitch, N1 ))

gear2 = make_gear( pressure_angle, pitch, N2, T2, B2 )
gear2.save_mesh("gear_%gdeg_P%g_%d_tooth.obj" % ( pressure_angle, pitch, N2 ))

def hole_xy( x, y, radius, height ):
return csg.cylinder( radius, height, True ).rotate( 90.0, 0.0, 0.0 ).translate( x, y, height/2.0 )

B1s        = 10.0
B1p        = 22
B2p        = 10

screw_diam = 4.0
box_thick  = 4.0
nema_offset  = 31.0/2.0

box_height = max( (do1, do2 ) ) + box_pad*2.0
box_width  = max( ( dc + (max( ( B1p, do1 ) )+do2)/2.0 + box_pad*2.0, nema_offset+dc+dp1/2 + screw_diam*2.0 + box_pad*2.0 ) )
screw_x_off = box_width/2.0-screw_diam
screw_y_off = box_height/2.0-screw_diam

g1_coords = ( box_pad+max((do1,B1p))/2.0, box_height/2.0 )
g2_coords = ( g1_coords[0]+dc, g1_coords[1] )

plate = csg.box( box_width, box_height, box_thick )

plate = plate + hole_xy( g1_coords[0], g1_coords[1], B1p/2.0+4.0, box_thick ).translate( 0, 0, box_thick/2+3 )
plate = plate - hole_xy( g1_coords[0], g1_coords[1], B1p/2.0, box_thick ).translate( 0, 0, box_thick/2+3 )
plate = plate - hole_xy( g1_coords[0], g1_coords[1], B1s/2.0, box_thick*2.0 )

plate = plate - hole_xy( g2_coords[0], g2_coords[1], B2p/2.0, box_thick*2.0 )
plate = plate - hole_xy( g2_coords[0]-nema_offset, g2_coords[1]-nema_offset, screw_diam/2.0, box_thick*2.0 )
plate = plate - hole_xy( g2_coords[0]+nema_offset, g2_coords[1]-nema_offset, screw_diam/2.0, box_thick*2.0 )
plate = plate - hole_xy( g2_coords[0]+nema_offset, g2_coords[1]+nema_offset, screw_diam/2.0, box_thick*2.0 )
plate = plate - hole_xy( g2_coords[0]-nema_offset, g2_coords[1]+nema_offset, screw_diam/2.0, box_thick*2.0 )
#plate = plate + gear1.translate( g1_coords[0], g1_coords[1], -10.0 )
#plate = plate + gear2.translate( g2_coords[0], g2_coords[1], -10.0 )

plate.save_mesh( "gearbox_plate.obj" )


This generates two gears and two gearbox plates that are mounted together using M3 screws.  The printed gearbox is shown below, although I'm missing some bearings and hardware.  Each plate has a recess into which a 608ZZ bearing can be press-fit.  Depending on the orientation it can either serve as a fixed or floating end.

I hope to use gearboxes like this to increase the speed that I can drive leadscrews at for my CNC project, which currently has pretty limited feedrates.  This would allow the use of cheap hardware store threaded rods, rather than expensive leadscrews, while still being a self-locking drive.

### Update on Pourable OOGOO

Just for completeness, after waiting a few days/weeks the pourable OOGOO that I made using standard OOGOO and lighter fluid did actually set up well.  However it also shrank quite a bit, so I doubt it will be effective for casting.

### An End to Captive Nuts

I've been using 3D printed gears and timing pulleys for a while now, but have been very disappointed with the captive nuts that are used by most scripts available on Thingiverse. Generally I've found that the material being printed isn't stiff enough to allow the set screws to be tightened enough to secure to the shaft without deforming. This causes the pulley or gear to deform out of true.

To get around this I've started using clamping hubs.  They're not too much larger than the captive nut hubs but deform uniformly so the pulley/gear run true.

The picture above shows an example gear.  I've used an M3 screw in the clamping hub.  It ends up fixing very securely to the 8mm shaft and has the additional advantage of not marking the shaft.

I printed the gear above after using my Python Involute Gear Script to generate the involute profile, followed by the Python Constructive Solid Geometry Library to generate the hub and 3D model. The full source of the script that I used is shown below:

import gears
import pyPolyCSG as csg

def make_clamp_hub( B ):
thickness = 9
hub = csg.cylinder( B/2.0+6, thickness, True )
hub = hub + csg.cylinder( 4.0, B+10, True ).rotate( 90.0, 0.0, 0.0 ).translate( B/2+3, 0, 0 )
hub = hub - csg.cylinder( 2.0, 100, True ).rotate( 90.0, 0.0, 0.0 ).translate( B/2+3, 0, 0 )
hub = hub - csg.box( B/2+6, thickness, 2, True ).translate( B/2+3.5, 0, 0 )
return hub.rotate(90,0,0).translate( 0, 0, thickness/2-0.01 )

def make_gear( pressure_angle, pitch, teeth, thickness, bore ):
px, py = gears.gears_make_gear( pressure_angle, teeth, pitch )
coords = []
for i in range( 0, len(px) ):
coords.append( ( px[i], py[i] ) )
gear = csg.extrusion( coords, thickness ) + make_clamp_hub( bore ).translate( 0, 0, thickness )
gear = gear - csg.cylinder( bore/2.0, thickness*100, True ).rotate( 90.0, 0.0, 0.0 )
return gear

pressure_angle = 20.0
pitch          = 0.8
N1             = 12
B1             = 8.0+0.7
T1             = 10.0

gear1 = make_gear( pressure_angle, pitch, N1, T1, B1 )
gear1.save_mesh("gear_%gdeg_P%g_%d_tooth.obj" % ( pressure_angle, pitch, N1 ))


I've found that being able to use Python is much more convenient than OpenSCAD, mostly because its possible to define (real) variables and functions/classes.  As a result I've pretty much switched to using the Python CSG library from OpenSCAD.

## Wednesday, December 12, 2012

### Read text file into std::string

Taken (unmodified) from a StackOverflow reply, but I use this frequently and always have to search for it.

std::ifstream in("file.txt");
std::string contents((std::istreambuf_iterator<char>(in)),
std::istreambuf_iterator<char>());


## Sunday, December 2, 2012

### Improving part surface finish and accuracy for casting

3D printing is great, but RepRap style printers generally don't produce great surface quality, while also having problems reproducing exact dimensions.  Most people address the second issue by filing their parts to fit, but I wanted to see if I could simply print test parts and adjust the dimensions a bit.

This seems to work pretty well, the part shown above had the post mounting holes pattern negatives (the pegs in the above photo) off by about 1.2 mm.  So I just subtracted that from the initial diameter and regenerated the part with my Python CSG library and, to my surprise, the diameters came out correct to within 2 thou.  The same goes for the horizontally oriented cylinder, one simple iteration of correction produced the correct diameters within a very small tolerance.  I've also found that printing external perimeters at 20 mm/s while printing everything else at the maximum reliable 80 mm/s feedrate for my RepRap gives the best surface finish and fastest printing time of all the options I've tried.

To improve the surface finish of the parts I tried filling the surface with Bondo body-filler to fill in the filament marks.  I wasn't sure if the Bondo would dissolve the PLA, but it seems to be fine.  After a light surface sanding the final part had a very clean surface finish, with little to no filament marks and consistent, accurate diameters.

The pink in the above photo is the Bondo fairing compound.  You can get an idea of how thin the coating is since you can still see the dimension adjustments I'd marked on the part through the fairing.  This coating just fills in the small gaps between the filament and allows the surface to be quickly sanded smooth.  This should dramatically improve the surface finish of cast parts.

Spending a bit more time on the patterns, embedding positives of the cores to be used in casting (the vertical pegs and horizontal cylinder above) and moving to an open-topped casting method should improve the quality of my cast parts considerably.  By using an open mold, I'm hoping that the air-bubbles that ruined the previous part can be popped at the exposed resin surface easily.  I've also remove sharp concave corners in the pattern, by filleting the relevant edges, in the hopes of improving these features.  Finally the time spent finishing the pattern should pay off in spades, since it will reduce cleanup of each cast part by the same amount.

### Pourable OOGOO

Recently I have developed an interest in using resin casting to produce small numbers (several dozen at most) of high-quality plastic parts.  The motivation for this is to be able to produce stiffer epoxy parts for my CNC quickly and at relatively low cost.  I've mostly been investigating a material called OOGOO, a Sugru 'substitute' made from silicone and cornstarch which is cheap, easy to get the raw ingredients for, and seems very well suited to casting resin parts, based on my experiments.  Below you can see the first ever resin casting I've made; I freely admit that it's a piece of junk, but turned out surprisingly well given the amount of knowledge I had about casting and is impressively strong compared the the 3D printed original.

However a drawback of OOGOO is that it basically forms a putty, so quite a bit of care is needed to make sure that you get good contact with the pattern in order to not leave voids in the mold.  People have tried making a pourable OOGOO using Xylene as a thinner (see comments in the OOGOO Instructable link above), but I can't seem to get Xylene in quantities less than about 4L, which is way too big a container to store in my apartment.

I've read in random forums that White Gas can be substituted for Xylene to thin OOGOO. 'White Gas' appear to be a catchall term and may or may not be lighter fluid depending on the brand and region where you live. So I decided to give it a go with lighter fluid to see i) if it thinned OOGOO to the point where it could be poured and ii) if the thinned OOGOO would ever set up properly.  The results, at least at the early stages, are 'yes' and 'maybe' respectively.  I'm hoping that a bit of time will change this to 'yes' and 'yes'.

After mixing a lot of lighter-fluid into the OOGOO, I definitely obtained something pourable.  I have no idea how much, I was simply winging it, but I would guess two parts lighter-fluid to one part each of silicone and corn-starch.  I poured it over a scrap PLA printed part, not knowing if the lighter-fluid would dissolve it:

At this (estimated) ratio, it was still quite thick, probably comparable to a cold molasses and so some coaxing was required to get it onto the part.  However it slowly settled on the part and settled around it.  I used PAM cooking spray as a release agent, again hearing on a random forum that it worked well.

Next time I would skip the release agent since I don't think the OOGOO sticks particularly well to the PLA printed part, and wherever it contacted the part but other OOGOO flowed over it the two bits of fluid would not adhere well.

Detail transfer from the part was excellent, but the OOGOO remained very, very soft after about an hour.  I'm hoping that this is simply because the majority of the solvent (lighter fluid) hasn't evaporated yet, and that once it does the mold will be more rigid.  At the moment the material is not stiff and tear-resistant enough to be usefully used as a mold, it will simply get destroyed when demolding the first few parts.

The bits left inside the jar that I mixed the thinned OOGOO appear to be much stiffer, so I'm hoping that a few days left to blow off the volatiles from the lighter-fluid will result in a stiffer material, but even several hours in the mold is still quite spongy.  I'll check it again after a few days and see if the mold is somewhat usable.  If so then I will probably start thinning my OOGOO.  I've also disccovered a tin of Xylene on the shelf in the parking garage, so I may steal a hundred mL or so, and if it works better, replace the tin with one I can dip into guilt-free from time to time.

## Thursday, November 29, 2012

### Improving 3D print quality, by doing the obvious

Some time ago I bought and assembled a RepRap Prusa with the intention of using it to prototype things.  It has saved me countless hours in prototyping my CNC but getting good quality prints out of it has been challenging at times.  Granted my standards for good have gone up even as I've developed a hunger to print as fast as possible.

Printing fast has worked for the CNC, which has large, fairly simple geometries.  It's nice to be able to print an axis end in two hours, rather than eight.  But when I try to print small, accurate objects I tend to run into issues, especially with PLA.  The biggest one has been that smooth surfaces end up ridgy, see for example the print in the image below:

That print is supposed to be a linear bushing with circular sections, but the print is garbage due to the ridges.  I tried a lot of things to reduce them, most focused on the mechanical rigidity of the printer.  I tightened everything up and added diagonal braces in the X-direction. I even 'floated' the entire printer by sitting it on soft foam blocks so that the entire printer could move as a rigid body when the bed and extruder moved rather than cushioning jerk with elastic deformation.  Amazingly enough, this simple idea CAN actually improve print quality for wobbly printers quite a bit, but did not fix my problem.

The focus on mechanics and dynamics is probably not surprising given my background, but it turned out to be misplaced.  What should have clued me in that the mechanics were not to blame is that everything got a lot worse with PLA, even when using the same travel/speed/acceleration settings that I had been using with ABS.

Eventually I did realize this and started looking for extruder/heat problems, measuring and adjusting temperatures and filament diameters, changing nominal nozzle diameters and so on.  None of these seemed to have any effect.

Finally I ran across a post (I don't remember where I found it), that said to just print perimeters slower.  This seemed crazy since i) the mechanics were sound ii) the extruder is perfectly happy running quite quickly with the beast of a stepper I have on it.  But I tried it and my prints instantly got better.

Here is a print with perimeter speed of 40 mm/s.  Although it's difficult to tell in the photo, the surface is actually quite a bit better than the bushing printed above using 80 mm/s perimeters. Finally here is the same print, but with 20 mm/s perimeters:

The difference in the photos is much more evident here and even more so in the real world.  Note that all prints were made with aggressive, active cooling.  So what gives? Why does the print quality improve when printing slower in PLA, even though the extruder and printer stiffness are the same that was used for ABS at much higher speeds?

I have a theory, taken from the post that recommended printing slower and combined with (my own) conjecture about the print material.  The theory is that communication lag between the host software and firmware causes the motion to stutter a bit, particularly on smooth curves that are discretized with many small segments.  With limited lookahead, the printer does a few segments very quickly and empties its buffer before the host can refill it.  This causes the printer to periodically, but regularly, stall.  Since the temperature of the extruder has to be kept high to print at high speeds, the PLA in the nozzle is runny and gobs out during these stalls, creating the surface ridges.  I suspect the surface imperfections are less noticeable with ABS because it generally is not as liquid as the PLA, allowing you to get away with higher feeds without noticing the buffer starvation.

I should be able to test this by changing the baudrate on the printer.  Doubling the send-rate should allow me to increase (ideally double) the feedrate, but will require recompiling the firmware to test.  When I get a chance to test the idea out, I'll post the results.

In hindsight, slowing things down was an obvious thing to try.  My Prusa bobs like a cork on the soft-feet at 80 mm/s and all of my experience on other 3D printers suggests that slower printing gives improved results.  But I wanted to have it all and kept increasing the feedrate.  However, if I am right about this, perhaps I can go back to printing at high feeds while keeping the high print quality.

## Friday, November 9, 2012

### First Resin Casting

Following up on my two previous posts on making Silicone molds from OOGOO, I actually managed to cast a part today.  I ended up with mixed, but promising results as you will see.

I started by cutting risers and sprues into the mold from my previous post.  Resin is poured into the sprues and air/resin escapes through the risers.  After the pour has finished, both the sprue and riser serve as reservoirs of excess resin to counteract shrinkage of the poured resin as it cures.

I used West System epoxy as a casting resin, which it is not specifically intended for.  It is however locally available and relatively reasonably priced.  Epoxy is also one of the least objectionable resins, much less stinky than polyester resin and apparently has substantially less shrinkage.  It's also easy to get the proportions right if you buy the pump kit.  But on the downside, it's meant for making boats, not casting.  Oh well.

I don't have any pictures of pouring the resin, since I didn't want to gum up my phone, but in the photo above you can see the mold with mounting hole rods inserted and sprue/riser filled with epoxy.  I used vaseline as a mold release, especially thick on the metal parts since I was concerned that the epoxy would bond to the posts and scrap not only the part but the mold as well.  After pouring I plugged both holes and tumbled the mold by hand, hoping to get epoxy into all the nooks and crannies.  I failed, but more on this later.  I was concerned initially since my excess resin hardened quite quickly, but the resin in the mold appeared to harden much slower, judging by how gummy the resin at the top of the sprue and riser was.  So I left it for about four hours and luckily everything seemed solid when I checked it.

Here's the bottom half of the mold removed.  Unfortunately I ripped off the bottom half a bit too vigorously and tore the center plug.  Anyway, it was only a first try.

Here you can see the part almost completely separated from the mold, the only bit remaining is in the central hole which is the bit that I accidentally ripped off.  The vaseline also worked really well as a release agent; a quick easy twist of the posts with some pliers and they slid out cleanly.  This photo also shows the pegs left by the sprue and riser.

I then cut off the sprue and riser and filed the surfaces quickly to clean up the filament marks from the mold.  The bottom half of the part turned out pretty well, with only a few small bubbles.  However the piece looks pretty terrible due to the residual rust from the central pegs being oxidized by the Oogoo acetic acid as well as the yellowish color of the resin, although the photo makes it look worse than it actually does.  I was pleased to see that the accuracy is excellent; after a light sanding of the central hole, the linear bushing I'm using slides in perfectly with no play, although it might need a little dab of glue to keep it seated while in use.

The top portion of the part did not turn out so well due to trapped air bubbles.  The chunks missing in the photo above are all due to trapped bubbles, some of which are over 5mm across.  That's quite big for this part, which is only about 40mm on a side.  The white flecks are dust from the quick filing that is caught in the open surface bubbles.  This part is good enough to be usable, but I will try to produce a better quality version.

I realize now that the way I designed the mold was not the best.  Rather than have the Ooogoo fill the central hole, I could have put a patterned blank in as was done for the mounting holes, making it easier to separate.  Additonally, since this part only needs a single true surface, it could have been case in a single-piece mold which would have allowed me to directly see which areas were not reached by resin and also to intervene.  Having this ability would allow me to avoid the spoiled corners that can be seen in the last photo.  I would also spend more time on the cosmetic details of the pattern since every minor surface flaw was transferred to the mold and then to the finished part.  While this doesn't effect the function of the part, it does annoy me.

As an experiment, I consider this to be a success.  Ugly though it may be, this part MUCH stronger than the original printed pattern.  It is also dimensionally accurate with good surface reproduction, leading me to believe that Ooogoo molds with epoxy resin is a viable method for producing small-run parts, if one that requires some practice.  I expect the next attempt will be considerably improved.

## Wednesday, November 7, 2012

### A second attempt at mold making

With the success of the last attempt at Oogoo-based mold making, I decided to try it on one of the current CNC parts.  The last attempt went well, but there were areas that could be improved.  To that end I bought real food-coloring, to get more consistent coloring of the Oogoo.  This is not important just for appearance, but also to see if it is mixed well.  I also bought a small plastic box that would contain the pattern so that I could pack the mold-material into the box around the pattern and be able to apply some reasonable force locally to get surface contact without deforming the mold elsewhere.

Here you can see the part with the steel rods that I'm using as patterns for the mounting holes.  I then put this in the container and packed Ooogoo around it as tightly as possible.  Using the plastic box really improved this step, since I could pack down the Oogoo without separating the mold from the pattern somewhere else.

I then waited about 30 minutes for the material to set and become rubbery and then pulled it out of the box, slit the mold around the edge with a box-cutter.  Here you can see the semi-separated pattern:

I then pulled out the pattern rods, slit one side of the through-hole and pulled out the pattern.

The surface quality is excellent, you can see the individual filaments of the printed part, as well as some 'flashing' where the pattern rods for the mounting holes didn't exactly meet the center hole.

You can also see where the acetic acid rusted the mounting hole peg.  Not sure how to avoid this, it seems to happen even when the pegs are oiled with vegetable oil (to act as a a release agent).

The top of the mold also shows filament marks.  Perhaps next time I'll fill the surface a bit and sand it down to improve the surface quality.  Anyway, the next step will be to cut sprues and risers to get the resin in and out of the mold.  I hope to try out actually casting parts in the next few days once I get some resin.

### My first attempt at mold-making

Having finally gotten the CNC up and running, I'm kind of interested in seeing how to manufacture it cheaply and quickly.  The design of the machine centers around 3D printed plastic parts that bolt to aluminum cheeseplates.  These printed parts are the weakest parts of the machine; they are great in the sense that you can build a mill without owning a mill, but bad because the strength simply isn't there.   They are also time-consuming to print: most parts take 30min each or so, meaning that to make a copy would take a couple days or so.  The partially assembled machine is shown below, everything white is 3D printed, and most of the parts are not actually visible.

Enter casting.  Cast parts can solve a few of these problems.  Cast parts are likely to be much stronger than the 3D prints because the parts will be solid material and less prone to delamination than the current parts.  They can also be made relatively quickly using epoxy or polyester resins, which set very quickly.  Not much faster than the individual prints take, but multiple parts can be cast in parallel, so an entire axis could be cast at once and be ready in a an hour or so, instead of closer to 8 right now.  Cast parts can be further strengthened by the addition of chopped glass fibers, yielding FRC or FRP (fiber-reinforced composite/plastic) parts, although this will add considerable complexity to the process and likely require vacuum-assisted resin-transfer molding.

A downside is that the casting materials and resins can be quite expensive.  Wanting to get my feet wet, I turned to OOGOO, a Sugru substitute made from Silicone caulking, corn-starch and food coloring (actually I used Mio water flavor to color the first batch).  Below you can see the first test, including all ingredients and the first part still en-molded.

It is important to get the right caulking.  You want clear 100% silicone caulking, with no anti-fungal additives, and preferably a brand that mentions that it will stink of acetic acid (or is 'acid-cure').  'Neutral-cure' is a no-no, as is acrylic caulking.  At first I tried GE Silicone II but this failed to properly set.  GE Silicone 1 is what I eventually ended up using with good results, which is good because it's about $4 per 300 mL, making it one of the cheapest caulks there. I don't have photos during the process because it was astonishingly messy, but can say that I mixed roughly 2:1 cornstarch to silicone by volume after adding mixing a few drops of water and coloring to the silicone. You don't have to add coloring, but it helps you tell if the stuff is well mixed once you add the cornstarch. Mixing the cornstarch is hard work, particularly in quantity, but you want a consistently colored, pastry like result. Basically as you mix, you want the stuff to kind of tear and crumble at first but eventually reform and blend together. Be quick though, because with these ratios you have limited working time. After about 10 minutes the stuff sets up into a putty that becomes harder to work with and by 20 minutes it's effectively rubber. However you can always mix more and it will bond just fine to Oogoo that has already set. With my first batch made, I globbed it onto one of the pre-redesign CNC parts, ever cautious that it would dissolve it to nothing or light on fire. After about 30 minutes I cut open the mold with great trepidation: I needn't have worried, the ABS part was just fine (as are PLA parts, by all appearances). Separating the mold showed that the Oogoo is perfect for this sort of thing: Here you can see the pattern still embedded in half of the mold and then fully separated. I used vegetable oil as release agent on the pattern prior to making the mold; this worked well, but it is hard to get the Oogoo around the part without also rubbing oil on the Oogoo surfaces that should not have release agent on them while building the mold. I will have to learn how to deal with this for the next part. Dimensional tolerances appear to be quite good, there is a firm friction fit between the patten and mold material. In the photo immediately above, you can see that I wasn't able to get the Oogoo all the way into the slot of the part, but this could be easily fixed with a handsaw on the finished part. With the pattern removed, the rods can be reinserted into the mold to create the impression for the mounting holds. Provided the casting resin has low-enough viscosity, it will then easily flow around these posts to create the mounting holes. I found it interesting to see that the acetic acid produced by the curing caulking actually corroded the post patterns, which you can see above by the discoloration of the steel posts where they were in contact with the Oogoo and by the rust-stains on the Oogoo itself. Anyway, this process seems like it has great promise. It's easy to work with, very cheap (less than$8 per pound) and seems to give quite accurate results.  The final molds are predominately silicone too, which has high heat resistance for the eventual polyester resin casting (I have seen large amounts of resin actually auto-ignite due to the exothermic reaction as the resin 'kicks').  I intend to keep playing with this stuff and hopefully end up with a reasonable method for performing casting of printed parts in the near future.

## Saturday, November 3, 2012

### Low Cost CNC Part VIII - Built-in electronics

In Part VII, I finally got the CNC cutting, but it was still a bit rough.  Cables ran everywhere, it was powered from a wall-wart and the electronics were sitting next to it on the table.  You can see the setup below:

Since finding the big C-channel piece that makes up the base of the machine, I've always planned to build the electronics into the base to give a nice, compact and clean machine.  I'd been waiting for a power-supply to arrive before doing this, but last week it came so I got to work.

The electronics are currently mounted to a piece of plywood that hooks on a key at one end and has bolt holes to bolt to some 3D printed plastic standoffs.  It fits into the base pretty nicely.

The plywood is a bit of an old shipping box; it had my address on it, hence the black tape.  Undoing two nuts on the right hand side allows the plywood to come loose:

Running approximately left-to-right, you can see the Arduino running GRBL, the three stepper driver carrier boards, a solid-state AC relay for spindle control as well as the power-supply and finally the E-stop button.  All the mains power is wired with 14 gauge household wiring connected with Marretts.  The E-stop button cuts all mains power to the power-supply and relay, thus rapidly immobilizing the machine.  The Arduino is unaffected by the E-stop, being powered from USB.  In this way, the E-stop also functions as an optional operator stop, allowing you to de-energize the machine, reposition it manually or change tools and then start it back up, knowing that it won't starting moving or cutting with your hands in there.

Looking from the back, the USB socket for the Arduino is accessible, as is the scavenged spindle socket and power cable.  In a subsequent revision I plan to replace these with panel-mount components, but I couldn't locate them locally last week.

It's still a bit ghetto, but quite functional and self-contained at this point.  I intend to finalize the electronics layout and then make a sheet-metal replacement for the plywood with front and back panels and all panel-mount components.  But for the moment, it's working pretty well and I can easily pick it up and move it without rewiring the whole thing.

The other, straightforward, addition was cable drags on all the axes.  This has really helped to clean up the machine, giving me something that looks more like an actual tool than before.  Hopefully I will be able to start using it for projects soon.

## Wednesday, October 24, 2012

### Low Cost CNC Part VII - It LIVES!!!

So for the last, nearly two years, I've been working on building a low-cost, homemade, 3-axis CNC milling machine.  Today for the first time, I can say that I've done just that, having finally actually cut something.  As far as I know, it's the first milling machine build largely from 3D printed parts.

You can see the entire process, from the beginning, in the previous six posts:  Parts I, II, III, IV, V and VI.

The mill is shown below, along with the 3-axis CNC controller that I've posted about before.

The spindle is a low-cost Dremel tool, currently attached with a Shapelock bracket.  It will no doubt get replaced with something less awful in the future (I am referring to both the Dremel and bracket, of course).

I have a Rotozip spiral-saw bit in the Dremel tool, to stand in for a proper milling bit.  It's a bit flexible, but more than up to tearing through MDF.

The whole setup is shown above and gives a good sense of scale.  My 3-Axis controller board is in the bottom right, controlled by my laptop.  The CNC itself has around a 6x6x4" working volume, although this is arbitrarily expandable in the X-direction.  The controller board runs GRBL, for which I have written a simple GUI for adjusting settings and jogging the machine. I plan to release the code for this when it stabilizes a bit, since GRBL needs a decent GUI.  I intend to add some basic features, like simple pocket/contour milling.  But for the time being, it's simply a software pendant.

So with everything set up, it was time to start cutting.  I attached my 3D printed iPhone mount to the XY table, started the Dremel, pressed record and began jogging the machine.  The result is pure awesomeness, for me anyway.

I had either the cutting depth or the feedrate too high for the spindle speed, since the bit began 'climbing', rounding the edges of the square when the feedrate was high.

But guess what? I don't care! 'Cause the CNC that I started nearly two years ago, which has been my preferred hobby while simultaneously being intensely frustrating has finally, finally, cut something. Praise Jebus!

Obviously there's refinement to be had.  For one thing, the ~10 mm long square sides should actually be one inch.  And I should make sure that the axes are actually square (I'd be shocked if they are).  Also I want to package the electronics in the base extrusion, provide a proper power-supply, perhaps some heat-sinks on the stepper drivers and maybe attach a real spindle.  And then there's ballscrews/belts.

But that's for later.  For the time being, my CNC actually cut something.

To my knowledge, this is also the first milling machine built substantially with 3D printed parts.  I hope in the not-to-distant future to get the feedrates up to the point of being able to 3D print with the mill itself. I also intend to build a tapping attachment to tap the holes used in the aluminum plates, which is -really- time-consuming and error-prone. This would make the machine as much of a RepRap as most 3D printers are, but considerably more solid.  But that's for later.

## Saturday, October 20, 2012

### Python CSG library release

I am releasing the source code to my Python CSG library, named pyPolyCSG.  The code is based on the Carve CSG library and provides Python users with a way to load/save meshes in a variety of formats (.obj, .off, .stl, .vtp) as well as apply transformations (translate/rotate/scale) and perform Boolean operations upon them.  I have now been using the library as a replacement for OpenSCAD for quite some time and finding it useful, as you can see below:

However it is very much a work-in-progress, particularly the installation.  I hope to be cleaning this up and adding features as time goes on.  If anyone has suggestions on how to package the code better, I'd love to hear them.

In the meantime, the code is up on GitHub at: https://github.com/jamesgregson/pyPolyCSG, licensed under the MIT license.  Please send your comments for new features, bug fixes or pretty much anything.

## Monday, October 15, 2012

### Low-Cost CNC Part VI - The Z-Axis

Following up on Parts I, II, III, IV, and V, the machine gets a Z-Axis!

With the addition of a Z-Axis the machine is starting to really come together.  The main supporting column is a 4x4" square extrusion with 1/4" walls, mounted at 30 degrees.  I'm hoping this will be stiff enough to be mounted cantilevered.  It mostly passes the 'grab-and-pull' test, but I can feel it deflect a bit when I yank on it.  Hopefully the forces during machining will be low enough for this to not be an issue.

I used two Newport 360-30 angle brackets to build the main support.  These normally retail for about $110 USD, but I was able to pick them up used for$38 each.  Here's a detailed shot of the lower mount.

This still makes them the most expensive part of the machine, but even with them, I think the mechanics could be built for about $100 per axis, including motors. I looked at a number of options for the supporting column, including welding a custom bracket, but all quotes came back at$300+.  This cost less than \$100 (including the column) and is pretty stiff. Plus I can re-use the brackets later.

I still need to tweak dimensions a bit.  As can be seen in the photo above, the Z-Axis is a bit low and doesn't provide much clearance over the XY table.  I will probably add a spacer on the angle mount and drill/tap a few new holes to get a bit more clearance.  I'm only shooting for about three extra inches.  This should give the final machine a few inches of working depth, including perhaps a small vise on the table and a cutter.  I may also flip the Z-Axis around and mount the plate rather than the carriage to the supporting column, which will give a bit more clearance but has other tradeoffs.

## Tuesday, September 18, 2012

### Simple printf style formatting of std::string

Nothing special here but a quick snippet that allows an std::string to be formatted similar to printf, which I prefer.  Not a safe function by any means, but great for debugging and log files. I must have looked up the C variable argument list code dozens of times over the years.  May not work under Visual C++ if Microsoft hasn't yet come to terms with vsprintf() actually being a part of the C standard library.

#include<string>
#include<cstdio>
#include<cstdarg>

#define STR_FORMAT_BUFFER_SIZE 2048

std::string str_format( const char *fmt, ... ){
char buffer[STR_FORMAT_BUFFER_SIZE];
va_list arg;
va_start( arg, fmt );
vsprintf( buffer, fmt, arg );
va_end(arg);
return std::string(buffer);
}


## Sunday, September 16, 2012

### Low Cost CNC Part V - A Redesign

I've been working on a homemade CNC now for quite some time.  My goal for the project was to produce something modular, where shaft-mounts, motor mounts and bearings were entirely separate parts using a standardized mounting pattern.  This would allow the machines to be put together like Legos and has a lot of advantages, like the ability to mix and match drive options, e.g. in the image below, one axis is screw-driver while the other is belt-driven.

I still think this concept has merit, however the part designs that I ended up using made for bulky and not particularly stiff machines. In the photo above, the top of the XY table is close to six inches from the base plate and the machine itself has considerable give.  Even worse, I didn't build enough slop into the designs to accommodate tolerances for manually built mounting plates, so it was actually quite difficult to get all the pieces to play nice.

I've since redesigned the machine to use more compact mounts, merged the shaft and motor supports into a single axis-end part and moved to half-inch shafting.  The switch to larger shafting results in a much stiffer machine, but unfortunately does require bushing style bearings.  Using the combined axis ends simplifies alignment, but unfortunately precludes belt drives.  I've also switched to Nema 17 steppers from Nema 23s, which leads to a more compact overall machine.  Surprisingly they don't seem to have much affect on the overall machine speed.  This makes for a much cleaner design:

Like the old parts, the new parts are 3D printed, but this time on my recently acquired RepRap.  The meshes were parametrically generated using my Python contructive solid geometry library, which is becoming quite usable.  This serves for prototypes, but final parts could be machines from plastic or aluminum.  The fixed-end for the leadscrew uses the same axis-end as the motor side, but with some bearing plates and Nylin nuts to take the axial loads:

After switching to acetal linear bushings, the bearings mounts can be made much more compact, reducing the height of the XY table from about six inches to a shade over 3.  These seem to run nicely on plain hardware store shafting, although hardened precision linear shafting would obviously be stiffer and smoother than cold-rolled bar stock.

Overall the machine is looking much cleaner.  I've decided to go with a knee-mill style machine rather than a gantry arrangement.  This means an XY table horizontally with a third axis mounted vertically. I bought a massive piece of aluminum channel to serve as the base of the machine, 10"x3"x20".  This provides a sturdy mount, and the controller and power-supply can be mounted to the underside.  Here's the thing midway through the build process yesterday:

And here's the finished-except-for-limit-switches XY table mounted to the channel.  The green duct tape is just there to stop it from gouging up my coffee table when I move it.  I will also probably replace the top cheese-plate with a thicker piece of flat-bar that's had all the holes drilled and tapped; I can't tell you how much I'm looking forward to doing that.

The mount for the Z-axis will be attached at the near-end of the machine.  I still have to design and build that mount, as well as print out the parts for the third axis.

After assembly, I simply had to try it out, missing limit switches or not.  I hooked it up to my 3-axis controller board with the Pololu A4988 carrier board carriers. The Arduino is flashed with GRBL, and wired to the carrier boards, which are in turn wired to the steppers.  I need to find some extra heatsinks for the X and Y axes, along with some thermal tape or epoxy, but they seem to run cool enough for testing anyway.

Here is it running, the first time I've gotten one of these CNC projects using actual GCode.  The leadscrew for the Y-axis is a bit loose in the fixed-end bearings, causing the knocking sounds, I have to look into the alignment, but otherwise it's working pretty well.  Speed is about one inch per second.

Next up will be designing a mount for the Z-axis.  I'm quite happy with the current set of printed parts and will probably continue to use them.