Skip to content
davidson16807 edited this page Oct 16, 2014 · 26 revisions

##Stepper Motor Demo

In this tutorial, we'll model a NEMA 17 stepper motor. The Nema motor is a de facto standard for the reprap project and modeling it is a first step towards designing your own printer parts.

So let's start with the specs:

We need a box that's 42mm x 42mm in size.

box([42,42,42], anchor=[0,0,-1]);

Stack on top of that a clearance for gears that's 22mm in diameter and set it to whatever height sounds reasonable.

box(42)
align(top)
rod(d=22,h=10);

Now the screws. Screws are set 31mm apart, so position a rod at half this distance from the center along the x and y axes. We'll use translated to do it in all four corners of the motor.

box(42)
align(top)
{
	rod(d=22,h=10);
	
	translated(31*y, [-1,1]/2) 
	translated(31*x, [-1,1]/2) 
	rod(d=3,h=7);
}

##Screw Heads

We now have a pretty functional model for most practical purposes. Well, that was easy. Feels like this tutorial should have gone on longer. For the hell of it, let's put some heads on our screws.

box(42)
align(top)
{
	rod(d=22,h=10);
	
	translated(31*y, [-1,1]/2) 
	translated(31*x, [-1,1]/2) 
	rod(d=3,h=7)
	align(top)
	rod(d=6,h=2);
}

Add some screw slots, too. Here we need to perform a difference, but we can't just call difference because the screw slots are going to be the children of the screw heads. Instead, we'll assign the screw slots as negative space and use the construct module to take the difference between positive and negative spaces.

construct()
box(42)
align(top)
{
	rod(d=22,h=10);
	
	translated(31*y, [-1,1]/2) 
	translated(31*x, [-1,1]/2) 
	rod(d=3,h=7)
	align(top)
	rod(d=6,h=2)
	align(top)
	box([4,1,1], anchor=top, $show=$negative);
}

Let's make it a Philip's screw. We'll use rotated to take the slot above and apply it in two different directions.

construct()
box(42)
align(top)
{
	rod(d=22,h=10);
	
	translated(31*y, [-1,1]/2) 
	translated(31*x, [-1,1]/2) 
	rod(d=3,h=7)
	align(top)
	rod(d=6,h=2)
	align(top)
	rotated(90*z, [0,1])
	box([4,1,1], anchor=top, $show=$negative);
}

##Rotor

Still not enough detail? Let's flesh out the rotor. Shorten the cylinder we modeled for the gear clearance and add a 5mm rotor shaft.

construct()
box(42)
align(top)
{
	rod(d=22,h=1)
	align(top)
	rod(d=5, h=10);
	
	translated(31*y, [-1,1]/2) 
	translated(31*x, [-1,1]/2) 
	rod(d=3,h=7)
	align(top)
	rod(d=6,h=2)
	align(top)
	rotated(90*z, [0,1])
	box([4,1,1], anchor=top, $show=$negative);
}

Stick a gear on top.

construct()
box(42)
align(top)
{
	rod(d=22,h=1)
	align(top)
	rod(d=5, h=10)
	align(top)
	rod(d=15, h=8);
	
	translated(31*y, [-1,1]/2) 
	translated(31*x, [-1,1]/2) 
	rod(d=3,h=7)
	align(top)
	rod(d=6,h=2)
	align(top)
	rotated(90*z, [0,1])
	box([4,1,1], anchor=top, $show=$negative);
}
Clone this wiki locally