Tag Archives: OpenSCAD

Another rebuild for my ShapeOko 2

Rebuilding the whole thing

As you might have seen in this post, my grbl shield is broken and I’m in the process of replacing it with a gaups shield from ASL. When my new shield is assembled it is my plan to build some sort of casing for it (mostly for protection). Furthermore, I’ve decided to make my ShapeOko 2 larger so I’ve ordered some new parts for it (longer MakerSlides among other things). I then realized that my dust collecting cyclone (made by a friend of mine) has to be remade as well to support the larger ShapeOko 2 in my workshop and to get it out of the way, when I use the ShapeOko. Any project has a tendency to grow on it’s own… πŸ™‚

Cyclone

My old cyclone has been working very well so I’m not going to discard the basic idea: My friend who is a chemical engineer discovered that an empty bottle from a particular brand of soft drink has a cone shape, that fits the theory behind a cyclone very well (actually nearly perfect). Furthermore, it’s my plan to mount it on the wall and use pipes to get the dust collection where I need it, so I went looking for pipes that will fit the hose on my vacuum cleaner. As it turned out a 32 mm plastic pipe fits perfectly.

Bottle and plastic pipe.

Bottle and plastic pipe.

The theory of cyclones

I’m not an expert in cyclones so I went looking for information about cyclones on the Internet and Thayer School of Engineering at Dartmouth turned out to have a pdf from a course on their homepage, that explains everything very well. Especially the drawing below was helpful:

Standard cyclone dimensions

Standard cyclone dimensions.

Calculations

Since the cyclone diameter D, the dust outlet diameter Dd, the gas outlet diameter De and the cone length Lc all are defined either by my bottle or by the vacuum cleaner hose, the remaining calculations are easy. The values measured on my bottle are:

  • D = 75 mm
  • Dd = 26 mm
  • Dc = 29 mm
  • Lc = 160 mm

This gives the following values:

  • D/D = 1
  • De /D = 0,39
  • Dd /D = 0,35
  • Lc /D = 2,13

These values lies somewhere between (2) and (3) in the standard cyclone dimensions, so I decided to aim at a cyclone with dimensions as an average of the values of (2) and (3). I know it won’t be perfect but hopefully it will work just fine. My calculations are:

Cyclone calculations

Cyclone calculations.

Drawing in OpenSCAD

Then it’s time to make a drawing in OpenSCAD (I love that program). The drawing below is what will become the inside of my new cyclone. Here is the OpenSCAD file: Cyclone and the STL files.

It looks like this:

Cyclone in OpenSCAD

Cyclone in OpenSCAD.

The cone itself and part of the body is made out of my bottle and the top will be milled in wood on my ShapeOko. The top will be four slices 20 mm thick: One with a 32 mm hole for the vacuum cleaner hose, one with a 80 mm (the outer diameter of my bottle) hole holding the bottle and two pieces that glued together will form the inlet. The last two parts look like this:

 

Inlet top part.

Inlet top part (upside down).

Inlet bottom part.

Inlet bottom part.

Milling the parts

I used ArtCAM Express to generate the g-code for milling the parts. The finished result is here:

The four pieces for the cyclone inlet part.

The four pieces for the cyclone inlet part.

Stacked on top of each other.

Stacked on top of each other.

Notice that the inner diameter of the cyclone is 75 mm and the fourth piece has an 80 mm recess for holding the bottle. Furthermore, my calculations above suggested that the value of Lb should be 128 mm but the height of the inlet is about 40 mm, so I cut my bottle at 88 mm from the top of the cone in order to make the entire height 128 mm.

More will follow… πŸ™‚

Part 2.

ShapeOko 2 tutorial – Dominion turntable – part 2

If you missed part 1, please find it here.

Drawing in OpenSCAD

OpenSCAD is a software for creating solid 3D CAD objects. It is free software and available for Linux/UNIX, MS Windows and Mac OS X. Take a good look at the homepage where you’ll find tutorials, cheat sheets and other documentation.

When you open OpenSCAD it will already contain an empty drawing. If not, please create a new drawing by pressing <Ctrl>+N or by clicking File -> New in the menus.

First of all the turntable is a very low cylinder with radius 274 mm and height 26 mm: The following code will create just that:

cylinder(h=26,r=274);

Press F6 to make OpenSCAD compile and render the drawing. Furthermore, I like to have the upper surface located at (0,0,0), so we will translate the cylinder along the z-axis by -26 mm because the cylinder-command draws the cylinder above z=0 by default. The code will look like this:

translate(v=[0,0,-26])
{
    cylinder(h=26,r=274);
}

To compile and render your drawing, press F6. Our drawing is just a cylinder at the moment with no space for the cards. We’ll change that by subtracting a set of boxes from our cylinder but first we will make a function (called a module in OpenSCAD) that can draw a box with a given set of dimensions. Our module called box looks like this:

module box(xdim, ydim, zdim)
{
    translate(v=[0,0,-zdim/2])
    {    
        cube([xdim, ydim, zdim], center = true);
    }
}

The built-in function cube draws the box given a vector of x-, y- and z-dimensions. The parameter center=true will make OpenSCAD draw our box centered around (0,0,0), so we translate the box along the z-axis by half the given height (the parameter zdim).

Our box (or actually holes for the cards) will have the dimensions 94x62x15 mm, so we need to draw the cylinder, draw the box and make OpenSCAD subtract the box from the cylinder to create the effect that we want. The keyword for subtracting one solid from another is difference so our code put together looks like this:

difference()
{
    translate(v=[0,0,-26])
    {
        cylinder(h=26,r=274);
    }
    box(94,62,15);
}

module box(xdim, ydim, zdim)
{
    translate(v=[0,0,-zdim/2])
    {    
        cube([xdim, ydim, zdim], center = true);
    }
}

After compiling and rendering the drawing looks like this:

Cylinder minus box

Cylinder minus box

We want 8 holes for the stacks of cards in the center: 5 holes 15 mm deep and 3 holes 5 mm deep. Furthermore, we want the walls between the holes to be 12 mm so we’ll translate them (94 + 12)/2 = 53 mm (and – 53 mm) along the x-axis and (62 + 12)/2 = 37 mm (or i*74 + 37 mm for some value i ) along the y-axis. Thus we add another module (called boxes) to draw the holes and to translate them to the right positions. It looks like this:

module boxes()
{
    for (i=[-2,1])
    {
        translate(v=[53, i*74 + 37, 0])
        {
            box(94,62,15);
        }
    }
    for (i=[-1,1])
    {
        translate(v=[53, i*37, 0])
        {
            box(94,62,5);
        }
    }
    for (i=[-1:1])
    {
        translate(v=[-53, i*74 + 37, 0])
        {
            box(94,62,15);
        }
    }
    for (i=[-2])
    {
        translate(v=[-53, i*74 + 37, 0])
        {
            box(94,62,5);
        }
    }
}

The construction for (i=[-2,1]) makes i take the values -2 and 1 during the two loops, while the construction for (i=[-1:1]) makes i take the values -1, 0 and 1 during the three loops. Thus the four loops will draw 8 boxes all together. We then change the first code to:

difference()
{
    translate(v=[0,0,-26])
    {
        cylinder(h=26,r=274);
    }
    boxes();
}

and press F6 to compile and render the drawing again. We now have:

Cylinder minus holes

Cylinder minus holes

Much better! But there is a problem: It’s almost impossible to get a card from the stack in the holes, so we’ll have to add some space for the players fingers in the walls between the holes. We’ll makes this space by subtracting boxes with dimensions 40x24x18 mm and translate them into their right positions in a new module named fingerholes.

module fingerholes()
{
    for (i=[-2:2])
    {
        translate(v=[53, i*74, 0])
        {
            box(40,24,18);
        }
        translate(v=[-53, i*74, 0])
        {
            box(40,24,18);
        }
    }
}

Again we’ll add a call to our new module in the code making the subtraction:

difference()
{
    translate(v=[0,0,-26])
    {
        cylinder(h=26,r=274);
    }
    boxes();
    fingerholes();
}

Press F6 to compile and render:

Cylinder minus boxes and finger holes

Cylinder minus boxes and finger holes

To finish the center of the turntable we’ll add four holes for coins and tokens. These holes will be the shape of a drop (sort of) and be created by subtracting a convex hull constructed over two spheres with radius 16 and 32 mm translated to the places outside the 8 holes already created. Thus we add a new module called holes:

module holes()
{
    hull()
    {
        translate(v=[138, -32, 20])
        {
            sphere(r=32, center=true);
        }
        translate(v=[127, -87, 4])
        {
            sphere(r=16, center=true);
        }
    }
    hull()
    {
        translate(v=[-138, -32, 20])
        {
            sphere(r=32, center=true);
        }
        translate(v=[-127, -87, 4])
        {
            sphere(r=16, center=true);
        }
    }
    hull()
    {
        translate(v=[138, 32, 20])
        {
            sphere(r=32, center=true);
        }
        translate(v=[127, 87, 4])
        {
            sphere(r=16, center=true);
        }
    }
    hull()
    {
        translate(v=[138, -32, 20])
        {
            sphere(r=32, center=true);
        }
        translate(v=[127, -87, 4])
        {
            sphere(r=16, center=true);
        }
    }
}

We’ll add a call to our newly created module to the code at the beginning of our file:

difference()
{
    translate(v=[0,0,-26])
    {
        cylinder(h=26,r=274);
    }
    boxes();
    fingerholes();
    holes();
}

After compile and render our drawing looks like this:

Cylinder minus boxes, finger holes and holes

Cylinder minus boxes, finger holes and holes

Now we’re almost done. All we need is to create a ring of 16 holes at the perimeter of our turntable but these holes will not be regular boxes: we want the holes to have a slope towards the center of the turntable by making them have a depth of 5 mm farthest away from the center and a depth of 8 mm closest to the center. In other words we’ll subtract a ring of wedges from our cylinder.

Furthermore, we would like to make a notch (in the shape of a quarter sphere) at the edge of the cylinder in each hole so the stack of cards can easily be removed all at once. The wedge and the corresponding sphere are created by the following module:

module wedge()
{
    translate(v=[0,-94,0])
    {
        polyhedron(points = [
            [-31,0,-5],
            [31,0,-5],
            [31,94,-8],
            [-31,94,-8],
            [-31,0,0],
            [31,0,0],
            [31,94,0],
            [-31,94,0]
            ],
            faces = [
            [0,1,2,3],
            [1,5,6,2],
            [0,4,5,1],
            [0,3,7,4],
            [2,6,7,3],
            [4,7,6,5]
            ]
        );
        translate(v=[0,0,-5])
        {
            sphere(r=10);
        }
    }
}

A wedge is drawn using the command polyhedron that takes a list of points and a list of faces. The wedge is constructed from 8 points and 6 faces, where each face is defined as a list of points listed clockwise seen from the outside of the wedge (take a look at the documentation: they explain it much better than I can). At the end we add a sphere with radius 10 mm.

The code above defines a wedge with 5 mm depth in one end and 8 mm depth in the opposite end. The deep end is located at (0,0,0). To make it a ring of 16 wedges we then create the following module that creates the wedges, translates them -180 mm along the y-axis and finally rotate them i*1/16 + 1/32 of a full circle, for i = 1, 2, … , 16:

module wedgering()
{
    for (i=[1:16])
    {
        rotate(i*360/16 + 360/32,[0,0,1])
        {
            translate(v=[0,-180,0])
            {
                vedge();
            }
        }
    }
}

Finally, we create the entire drawing as a module and replace the code in the start with a call to that module:

drawing();

module drawing()
{
    difference()
    {
        translate(v=[0,0,-26])
        {
            cylinder(h=26,r=274);
        }
        boxes();
        fingerholes();
        holes();
        wedgering();
    }
}

We then add the value 1 to an internal variableΒ $fa at the very top of the file. This value will cause OpenSCAD to make a smoother drawing:

$fa=1;

drawing();

After compile and rendering (which takes quite some time) we have the final drawing:

Dominion turntable drawing

Dominion turntable drawing

The final OpenSCAD-file can be downloadedΒ here as a zip-file.

To export the drawing as an STL-file (which we will need in the next step), select File -> Export -> Export as STL. This will give us a STL-file of the entire turntable but since the ShapeOko 2 has a work area of 300×300 mm we need to break it down into smaller pieces. We do this by adding a little more code to the OpenSCAD file:

intersection()
{
    rotate(0,[0,0,1])
    {
        translate(v=[0,0,-20])
        {
            cube([300,300,40]);
        }
    }
    drawing();
}

By using rotate(0,[0,0,1]), rotate(90,[0,0,1]), rotate(180,[0,0,1]) and rotate(270,[0,0,1]) we get the following four quarter circles:

1. quarter

1st quarter

2. quarter

2nd quarter

3. quarter

3rd quarter

4. quarter

4th quarter

We then export each of them as a STL-file so we can generate g-code for each quarter separately. My plan is to mill each quarter separately (or actually two together by moving the board between milling each quarter) but more on that later.

We now have the STL-files we need for the next step in the process.

See you next time. πŸ™‚

Part 3.

ShapeOko 2 tutorial – Dominion turntable

Introduction

This is the first part of my tutorial on using the ShapeOko 2 for building a Dominion turntable looking a little like this one.

First of all you’ll need a CNC machine. I got mine from Inventables and upgraded it with a Kress 800 FME spindle (the ShapeOko forum has some nice posts on the bigger Kress 1050 spindle). I posted some posts about building my ShapeOko 2 (here’s another one). I’m very pleased with the performance of my new spindle. The stock spindle (the Dremel clone) wasn’t strong enough for continuous work in my opinion.

Then there is software: there is a lot of free and open source software out there for the purpose of drawing, generate g-code and sending the g-code to the ShapeOko 2. I find the following combination of software useful:

OpenSCAD: An open source CAD program. It doesn’t have a lot of fancy drag and drop features but it is solid and gets the job done. There is a lot of documentation and tutorials on the homepage for the beginner so don’t be scared by the programmatic approach (which suits a mathematician and programmer like me very well πŸ™‚ ).

Inkscape: Another open source program for drawing SVG files which sometimes are handy when creating simple tasks for the ShapeOko 2. Again the homepage contains a lot of useful information for the beginner: tutorials, videos, blogs and a strong community.

MakerCAM: An on-line g-code generator. It’s simple to use and I use it for simple tasks. A good tutorial on how to use Makercam can be seen here and some more useful information can be found here.

FreeMILL: A free program from MecSoft (thank you for making this excellent program free πŸ™‚ ). If you get fascinated by making things on a CNC machine (like me) then you should consider some of their non-free products (no, I don’t get paid for writing this!).

Grbl Controller: A open source g-code sender for communicating with the CNC machine. There is also a tutorial on how to run Grbl Controller on a Raspberry Pi. A list of g-code senders can be seen here.

Last but not least: I needed a small utility for breaking down the g-code generated by FreeMILL so I made one (I will make it available for download later on). The thing is that FreeMILL generates g-code describing the surface of a solid (imported as STL) which often isn’t possible for the ShapeOko 2 to run directly because the cuts are simply too deep for the machine to handle in one run. Therefore, I created a small tool to break down the file from FreeMILL so it can be milled a few millimeters at a time. I’ll write more about it, when we reach that part. πŸ™‚

At the end of this tutorial we’ll have created something like this:

Dominion turntable

I’ll take you through the process step by step and tell you about my experiences with the ShapeOko 2 along the road (Murphy has been a very frequent but uninvited guest in my workshop since I got my ShapeOko 2!). πŸ™‚

Part 2.