-->
I am in the process of building my own incarnation of the Number Two autonomous mini sumo robot. For me as a professional technical software engineer with a background in electronics, the mechanical parts are the hardest. Especially the part in which the pencils will hinge. I do not have the tool to create it from a massive piece of aluminium or the like. To get my head around this part and make it visible for myself and others, I decided to make a 3D drawing first. While searching for a 3D drawing tool, I came across OpenSCAD. It is advertised as 'The Programmers Solid 3D CAD Modeller'.
|
OpenSCAD |
The tool is ideal for me as a software developer. For me it is far more easy to type something like 'cube([98, 15, 14])' to create a cube of 98 by 15 by 14 mm, than dragging things around on the screen and trying the get the size correct. The left part of the screen is for editing the text and on the right you can see the resulting image.
|
First try |
The code to create the image above:
module PencilHinge()
{
hole_width = 8.1;
hole_count = 8;
total_width = 98;
projection_count = 9;
projection_width = (total_width-(hole_count*hole_width)) / projection_count;
difference()
{
union()
{
cube([98, 15, 14], center = true);
}
union()
{
for ( i = [0:7] )
{
translate(v=[i *(hole_width+projection_width)-(total_width/2)+hole_width,0,4])
{
cube([8.1, 16, 16], center = true);
}
}
translate(v=[0, 0, 1])
{
rotate(a = [0, 90, 0])
{
cylinder(h = 100, r=1, center = true);
}
}
}
}
}
PencilHinge();
After playing one hour with it I came up with the design above. When you look at the full size image you can see that the holes are not round, but consist of just seven flat surfaces.
|
Second iteration |
A second night working on it I found out that you can set the number of surfaces used to make the cylinder holes: I had to add $fn=36 to the creating of the cylinder. Where 36 is the number of surfaces: cylinder(h = 100, r=2, center = true, $fn=36); I added eight holes in the bottom plate to be able to mount it to the robot frame. The holes for the nuts were, easy now that I now how to set the number of surfaces of the cylinder. I just needed six surfaces for that.
The code for the image above:
module PencilHinge()
{
round_r = 3;
pad = 0.1;
mounting_hole_radius = 1.5;
mounting_nut_r = 6.3 / 2;
mounting_nut_h = 2.5;
mounting_nut_facets = 6;
hole_count = 8;
projection_count = hole_count + 1;
hole_width = 8.1;
box_l = 98;
box_w =15;
box_h = 14;
projection_width = (box_l-(hole_count*hole_width)) / projection_count;
difference()
{
union()
{
cube([box_l, box_w, box_h], center = true);
}
union()
{
for (i = [0:7])
{
translate(v=[i *(hole_width+projection_width)-(box_l/2)+hole_width,0,4])
{
cube([hole_width, box_w+pad, box_h], center = true);
cylinder(h = box_l, r=mounting_hole_radius, center = true, $fn=36);
cylinder(h = (mounting_nut_h*2)+box_h, r=mounting_nut_r, center = true, $fn=mounting_nut_facets);
}
}
translate(v=[0, 0, 3])
{
rotate(a = [0, 90, 0])
{
cylinder(h = box_l+pad, r=1, center = true, $fn=36);
}
}
}
}
}
PencilHinge();
|
Final design |
It took a third night to come to the final design shown in the image above, with nice rounded corners. I used the cube fillet module for that. I only had the replace cube([box_l, box_w, box_h], center = true); by cube_fillet([box_l, box_w, box_h], vertical=[0,0,0,0], top=[round_r,0,round_r,0], center=true); Note that the cube filet code to get the rounded corners is bigger in size than the pencil hinge code.