Introduction: Make Your Own Miniature Electric Hub Motor

About: lol robots

In-wheel electric drive motors represent an effective method of providing propulsion to vehicles which otherwise were not designed to have driven wheels.

That is, they're great for EV hacking and conversion. They're compact and modular, require no support of rotating axles from the parent vehicle, and can be designed around the vehicle to be propelled. Pure DC electric hub motors, in fact, were used in some of the first electric (and hybrid electric) cars.

They are also not as complex and mystical as one might think. The advent of my project RazEr, a stock Razor scooter with a custom built electric conversion, has raised many questions from amateur EV builder looking to construct their own brushless hub motors. Until now, I have not had a single collective resource to point anyone towards, nor have I been confident enough to understand what I actually built to write about it for other hackers.

Hence, I will attempt to show that a brushless DC permanent magnet hub motor is actually relatively easy to design and build for the hobbyist, resource access considerations aside. I will first exposit some of the details of brushless DC motor theory as applied to hub motors. I will provide some thoughts and pointers about the mechanical construction of the motor itself and how to source major components. Finally, I will briefly glean over ways to control your newfound source of motion. The arrangement of this Instructable is designed for a readthrough first - because it relays theory and advice more than specific instructions on how to create one particular motor.

This is intended as a basic primer on DC brushless hub motors. Many assumptions, shortcuts, and "R/C Hobby Industry Rules of Thumb and Hand Waves" will be used. The information is purposefully not academic in nature unless there is no way to avoid it. The intention is not to design a motor that maintains above 95% efficiency across a thousand-RPM powerband, nor win the next electric flight competition, nor design a prime mover that will run at constant power for the next 10 years in an industrial process. Motor theoreticians avert thine eyes.

I will assume some familiarity with basic electromagnetics concepts in order to explain the motor physics.

Below is an exploded parts diagram of a prototype motor that I am in the process of designing and building. Let's clear up some of the vocabulary and nomenclature immediately. The can (or casing) hold a circular arrangement of magnets (electrically called poles) and is supported on one or both ends by endcaps. This whole rotating assembly is the rotor. Internally, the stator is a specially shaped piece of laminated iron pieces (the stack) which holds windings (or coils) made of turns of magnet wire on its projections (teeth). It is stiffly mounted to the shaft (a nonrotating axle) which also seats the bearings for the rotor assembly.




Step 1: Hub Motor Design Considerations

Is a hub motor the right choice for your electric vehicle? Answer these few simple ques...

I mean, read these few pointers which highlights some design tradeoffs and considerations involved in the use of hub motors! They are not perfect solutions to every drive problem, and some of the shortcomings are dictated by the laws of physics.

Hub motors are inherently heavier and bulkier than driven wheels.

Until we make magic carbon nanotube superconductors en masse, motors are essentially chunks of steel and copper, both very heavy elements. What happens when you increase the weight of a wheel two- or -threefold is a drastic increase in theunsprung weight of a vehicle, or weight that is not held up by a suspension. For those of you in the know about vehicle suspension engineering, unsprung weight negatively affects the ride and comfort of a vehicle. If you just drop hub motors into a vehicle previously endowed with indirectly driven wheels, expect a change in ride performance.

This is more of a concern for passenger cars and sport vehicles than anything else, as most small EVs such as bikes and scooter won't have suspensions at all. However, the keyword here is small. You might have gathered from my other instructable that some times it's all but impossible to simply fit a larger motor in an enclosed space. A hub motor will inevitably take up more space in the vehicle wheel. This matters less for larger wheels and vehicles. The MINI QED and Mitsubishi MIEV are example of car-sized hub motors that have been well-integrated into the vehicle design through some pretty serious re-engineering of how the wheels attach to the car frame. You might have to do the same for your scooter, bike, or couch.

A hub motor powertrain will generally produce less torque than an indirect-drive system

Don't expect any tire smoke from your hub motors. An indirect drive motor, such as one geared to the wheels through a transmission, has the advantage of torque multiplication. This is how a 400 horsepower diesel engine in a semi truck can haul itself and 80,000 more pounds up a mountain road, but a 400hp Corvette could not do the same - the semi engine goes through a painstakingly complex arrangement of gears to transmit many thousands of foot-pounds of torque at the drive wheels. A Corvette is light and fast, and hence the 400 horsepower in its engine is mostly speed.

From physical mechanics, power output is a product of both torque and speed.  Due to curiosities in the laws of nature, it is much easier to make a fast but low torque motor than a slow and high-torque one, power output levels being equal.

As it relates to motors, this is why your typical drill motor spins at upwards of 30,000 RPM, but you only get a few hundred RPM out at the screwdriver bit. The drill motor has been engineered to produce maximum power at very high rotational speeds, which is sent through a gear reduction to crank your drill bits hard enough to do this.

But your hub motor is direct drive. There's no bundle of pointy steel things to convert its rotational velocity into torque. A hub motor can only lose mechanical advantage because the wheel essentially must be larger in diameter than the motor. Comparatively few in-wheel motors have internal gearing - these are most often found on bicycles, since they have a large diameter, and hence loads of space, to work with. It is not that much more difficult to incorporate a gearset into your hub motor, but it is beyond the scope of this Instructable.

The bottom line is, while a 750 watt DC motor on your Go-Ped might let you perform a wheel-spinning launch, a 750 watt hub motor will probably not.

Hub motor drivetrains will generally be less electrically efficient than an indirect drive system

It is certainly true that hub motors bypass practically all the mechanical losses associated with a clutch, transmission, axles, and gears that you typically find in a vehicle powertrain. In fact, drive components alone can eat up 15 to 20% of the power produced by the engine. Imagine if that were gone - what could you do with 15 to 20% more power?

A hub motor will typically have a torque-produced to force-on-the-ground transmission of almost 1. The torque of the motor only has to go through the tire, with its rolling friction and deformation forces. But what hurts the hub motor is electrical efficiency.

A motor is a transducer. Input electrical power and out comes mechanical power - usually. Electrical power is defined as 

Pe = V * I

where V is the voltage across the motor and I is the current flowing into the motor. V has unit volts and I has unit Amperes. Mechanical power is

Pm= T * ω

where T is the torque output in Newton-Meters and ω is rotational velocity in radians per second (units 1 / time, because radians are unitless!)

It is perfectly within reason to be inputting electrical power to the motor but get no rotation out. This is called stall or locked rotor condition, and it kills motors. This occurs when T is not enough to overcome the forces pushing back against a motor - think of driving up a really steep hill.

In this case, your efficiency is precisely zero. Zilch, nada, nihil, nothing. Mechanical power out is zero, but electrical power in is nonzero.

While it is true that both motors must start the vehicle from standstill, and thus have zero efficiency for a split second, the fact that hub motors must operate continuously at high T and low ω is the distinguishing factor. Other laws of physics dictate limits of torque output, which I will get to shortly. A\ hub motor has to draw a higher current for the same torque output, and current is what causes heating in wires (not voltage). The more current there is, the more heat is generated.

This is called Joule heating and is governed by the power law Pj = I² * R. It is a square law: double the current, quadruplethe heat. 

Now you see why hub motors are less efficient electrically than indirect drive motors. Hub motors are low speed creatures, and will inevitably spend much of their lives at or near stall condition. This occurs whenever the vehicle is moving at low speed or accelerating. A hub motor will see more moments of low or zero efficiency than an indirectly driven, geared motor.

The bottom line is, prepared to see a decrement in battery life if you swap your existing drive system with a hub motor.

Now that I have told you the reasons to not build and use hub motors, let's get on to how you can build and use hub motors.

Step 2: The Brushless DC Motor

At the heart of most hub motors is a brushless DC motor. To build a hub motor right, you need to understand some basics of brushless DC motors. To understand brushless DC motors, you should understand brushed DC motors. If you've taken a controls class, chances are that you've used brushed DC motors as a "plant" to test your controls on.

I've highlighted and bolded the juicy stuff that you'll need, but for the sake of continuity it's probably good to grunge through all of it anyway.

Brushed DC Motor Physics

Perhaps the best DC motor primer I have seen (I'm not biased at all, I promise guys! Pinky promise! ) is the MIT OpenCourseware notes for 2.004: Dynamics and Control II. Take a read through it at your own leisure, but the basic rundown is that a brushed DC motor is a bidirectional transducer between electrical power and mechanical power that is characterized by a motor constantKm , and an internal resistanceRm. For simplicity, motor inductance L will not be considered. Essentially if you know Km and Rm, and a few details about your power source, you can more or less characterize your entire motor.\

Update10/06/2010: The original 2.004 document link is dead, but here's one that's roughly the same content-wise. Also from MIT OCW.

The motor constant Km contains information about how much torque your motor will produce per ampere of current draw (Nm / A) as well as how many volts your motor will generate across its terminals per unit speed that you spin it at (V / rad / s, or Vs / rad, or simply V*s). This "back-EMF constant" is numerically equal to Km, but some times called Kv.

In a DC motor, Km is given by the expression

Km = 2 * N * B * L * R

where N is the number of complete loops of wire interacting with your permanent magnetic field of strength B (measured in Tesla). This interaction occurs across a certain length L which is generally the length of your magnets, and a radius R which is the radius of your motor armature. The 2 comes from the fact that your loop of wire must go across then back across the area of magnetic influence in order to close on itself. This R has nothing to do with Rm, by the way.

As an aside, I will be using only SI (metric!!!!!) units here because they are just so much easier to work with for physics.

Let's look at the expression for Km again. We know from the last page that

Pe = V * I and Pm = T * ω

In the ideal motor of 100% efficiency (the perfect transducer), Pe = Pm, because power in equals power out.  So

V * I = T * ω

Where have we seen this before? Swap some values:

V / ω = T / I

Kv = Km

Oh snap.

The takeaway fact of this is that knowing a few key dimensions of your motor: The magnetic field strength, the length of the magnetic interaction, the number of turns, and the radius of the armature, you can actually ballpark your motor performance figures usually to within a factor of 2.

Now it's time for...

The Brushless DC Motor

BLDC motors lie in the Awkward Gray Zone between DC motor and AC motors. There is substantial disagreement in the EE and motor engineering community about how a machine which relies on three phase alternating current can be called a DC motor. The differentiating factor for me personally is:

In a brushless DC motor, electronic switches replace the mechanical brush-and-copper switch that route current to the correct windings at the correct time to generate a rotating magnetic field. The only duty of the electronics is to emulate the commutator as if the machine were a DC motor. No attempt is made to use AC motor control methods to compensate for the AC characteristics of the machine.

This gives me an excuse to use DC motor analysis methods to rudimentarily design BLDC motors.

I will admit that I do not have in depth knowledge of BLDC or AC machines. In another daring act of outsourcing, I will encourage you to peruse James Mevey's Incredible 350-something-page Thesis about Anything and Everything you Ever Wanted to Know about Brushless Motors Ever. Like, Seriously Ever

There's alot of things you don't need to know in that, though, such as how field-oriented control works. What is extremely helpful in understand BLDC motors is the derivation of their torque characteristics from pages 37 to 46. The short rundown of how things work in a BLDC motor is that an electronic controller sends current through two out of three phases of the motor in an order that generates a rotating magnetic field, a really trippy-ass thing that looks like this.

The reason that we consider two out of three phases is because a 3 phase motor has, fundemantally, 3 connections, two of which are used at any one time. Here's a good illustration of the possible configurations of 3 phase wiring. Current must come in one connection, and out the other.

In Mevey 38, equation 2.30, the torque of one BLDC motor phase is given by

T = 2 * N * B * Y * i * D/2

where Y has replaced L in my previous DC motor equation and D/2 (half the rotor diameter) replaces R.

If you do it my way, it becomes

T = 2 * N * B * L * R * i , replacing D/2 with R.

Remember now that two phases of the motor has current i flowing in it. Hence,

T = 4 * N * B * L * R * i

This is the Equations to Know for simple estimation of BLDC torque. Peak torque production is (modestly) equal to 4 times the:

� number of turns per phase
� strength of the permanent magnetic field
� length of the stator / core (or the magnet too, if they are equal)
� radius of the stator
� current in the motor windings

As expected, this scales linearly with current. In real life, this will probably get you within a factor of two. That is, your actual torque production might be between this theoretical T and T/2

Wait, 4? Does that mean if I turn my brushed DC motor into a brushless motor, it will suddenly have twice the torque? Not necessarily. This is a mathematical construct - a DC motor's windings are considered in a different fashion which causes the definition of N and L to change.

Next, we will see how to use this equation to size your motor.

28  July 2010 Updateto the definition of T

In the equation T = 4* N * L * B * R i, the constant 4 comes from the derivation of a motor with only one tooth per phase, assuming N is the number of turns of wire per tooth on the stator.

The full derivation of this constant involves each loop of wire actually being two sections of wire, each of length L. This is due the fact that a loop involves going across the stator, then back again. Next, in a BLDC motor, two phases are always powered, therefore contributing torque.

We can observe that in a motor with only 1 tooth per phase (a 3-toothed stator), there are no more multiplicative factors. However, for each tooth you add per phase (2 teeth per phase in a 6-tooth stator, 3 teeth per phase in a 9-tooth stator, etc.) the above constant must be multiplied accordingly. The constant in front of the equation essentially accounts for the number of active passes of wire, which is 2 passes per loop times 2 phases active times number of teeth per phase.

So, what I actually mean is that T = 4 * m * N * B * L * R * i where

m = the newly defined teeth per phase count.

As the windings themselves have yet to be introduced, keep in mind the number of teeth per phasein the dLRK winding is 4.

Step 3: The Brushless DC Motor and You

So how does

T = 4 * m * N * B * L * R * i , otherwise known as T = Km * i

affect your motor design, and why am I viciously pounding on torque so much? Because torque is ultimately what hauls you around, and is one of the components of mechanical power Pm. Once you determine roughly how much mechanical power you will need, you can size wires and components appropriately.

Notice some key characteristics of the equation and how they affect motor performance:

� Torque increases with number of turns N
� ...and radius of the stator R
� ...and strength of the magnetic field B
� ...
and length of the stator L
� ...and winding current i.

What we observe here is that to a degree, you can linear scale motor characteristics to estimate the performance of another motor.

This is "R/C Hobby Industry Hand Wave" number one. The concept of turns and motor sizes.

A 100mm diameter motor will, all else being equal, produce twice as much torque as a 50mm diameter motor.

A motor with 1.2T permanent magnetic field will likely be 20% more torquey than a 1T motor. And so on.

This has its limits - you cannot reasonably assume that you can quintuple your windings and get 5 times the torque - other magnetic characteristics of motors, such as saturation come into play. But, as will be shown, it is not unreasonable to extrapolate the performance of a 25 turn-per-stator-tooth motor from a 20 turn one, and such.

The LRK Winding

At the bottom of it all, what I am designing and making is a fractional-slot permanent magnet three phase motor. What the frunk does that mean? The fractional slot just means that (magnet pole pairs * phases) / (number of teeth on the stator) is not an integer. If you understood that, you know it more than I do.

A brief explanation is that the ratio of "number of stator teeth" to "number of magnet pairs" strongly affects the physical characteristics of the motor. A "magnet pole pair" is defined as two magnets, one with the North pole facing radially inwards, the other with the N pole facing outwards.

This ratio, commonly called T : 2P (for teeth to 2 * total poles), affects the cogging of the motor, i.e. its smoothness.

Get a DC brush motor and twirl the shaft - there is a minimum amount of torque required to 'click' it over to the next stable position. This is cogging. It causes undesirable vibrations and high-order electrical system effects, and we don't like it.

A type of motor winding with T : 2P close to 1 (but not 1 exactly - that results in a motor which doesn't want to move) substantially reduces cogging (to near zero) and is the most popular "small BLDC motor" winding around. It is called the LRK winding, after Messrs. Lucas, Retzbach, and Kuhlfuss, who documented the use of this winding for model airplane builders in 2001. Not only does it offer low cogging, but also ease of winding and scalability.

Here are figures of the basic LRK winding and a variant called the DLRK (Distributed LRK).

The takeaway here is that using a stator with 12 teeth (or slots, the area between the teeth) and 14 magnets (that is, 7 pole pairs) will give you a pretty decent motor to start with and use in your fledgling motor engineering career.

The difference between the two winding styles is subtle. The distributed LRK winding has a smaller end-turn effect. An end turn is the wire that has to wrap around outside of the magnetic field in order to close the loop. It contributes no torque, but does have a resistance (all wires have nonzero resistance - we're not talking superconductors here). The dLRK avoids bunching the end turns up excessively, which results in a slightly more efficient motor. Slightly as in one or two percentage points - nothing to win a Nobel Prize over.

Below is a picture of Razer's motor core with a full dLRK winding.

Step 4: The Stator: Obtaining, Care, and Feeding

For the past 4 pages I've said "stator stator stator stator". What IS the stator, and where do you get one? The stator is the number one most painful specialized industrial component to acquire for a motor build, generally speaking, and is usually what you end up designing your power system around just because you have one and by Robot Jesus you are GOING to use it.

The stator is difficult to just "make" because it requires the stacking and fitting of many layers of very thin, electrically insulated steel sheets. Not just any "steel sheet" either - no Home Depot galvanized roof patches here. Motor steel is called "electrical steel" or "transformer steel" and are special alloys that contain high silicon. This enhances the magnetic characteristics of the steel and reduces its conductivity.

So why does it have to be laminated - and especially insulated ones? This is due to the phenomenon of eddy currents. The short story is that moving magnets over conductive materials cause the material to dampen the magnet's motion. In a motor, that means your motor is trying to brake as hard as it's trying to go. Those eddy currents get turned right into heat. If you take the method that most new motor builders go:

"Well, I'll just cut it out of some thick steel plate or a block or something - I have a milling machine, it'll work, right?"

It will, but you'll make a heater that occasionally twitches, rather than a motor which heats up as it runs.

Having laminated, low conductivity sheets of material means that the eddy currents are neutralized to a large degree. For low speed motors, this "eddy current loss" or "core loss" can be negligible. For high speed motors, it can eat up as much as 15 to 20% of the power.

So where do I get a stator?

This will be the only "how to get" section that's not in the Resources page, because you generally don't just go and get one.

Because they require the punching, stacking, and otherwise processing of hundreds of little steel sheets, stators tend to be designed once and then mass produced by the thousands. This mass production is why they are hard to get new if you are a hobbyist or motor hacker. 

Fortunately, the appliances and implements that these thousands of mass produced stators end up in are commonly available secondhand, for free, or as scrap.

Laser copiers and printers

My #1 favorite source for stators, as they tend to get junked by the dozen as departments and institutions get new equipment. Canon, HP, Xerox, and Ricoh tabletop copiers tend to be rich in 12 tooth stators in the 50 to 55mm range. In this case, older and bigger is always better. Project RazEr's motor came from a gigantic (floorstanding, needs-its-own-room-in-the-office style) laser copier, which not only yielded the one large motor, but several smaller AC motors and a bucket of gears, shafts, and pulleys. Printing equipment is always a good bet for electromechanical components, though new units tend to use stepper motors, which are not suitable for conversion.

The largest copier motors I have seen (before they enter the realm of AC induction) have 70mm stators.

These things show up for free all the time on Craigslist, or free stuff drives at institutions. Electronic recycling stations are also worth a call.

Junky old DC and AC motors

Old motors with burned windings or worn out bearings get thrown out all the time. DC motors are hit-or-miss. DC motor armatures tend to get designed with odd numbers of teeth because the lack of symmetry contributes to smoothness. While stators with tooth numbers that are an odd multiple of 3 can be turned into motors, they cannot use the LRK winding.

Because DC motor armatures spin internally, they have teeth that project outwards, which makes them ideal for BLDC conversion if the tooth count is correct.

AC induction motors and especially AC three phase motors are usually good bets for useful iron, except they tend to be conventionally shaped - that is, rotor on the inside, stator on the outside. We want the opposite, but if you just want a motor, this is a good place to start.

"Junky old motor" includes "junky old kitchen appliances", which often use a variant of the brushed DC motor called a universal motor. These tend to have 12, 18, or 24 tooth armatures, especially large multispeed blenders, usually under 50mm diameter.

Buy one

You know how I said you can't buy them? I lied. Hobbyists have recently become such a large market that a few companies actually make stock stators that are empty of windings and already surface coated to accept your own.

For the widest selection, see GoBrushless' motor stators. Check out the 65mm, 18 slot one!

For the monetarily endowed, many shops specialize in short-run and prototype lamination cores, including the aptly-named ProtoLam. Be ware - just one stator made to your design can cost several hundred dollars, but if you're just totally obsessed with rolling your own, the resource is available.

How large of a stator do I need?

The killer question.

Remember the torque equation

T = 4 * m * N * B * L * R * i

For most reasonable operating conditions, you can consider:

T to be a design goal. A goal for acceleration or hill climbing both require minimum force-at-ground figures, which translates to a torque at the motor.

N to be the primary variable you can control. This is mildly coupled to i, which is dependent on your battery voltage.

R and L are the parameters set by your stator. In a way, m is also determined by your stator - after all, it has a fixed number of teeth that have to be divisible by 3 for this type of motor.

B is is the strength of the permanent magnetic field that the stator acts upon, set by your magnet strength (and a mechanical factor to be discussed)

Clearly this is a multivariate optimization problem. If you have a choice of how large your stator can be, the answer is the largest. The more L and R you can pack into the expression, the less N and i you need. Remember that motor current i is the biggest contributor to heating and efficiency loss.

If your L and R are already set because you have a pulled stator and want to use it, then the only realistic variables you can fiddle are and B.

Step 5: Magnets and Magnet Wire

Until now, I've just been hand-waving the existence of "MAGNETS". End of story. There exist permanent magnets.

...Yes, there definitely are, and you can actually spec and buy them according to your needs. The type of permanent magnet used in most small BLDC motors today are Neodymium Iron Boron chemistry magnets. They lie within a group of magnetic materials called rare earth magnets, because Nd is a "rare earth metal". These are not actually all that rare, which helps explain why NIB magnets don't cost you an arm and a leg.

Actually, back up. They can. NIB magnets can be so powerful that they leap across a foot or more or open air and slam together - if you are trapped in between, you could be in for a world of hurt. Everybody by now has seen the aftermath of someone's hand being caught between two colliding 4 inch square NIB magnet blocks - I'm not linking that. As a tip for the future: Take extreme caution around magnets!

A typical NIB magnet is rated as Nxx, where xx is a number between 28 and 52 (as of this writing). The number is that magnet's magnetic energy product. Without diving into E&M physics, higher is better.

At a cost, of course. NIB magnets are notorious for being high temperature sensitive. The Curie Point of a permanent magnet is the point at which stops being a permanent magnet. No, they don't regain their magnetism after they cool down. For ultra high strength NIB magnets, this could be as low as 80 degrees Centigrade (or about 150F) .

That's not very high at all - you can easily trash a motor by running it too hot.

Here's a link that explains magnet ratings pretty clearly. The same person is also a reputable dealer of all sorts of magnetic mayhem.

A typical NIB magnet as used in a motor will have a remnant surface flux of 1 Tesla. If you get the Good Magnets, it is safe to assume that Bin the torque expression T = 4 * m *N * B * L * R * i is equal to 1.

Hence, the equation reduces to T = 4 * m * N * L * R * i.

The takeaway fact for magnets is that stronger is better until your motor gets too hot. It doesn't hurt to have a stronger B-field. Getting the latest and greatest in N52 magnets can boost you B to 1.1 or 1.2.

I will address how to spec our your magnets shortly, but meanwhile...

Magnet Wire

A permanent magnet sitting there doesn't do anything. It's not very interesting to watch. What makes the motor work is switching electromagnets. If you've been through a physics class with any gusto, you've made an electromagnet out of wire and a nail.

Do not plug this into the wall like yours truly.

Each of the 12 teeth on the stator function as an electromagnet. From the same physics class, recall that for every turn of wire you wrapped around the nail, the electromagnet got stronger. Same deal with the stator teeth - this is why N is a factor in the equation.

So you can just make a 20,000 turn motor and be done with it, right? Sure, if you want to run 10,000 volts to actually push enough current through your windings to mean something.

There are a few constraints to consider when designing your windings. Magnet wire takes up physical space - essentially, given a set of space constraints, the more turns you want to wind, the smaller the wire has to be. This makes sense from a physical perspective. Eventually, when you use nanowires, you can have a 10 billion turn motor that packs all the slots to near 100% fill for maximum magnetic mayhem.

Except your motor resistance Rm would be astronomical. This is another constraint. Choosing the number of turns is a careful balance between getting the Km that you want but minimizing Rm. The motor resistance can only contribute to loss. It can only hurt you. Therefore, the goal of almost all hobby motor winders is to minimize the resistance.

This means using as few turns of the biggest gauge wire you can to get the Km that satisfies you. The One Wiki has a great table of AWG copper wire resistances.

Magnet wire comes in many flavors - they are all, at the end, conformally coated solid copper wire. This coating can be enamel, polyurethane, epoxy, or in exotic / high temperature motors, fluoropolymers and wound fiberglass sheaths. The cheapest grades are generally enamel insulated and will work up to about 150 degrees Centigrade.

By this point, your expensive N52 magnets would have vaporized already - unless you are dead set on taking your motor to the limits (which means this tutorial won't help at all), don't splurge on expensive HT wire.

Can you physically handle it?

Don't underestimate the strength of a strand of copper. You might be used to 28, 24, or 20 gauge magnet wire, which is small enough to be negligibly soft. Maybe annoyingly soft. Now try bending a 16 or 14 AWG solid wire, which is pretty close to the thickness of a piano's bass strings. Now imagine you have to bend this around a corner only millimeters in radius, possibly 100 times or more.

If you are having a hard time with one stand of monster wire, you can consider splitting it into equivalent parallel strands of smaller wire. RazEr's motor was wound with double 22 gauge after I had difficulty wrestling 18 gauge around for 25 turns. Use the wire gauge table to compare diameters!

Step 6: Actually Winding the Motor

If you've never wound a motor before, the diagrams of LRK windings are probably pretty meaningless. This is a time when you need to learn the nomenclature of motor hobbyists.

An example would be the dLRK winding:

AabBCcaABbcC

or the classic LRK winding,

A-b-C-a-B-c

What? Did you just sing the alphabet song or something? Kind of. The three phases of the motor are referred to in this case as A, B, and C.

A capital letter indicates one winding chirality, a lower case means the other. For instance, if A is designated "make a loop of wire in the clockwise direction", then a means "wind the loop of wire in the counterclockwise direction". And a dash or space means an unwound tooth.

The general convention is capital letter equals clockwise loop, lower case equals counterclockwise loop. But, what is more important is consistency. If you do it one way, stick with it. 

So what does the above string of gibberish mean? Starting at any tooth (mark this as your index!), begin making loops of wire around it according to the designation. To wind two teeth Aa style, wind one of them clockwise, and the other counterclockwise (or vice versa - keep track of this.)

There is no "right method" to obtain clean windings, but the last thing you want to do is just bundle wires around the tooth with reckless abandon. For large motors, use latex gloves to ease hand abrasion and a wooden dowel to wrap wire around for extra leverage.

Unfortunately, I don't currently have any pictures of video of me winding a motor. This might change in the near future to save a thousand words of explanation.

Perhaps one of the most valuable resources available is the Combination Table. Input your number of stator teeth ("nuten") and your number of magnets ("pole") and it will automatically generate the correct winding pattern! The above table was generated by one of the Crazy German R/C Airplane Dudes, who seem to be the source of all technological advancement in the model motor scene.

Single Layered, Multi Layered

You may find that you can't get the N number you want by only winding one layer of wires on the stator. Simple solution: Keep winding and make a second layer.

Two to three layer windings are generally the limit of heating & cooling unevenness for small motors, and the Rm gets ridiculous as well. As more layers are added, the end turn effect will become more and more of a factor.

If you find yourself having to wind many layers, perhaps switching down a size of wire will alleviate that.

How many turns (N) do I need? 

The other killer question of small motor design. Given other motor parameters, you can backsolve easily for the minimum N needed to achieve a certain design goal, usually torque. Accounting for losses and assumptions, N should be above this number by a comfortable margin explained shortly.

Example(Updated 3/28/2012 to correct the math which has been wrong for over 2 years! I keep meaning to fix it, then never getting around to it. Ultimately, enough of you called me out on it, so congrats. Here's the fixed math using also the new torque constant factor m).

Let's say that I want to design a motor inside a 12cm (0.12m) wheel that will let me climb a 10% grade (or about 5.5 degrees inclination) at velocity v = 5 m/s (about 11mph), and I weigh m = 65kg. The force of gravity F pulling me back down the hill is

F = m * g * sin 5.5° = 61N, or thereabouts. I

I want to climb the hill at 5 m/s. Mechanical power is torque * rotational speed, but it is also linear force * linear velocity.

Thus Pm = 61 * 5 = 305 W

Seems reasonable, right? Assume the motor is a perfect transducer (it's definitely not). The electrical power required is also 305 watts.

Assume my battery is 28 volts, so i = 305 W / 28 V = 10.9A

To exert a linear force of 61N at a radius of 0.06m (wheel radius), the torque T is 3.66Nm.

Two variables, T and i, have now been established. The motor is a 12-tooth, 3 phase motor, so m is 4 (there are four teeth per phase). You can now reduce the equation to

T / (4 * m * i) =  N * L * R* B

R is ultimately limited by the size of my magnet rotor and inner diameter of my tire - a topic which is forthcoming. Let's say that my wheel choice has forced a  maximum stator diameter of 70mm, and the motor can't be more than 30mm wide to fit in my vehicle. 

B is my magnetic field strength. Let's assume it is 1 Tesla for now - we will see soon that this is not a bad guess if your motor magnets are reasonably thick.

T / (4 * m * i * L * R) = N

Let's see what this comes out to.

3.66 / (4 * 4 * 10.9  * 0.03 * 0.035) = 19.98 = N

This value is a reasonable first approximation for the number of turns per tooth you need.  Since hundredths-precision turn fractions aren't possible, take the closest integer: 20.

Fiddle Factors and Hand Waves

Every nonideality and inefficiency in the world will work to make your motor faster (read: less torquey) than what the number of turns alone would indicate. Therefore, it is good sense to consider this as the absolute minimum number of turns per tooth. The torque constant value derived from using NIBLR is generally 20 to 33% too high for average fractional-slot, permanent-magnet motors like the type we are considering.

Remember also that motors are not perfect transducers. The average efficiency of a decent BLDC motor is somewhere around 90%. So, if I want to perform this hillclimb at maximum efficiency, that's much different than attempting it at maximum power output. The efficiency of a motor at maximum power output is always less than 50%. This is something to be well aware of - if you are using this 'target output force' method to design your turn count, then you should take the speed to be somewhere close to your anticipated cruising speed. This makes sure that, if anything, you overdesign the motor for torque as nonidealities only take it away from you.

The above motor example is the motor for Project RazEr. In actuality, RazEr's motor has 25 turns per tooth - overspecified by roughly 25%.

To wrap up, R and L are mechanical constraints dictated by your vehicle's mechanical parts while m, B, N, and i are electromagnetic constraints dictated by your choice of magnets, wire, and coil layout.

Step 7: Magnet Layout and 2D Design

What were we talking about? Oh, yeah, hub motors. With a preliminary electrical specification for your motor, you can now proceed onto the early stages of mechanical work.

By now, you should have stator dimensions available to you. The goal of magnet rotor layout is to size 14 magnet poles to fit around the stator until you have enough information to spec out or purchase magnets.

The process is constrained bidirectionally. The minimum diameter of your circle of magnets clearly has to be larger than the stator. However, you may find yourself additionally constrained if you have already picked a wheel. Then, the maximum inner diameter you can use on your wheel & tire becomes the other mechanical constraint: your magnet circle's outer diameter plus a certain can thickness is limited by the wheel.

Using online tools

It used to be that you had to whip out a calculator and a pencil and hash out some serious trigonometry to lay out the magnets, or use a 2D computer aided design program... or, if you have machine shop access, just making the motor can bigger until it fits. Below is an image of my initial layout for Razer's motor in Autodesk Inventor's sketch environment.

Rotor design tools have now emerged on the Intergoogles. The most prominent of these is the GoBrushless rotor calculator, which conveniently packages all the layout into a form. Heck, it even draws what your rotor will look like. Let's go over what the terms on the page mean. All dimensions are millimeters:

Stator Diameter: The maximum outer diameter of your stator.

Rotor Diameter: The minimum INNER diameter of your rotor

Magnet Width: Assuming square magnets, how wide your magnet is.

Magnet Thickness: How thick your magnet is. A magnet you would select for your motor is almost always going to be magnetized through its thickness.

Magnet Poles: How many magnets there are in total. There are going to be a multiple of 14.

The Air Gap(Updated 28 March 2012 to include air gap factor for the magnets)

The one thing I left out of the above list is Air gap, because the subject warrants its own discussion.

The tightness of your air gap determines how much of the magnetic field is linked to your stator. The E&M term is coupling. A tighter airgap yields better coupling between magnet and stator. You know why the B rating of the magnet is called remnance? Because that's how much field remains at its surface if the magnet is in open air, with no magnetic materials to surround itself. 

A motor is a magnetic circuit, and there are a whole set of laws that govern them. For practical purposes, it boils down to the more coupling you can ensure in your magnetic circuit, the stronger the field in your airgap. The "Gap Factor" equation is:

Ba = B0 * (t / (t + g))

where t is the thickness of the magnet, g is the radial thickness of the airgap, and Ba is the flux density at the surface of your stator. This is the flux that will actually generate torque, so really it is the value that should be used in the NIBLR equation! B0 is the surface remnance rating of your magnets - for high N grades like N48 and N50, this could be as high as 1.3 to 1.4. But if your airgap is loose, or the thickness of the magnet is small compared to the gap, then you will lose a substantial fraction of it before the stator radius.

For example, if you have type N42, 3mm magnets but a 1mm airgap, the multiplier is 0.75! That means the B value you thought was close to 1 (since N42 magnets have roughly 1 Tesla of remnance) is more like 0.75. This can really throw your motor design and make it clock high speeds (thus less torque) than you expected.

Now you see why you can't just glean the first torque equation off the intro page and be done. The updated torque equation is:

T = 4 * m * N * B0 * (t / t + g) * L * R.

So, the tighter the airgap the better - to a limit, as with everything. If you are running tenths of millimeter airgaps, you had better be well-versed in machining, or have a computer controlled machine do it for you. Wobble in your can from machining tolerances and irregularities can throw off your airgap measure and could cause your magnets to collide with your stator!

I try to shoot for an airgap of 0.5mm or thereabouts. 0.4, 0.6, whatever. The wide the airgap, the more "fiddle space" I have if something turns out to not fit correctly.

Magnet fill percentage

This describes the fraction of the rotor circumference on the inside of the magnet ring that is occupied by the magnets. This number should be somewhere between 75% and 95%, generally. Square magnets can never achieve 100% fill unless you are truly lucky. Numbers below 75% will hurt torque and efficiency because the B-field in the airgap becomes irregular.

Oddly enough, very high fill percentages actually have a slightly negative effect towards motor performance, because the magnets become so close together they "leak" to eachother. The effect is minimally noticeable for low speed hub motors, however.

While fill percentage isn't calculated on the GoBrushless rotor designer, you can easily calculate it by

Fill = (14 * k * Magnet Width) / (pi * Rotor Diameter) using consistent units, like millimeters.


Metamagnets

What's that k I stuck in the equation there? Another random constant to keep track of? AAAAHHH

Not really. Let's say you can't get good fill and an acceptable airgap number using single-piece square magnets, and you can't change the rotor diameter.

It is allowed to use two smaller magnets side-by-side to emulate a single large magnet. This also has the advantage of better conformity to the round walls of the rotor. Smaller magnets are a better approximation to the game of squaring the circle. The less your airgap deviates from the average, the less torque ripple your motor will exhibit.

Hence my reference to multiples of 14 earlier. GoBrushless' rotor designer will space all the magnets out evenly, but as long as they fit evenly, there is no reason you can't group them into larger metamagnets, as seen in Figure 3 below.

In the extreme case of RazEr, I used four mini magnets to make one magnet pole. Two side by side, and two rows deep. The fill factor was incredibly close to 100%!

That brings me to...

Magnet Length

Up until this point, your design has been exclusively 2D. Once you get the profile of the magnets right, you need to make sure they are available in the correct length.

The magnet length can be fudged a little. Optimally, the magnet length is equal to the stator length (L). That is because the steel in the stator is what focuses the magnetic field generated by the motor windings into the magnets. Shorter magnets will result in suboptimal performance - try to avoid this, because part of the stator field will be essentially shooting off into empty space.

It is also not advisable to spec out magnets which are too much longer than the stator. This causes interaction with the end turns of your windings, which is undesirable. A small amount longer, such as the next millimeter or two up in order to achieve a stock magnet size, is fully acceptable.

In RazEr's motor, I had a 35mm wide stator, but no 35mm magnets. I thus spec'd out for twin 20mm magnet stacks, which brought the magnet width to 40mm. I decided to live with the "stickout", so to speak.

Rotor Thickness

One of the constraints you will face is the OD of the rotor. In the best possible situation, the ID is set by the magnets and you have free reign over the outside. However, if you already have your prospective wheel and tire picked out, you might face limits here.

This is problematic because you cannot make the rotor can too thin in the walls. Not only does structural strength suffer, but the magnetic field of your permanent magnets won't be properly contained. If it leaks out, then the airgap field strength B will suffer, because what goes out of the motor doesn't come back in, so to speak.

The rule of thumb is to make can more than one half the magnet thickness. Going under this will cause quick flux containment loss. It does not hurt to go over - in fact, if your rotor is very thick, it can actually be part of the motor structure. Most commercial hub motors for bikes and large (road-legal) scooters and mopeds are made in this way. The only potential downside to a massive rotor is weight.

Step 8: Mechanics and Materials

Now we're getting to the mechanical design. Let's lay the ground rules for what you might need or have access to.

Rotor Material

Your magnets would like to be contained in a material which offers low resistance (reluctance) to the magnetic field, and also does not magnetize itself permanently in the presence of the magnets. Many high performance alloys of nickel, cobalt, iron, and trace metals have been invented to optimize the magnetic properties of a motor. They're expensive, require specialized heat treatment, and even specific machining processes to conform to the geometry of a magnetic machine.

We're not going to bother with that. The most common rotor material for hobbyists is just plain steel tubing. It does a good enough job, and the best part, it's cheap and readily available.  I will list sources of steel tubing in the Resources section, but as a general rule, the tubing you purchase should be:

low carbon or "mild" steel. High carbon and heavily alloyed steels have significantly worse magnetic properties.

� seamless or at minimum DOM style tubing. This is the majority of steel tubing, but keep an eye out regardless. DOM tubing has a more uniform wall thickness and no ugly weld seam to affect the roundless. It is generally made to tight tolerances. Avoid cast iron pipe.

� plain finished. A precision ground or machined and polished finish will not do you any good unless it's already precisely the diameter you need.

� Oversize (OD larger than your rotor's outside diameter) AND undersize (ID smaller than your magnet mounting surface) so you can machine it to suit and not worry about hitting the limits of your materials' physical manifestation.

Endcap Material

Since the only thing which has to support a magnetic field in your motor is the rotor, the endcap and other structural elements only have to be mechanically sound. That means you have way more choices here. Generally, it's some kind of nonferrous (not steel) metal.

� Aluminum is the number one choice. It's light, strong, easy to machine, and common. Not exactly cheap in "big", however.

� Plastics! Engineering polymers such as nylon, polycarbonate, acetal, and polyethylene in high density and high  molecular weight varieties all exhibit high strength and lightness. Plus, plastic machines like... well, plastic. Easy to shape, especially if you are new to machining.

Some plastics let your motor have the magical see-through effect. The BWD Scooter uses Lexan (polycarbonate) side plates so you can see the robot in disguise.

� If you are into that stuff, you could conceivably craft endplates out of fiberglass or carbon fiber panels. The ultimate in light weight and stiffness, but be aware of the fact that you have to attach it to the can somehow. This will be addressed shortly.

Center Shaft Material

The most important trait of the shaft is that it can't bend. I'll address shaft design shortly, but you should expect to make the shaft from some kind of metal. Larger hub motors use steel, smaller ones may be aluminum. I used an aluminum shaft on Razer's motor for weight savings and ease of machinability.

� Aluminum should be limited to the aircraft alloys: 6061, 2024, 7075, and similar. These offer higher strength than other aluminum grades.

� You can get away with a mild steel shaft such as the low 10xx alloys (e.g. 1018, 1020), but if you are already using steel, moving up to a medium carbon or alloy steel shaft wouldn't hurt. Very low alloys (1006 and similar) do not machine well - they are actually too soft to finish machine finely.

Tools

Let's be honest: a motor is a precise alignment of opposing magnetic fields. Invariably you will need access to machine tools to make them. Unless you are very crafty with your shop drill press and Dremel and can make things conceptric to within 5 thousands of an inch (0.005", or around 0.1 millimeters!)  constructing the endcaps and rotor (and shaft, and stator mount...) will require access to...

� A metal lathe. Not a wood lathe, where you hold the tool yourself, but a metal lathe. If you have made it this far, I assume you know how to operate such a machine already, because giving machining lessons over Instructables is slightly troublesome. 

You will need the ability to precisely bore an inner diameter. Boring bars, or something which can function as them, are a must.

� A milling machine, or at minimum, a drill press with X-Y table and fixturing & indexing abilities. This can be a full size Bridgeport or similar, or a miniature hobby mill like those found at Harbor Freight. Basic tooling should be available. You should have a spindle drill chuck to precisely drill holes with at the least.

� Some kind of vise. Handy to have for pushing in bearings and cans, and also for holding the stator while you wind it! Extra leverage will only help in winding.

� Measuring calipers, micrometers, dividers, etc. Because several parts need to fit closely with one another, you must have metrology tools. I get by with a single digital caliper.

Step 9: The Center of the World

Your entire motor revolves around its center shaft.

No, really, it does.

Inside-out motors like hub motors have the advantage that their "shaft" is actually stationary. It is also the only mechanical connection to the outside world, because... well, everything else is moving around it. So, the shaft must be stout and resistant to deformation or bending. An off-axis, bent, or otherwise incorrectly constructed & used shaft will cause wobble, stress the bearings, and with your weight on it, could exceed the strength of your fasteners.

Single Supported vs. Double Supported

There are two top-level arrangements, and they have some implications with respect to vehicle compatibility and shaft design.

� overhung, single supported, or "car" style. The most common style for large hub motors, like those used on... cars. Only mounted on one side. The shaft is thus used in bending. Shafts and bearings for motors of this style need to be much thicker and stronger to avoid damage than...

� double supported, or "bike" style. The most common for small hub motors. The vehicle weight bears down on both sides of the stationary shaft, and the bearing loads appear between these two points. For short distances between supports, the shaft is used in shear. This is a better arrangement for stiffness, but its not as serviceable because the motor is surrounded by vehicle on both sides.

I will focus on double supported shafts for now, since the single supported designs are quite literally just half of the former.

Single Bearing vs. Double Bearing

Uh oh. There's even a distinction here? Yes! The rotor assembly can be supported only on one side, that is, one endcap, or have two endcaps and be fully enclosed.

� Single bearing systems represent the vast majority of your average R/C outrunners. While most of those use a live shaft, the principles are the same: the rotor is supported only on one end, and the other is open to air.

Besides exposing the internals of your motor to weather and debris, knowledge of some intermediate mechanical engineering principles is needed to correctly design a single-bearing system. I will not consider single bearing motors, because they are mechanically less durable than an equivalent sized double bearing motor.

You CAN have a single bearing motor with double frame attachment, but then it's just pointless, no? 

� Double bearing, or two-endcap rotors are what essentially all production hub motors are. Even if they are single-supported (car style), there is still a front endcap and a rear endcap, both of which hold bearings. These provide the idea symmetric loading that prevents rotor deformation and magnet-stator collisions.


General overview of shaft design

Refer to Figure 1 for a basic cross sectional diagram of a generic hub motor center shaft.

From left to right:

� the External Mounting Surface is the main means of attachment to the vehicle. This may be an externally threaded bolt-like protrusion, or a square clamping surface, whatever. This may not be present in compact motors, but are almost always found on bike-style motors, because they are designed to drop right in place of the nonmotorized rear wheel.

� the External Mounting Clearance is a shoulder to provide spacing between the vehicle frame and the rotor surfaces. May or may not be the same physical diameter as...

� the Bearing Seats are precision-machined surfaces onto which the motor bearings are fitted. Tight tolerances (1 to 2 thousandths or less!) are required for proper bearing use.

� the Internal Bearing Clearance serves as a backstop for the bearings so they cannot shift axially.

� the Stator Mounting Surface may directly couple to the stator, or can support a hub or other mechanism to retain the stator. Generally the largest diameter the shaft occurs here.

� the Internal Mounting Surface performs the same function as the EMS, but is on the interior of the shaft. This typically takes the form of a threaded hole into which you can tighten a screw against the vehicle frame. Any practical combination of EMS or IMS features can be used - this is a matter of design.

However, there is one very important aspect of internal features that you have to be aware of.

Getting the wires out

Without an electrical connection to the outside world, your motor cannot operate! At the minimum, you need provisions for running three heavy gauge wires out from the internals of the motor. If you plan on using Hall Effect sensors, this could increase to eight total wires: 3 large and 5 small signal wires.

Most generally speaking, two methods exist for running conductors to your windings:

� Through the shaft center. The shaft is hollow, and the motor mounts using external features. This requires drilling out the center of a shaft while remaining concentric and on-axis. A cross hole or slot is drilled internal to the motor, usually near the stator mounting surface, to bridge the interior of the motor with the outside. Then, wires are run through this center hole.

� Besides the shaft. In RazEr's case, I elected to use this method of cutting a small keyway (actually a flat) and just running the wires out through it. While easier, this method causes wires to run very close to rotating surfaces, and also means that a section of the motor bearing has no shaft contact. This is mechanically suboptimal.

Examples of each method are in figures 3 through 5 below.


Shaft Size

Yeah, I know, we have to talk about this eventually. The fact that you have to provide enough space to run cables means the motor shaft cannot be too small in diameter. Small diameter shafts are also nonconducive to stiffness.

For hub motors, the old adage rings true: Bigger IS better. Use the largest diameter you have available to you, or the design allows!

Both iterations of RazEr's motor used 15mm diameter shafting. I found this adequate for the roughly 2 inch span they had to bridge.

Shaft size directly correlates with what bearings you can use. Speaking of bearings...

Step 10: Get Your Bearings!

Smooth bearings make a world of difference for an electric motor. In a hub motor, they are even more important, because they have to support the full weight of a vehicle whereas a standard indirect drive motor might only have to put up with chain tension.

General Bearing Knowledge

In all likelihood, you'll end up using miniature metric single row deep groove ball bearings in your design, because they are the most common types around. Such bearings are rated using the 6000 system.

Bearings are rated by their Dynamic Radial Load Capacity. Dynamic means moving, and radial load is any direction orthogonal to the shaft axis - which is to say, any way you can think of loading it. Ball bearings are generally not rated for Thrust loads, which are coaxial to the shaft.

An average 6001 type bearing has a 12mm bore, a 28mm outer diameter, is 8mm wide, and has a DRL rating of about 1000 pounds. That might sound like alot, and it is.... if your application is applying constant loads with little to no shock, like in an industrial motor running a pulley or something. This is never true for hub motors.

What kills ball bearings is shock load. You hitting a pothole, the sidewalk, a small animal, etc. Even just sidewalk seams can exert impulse forces of thousands of pounds for a fraction of a second. Force is proportional to acceleration, and hitting something solid imparts very high accelerations into the colliding masses. Bearing failure is called by brinelling, or the balls putting divots into the bearing races from shock loads. This results in the "crunchy bearing" sound.

In the worst case, you can deform or shatter a ball, and your bearing usually seizes up. Hence, it never hurts to use the biggest bearings you can design into the motor. The above 6001 bearing is a good choice if you don't mind the limited shaft diameter.

Thin Profile Bearings

The 6800 and 6900 series describe "thin section" bearings which have a minimal difference between the bore and the OD. Bigger ones are some times called ring bearings.

They are convenient because they offer large shaft diameters, good for wire clearance, but without being excessively large in outer diameter or width. After, you don't want your bearings eating up all the precious space between your mounting surfaces.

However, the 6800 and 6900 series are "thin section" for a reason. They are designed for very light loads. The minimal difference in the outer and inner dimensions means that steel thickness is sacrificed for space saving. These bearings usually have DRLs no more than a few hundred pounds.

Yeah, that still sounds like alot, right? But the steel outer and inner races may be just two or three millimeters thick. Thin section bearings brinell easier than their beefier brethren because the thin steel races have less resistance to forceful incursions, like an overloaded ball.

I would caution against using the 6800 series at all. The 6900 series is slightly heavier in construction and represent a good intermediate between ring bearings and "normal" bearings.

For instance, a 6802 ball bearing has a 15mm bore and is only 24mm across. A 6902 bearing has the same bore but is 28mm in diameter, and has over twice the rated load in general purpose ABEC-1 style. Peace of mind for 4 more millimeters? 

Sealed or Shielded?

When spec'ing out bearings, you will often find them in myriad flavors, regalia, and trim levels. The question usually boils down to "open, sealed, or shielded"?

Open bearings are open to the air. There's nothing covering the bearing races from dust, grit, and contamination. They also cannot retain lubricant. Open bearings will be destroyed very quickly in hub motor duty. You find these more inside motors or engines where they're bathed in oil and enclosed from the outside.

Shielded bearings are the next level of grime protection. A thin metal shield over the ball races keeps out most everything. However, metal shields do not contact the inner race, so over time, things still do get in. These are by far the most common ball bearings, though, because they represent a good compromise.

Sealed bearings use a rubber seal to accomplish the same goals with more security. The downside of a sealed bearing is more free-running drag, because the rubber seal rubs on the inner race as it moves.

If I had a choice, I would just go with sealed bearings. The price difference between them and shielded is usually minimal, they retain lubricants better, and generally speaking, metal shields can be deformed or damaged easier than a flexible rubber seall

Bearing fit

Ball bearings are precision devices, and thus need precision to be correctly mounted and used. Never use a hammer or mallet to install ball bearings. If they do not slip in, use a proper arbor press! Even a vise is better than nothing (and no, I don't mean vise grips).

Bearing installation must be straight (not crooked) and the difference between the bearing's OD and your mounting surface's bore should be less than 1 thousandth of an inch. That's 0.001 inches, or .02 millimeters. That's really precise.

Too tight fits will cause "crunchiness" and a hard to turn bearing. Using the bearing like this can destroy it quickly.

Loose fits, if under 5 thousandths, are generally rescuable using a retaining compound such as Loctite 609. Very loose fits are not recommended at all.

Step 11: Boundary Conditions for Your Motor

We have reached the last and most important part of the motor: the endcaps.

Okay, I lied. EVERYTHING on your motor is the most important, but this one is the MOST important!

The motor endcaps are what bridges your motor shaft and the rotor can. Because they are large in diameter and disc shaped, they are often the most difficult parts to get right on a motor. They have to stay concentric and without axial wobble. Usually, they'll have rotor attachment features machined in them too.

Referencing figure 1 on the bottom, there are a few characteristics of every endcap design.

� The Bearing bore is a precisely machined surface, that is, +/- 0.001 or less, into which the bearings fit. Usually, this is a press fit, but can be a tight slip fit if one side needs to be removed for servicing.

� The Bearing shouldermight or might not be present. If it is, it's usually just a small extension that brings the thickness of the bearing bore to the width of the bearing. It might not even be needed if the bearings are press fit into the bore. It can be on the outside or the inside.

� A winding relief cut is usually made so the magnet wires bulging out from the stator don't interfere with the rotation of the endcaps. If your motor is sufficiently wide, this is unnecessary, but space-constrained motors like my scooter motors needed the endcaps to sort of conform around the stationary internals.

Making the winding relief results in a dish-shaped endcap.

� Can mounting surface and provisions. The surface is the broad cylindrical face that mates with the magnet can itself, and provisions is just my term for describiing how the can is held in place. Regardless of how the can is physically mounted, the surface itself should be smooth and well fitting: unless you are purposefully going for the permanent press method, leave this a smooth slip fit, which indicates a diametrical difference of .002" or less.

In terms of how to actually mount the can, there are a few approaches. Shown in Figure 1 is "radial threaded holes" which go through the can and into the endcap.

Shown in the other pictures of my scooter motors are axial holes which either let me bolt through the can or around it. 

Through-can axial screw holes, which make the can itself structural, are the most common method for large bike and car motors. If you have the space available, it is also the strongest!

The BWD scooter is a great example of through-can axial screw mounting. The endcaps also prominently feature an external bearing shoulder.


You have the option of integrating wheel mounting facilities into your endcaps, which is what I did for RazEr. Speaking of which...

Step 12: Wheel Mounting

Hey, since this IS a "hub motor", there ought to be a way to mount a wheel on it or something. You might have picked a wheel out already to build your motor within, or are building the motor to eventually mount a tire to.

Let's clear up some terminology first. The tire is what contacts the ground. The rim is what the tire is mounted to, just like in a bike or car. The hub is what the rim mounts to. We are building a hub motor.

It is perfectly reasonable to integrate "rim" and "hub" in a small motor. We will see that the integration was my choice for RazEr.

Wheel mounting generally comes in one of several flavors, just like everything else. The exact method you might end up using depends strongly on your available space and existing wheel specifications.

� Car style. The hub is distinct from the rim. If you literally are building a hub motor for a car (why are you reading this?) then it offers the most flexibility in terms of wheel placement and choice. Welded or stamped studs usually emanate from one endcap so you can mount the rim.

� Bike style. In the case of bicycle motors, the rim is still distinct from the hub, and radial spokes emerge from flanges on the case of the motor, usually the endcaps.

� Scooter style. A degenerate case of the bike motor, the rim is small enough to be directly bolted to the endcap projections. The rim is still distinct and removable.

� My style. Illustrated below in Figures 2 through 4, this just puts the tire (in my case, a chopped and screws push scooter wheel) directly between the endcaps, sitting on the motor can. Not serviceable without removing a motor endcap, which really constitutes taking apart the motor. Thus, RazEr's motor isn't very suited for public release.

� A modified version of "chuxx0r style" is removable rings that are logical (but not physical) extensions of the rotor endcaps, which are now completely inside the can, and attach using radial screws. This means I can undo one of the rings, slip the wheel off, put a new one on, and reattach everything.

Just glueing rubber to the outside of the can. Yeah, it can be done. You'll make steamroller tires and you better be sure the glue is strong!


Wheel gutting

If you're building small motors like me, it's usually hard to find just "a tire" for the motor. You'll have to cut it out of another wheel.

This is a tricky machining operation because you can't fixture to rubber tires- they'll just deform. If you can securely clamp the wheel to a machine surface, then by all means, cut away.

� If the wheel is sufficiently small, you can use a machininable fixture collet on a lathe to grip the entire outside at once. That will usually gain enough stiffness to let you cut the center out.  These things are made up to 6 inches or so for common, import-grade fixtures.

� Make a mandrel that bolts through the center of the wheel. Now you have the wheel secured by its strongest point.

Casting your own tires

Certainly an option, and for the truly hardcore DIY addicts, the most productive. I have no experience with urethane or rubber casting, so can only tell you to read Instructables more.


Step 13: Fabrication Notes and Conclusion

That's it. I have just written 12 Instructable pages without actually telling you how to build anything. I think few can beat that...

This is only intended as a guide and primer on what you could do. I did not include directions on how to fabricate one specific motor because it assumes too much engineering knowledge to tell someone to follow my lead, at least in my opinion. In a future Instructable, I might go over the specifics of building RazEr's motor. But, in the interest of modularity, I elected to keep things separate this time.

Maybe you guys can take up my slack by talking about how you made your hub motor!

What I can do now, though, is put in a few fabrication notes for when you embark on your hub motor adventure.

� The "elevator pitch" in terms of motor design here is to stuff in the strongest magnets and the largest stator using as many turns of the largest wire running across the highest voltage battery you can get your hands on. Maximize ALL of N, R, L, i, and B. But wait, I thought earlier you said as few turns as possible was the best? Not necessarily: I said that just enough turns to get a workable Km contributes to lower motor resistance. There is no need to constrain yourself to low turn numbers. In fact, high turn numbers running at high voltages are almost always better than low turns and high current!

� Use a good high temperature 24+ hour epoxy to glue the magnets in. Cheap hardware store 5 minute epoxy has inadequate time to set, and the chemical crosslinks are not nearly as strong. Thin laminating epoxy (for fiberglass and carbon fiber layup) is recommended, with a microsphere filler. The filler shortens the working time of the epoxy, but causes it to be stronger and more tenacious.

� Speaking of gluing the magnets, you may notice that they have a tendency to snap towards eachother in your can. To avoid this, cut up some popsicle sticks into wedge shapes and push them into the gap to separate the magnets.

� GoBrushless' rotocalc also generates a magnet placement guide image. Print this out at full scale on a piece of paper and perform your magnet gluing over it.

� As long as you have machine access, make jigs and fixtures to help you glue the magnets. Try not to let them float as you're gluing.

� While on the subject of epoxy, sealing your motor windings with high temperature enamel or epoxy will keep them together (prevent unraveling or jiggling) and make them more heat resistant. Do this AFTER you make sure your motor works and winding is correct.

� Never wind wires on a naked stator. The metal edges will pierce the magnet wire's thin enamel coating and result in a phase short to the core. You are bound to make more than one, so the phaes will short to eachother!  

If you cannot avoid winding on a bare stator, liberally apply heatshrink or electrical tape to the inside corners of the stator, and wind carefully. If you create a short, you MUST rewind that phase.

� Pull your wires tight. Loose windings are more likely to be damaged, and they are longer than they need to be, so your motor has extra resistance.

� Insulate, insulate, insulate. You have wire running past high speed rotating surfaces which will abrade the insulation if allowed to rub.

� Use a good, flexible wire. Silicone high strand count (HSC) wire, including the popular "Wet Noodle" from W.S. Deans, are the best choice.

� Use high quality hardware. On Razer's motor, I made the mistake of using stainless steel screws because they were cheap and already at the hardware store (instead of ordering high quality socket head cap screws). Bad mistake - they sheared and stripped one by one, leaving the motor wrecked.


A Note on Motor Control

BLDC motors can either be sensored or sensorless

Sensored motors have Hall Effect sensors which react to magnetic fields. There are at least three of them inside your average sensored motor, and they function as a very crude position encoder. A sensored motor controller reads the state of these sensors and correlates them to the position of the motor through a lookup table. It then outputs the proper voltage levels to the motor according to this state table. This is called Space Vector Modulation.

Yours Truly has build a fully hardware (logic chips, op amps, no microcontrollers) SVM motor commutator for a class project. And it actually worked.

Sensorless motors are operated by controllers which sense back-EMF. Remember from the page about DC motors and their ability to be used as generators? Every time the brushless motor moves, it puts out a sinusoidal (or trapezoidal) waveform on its 3 connections. A smart controller can actually read these voltages and have an idea of which direction the motor is traveling. It can then sequence its output to "encourage" the motor to keep rotating, generating torque.

What is the difference? One has 3 more parts and the other doesn't?

Well yes, and...

Sensorless motors cannot operate from standstill unless the controller is very sophisticated. If the motor is not moving, the controller has no way of know where it is. There do exist controllers which can sense motor position based on the effect of the motor's magnets on the phase inductance. However, those are ungodly expensive and are a new industrial technology (which makes them even more expensive.

� Hence, if you keep your motor sensorless, you may find yourself kick-starting your vehicle.

The vast majority of inexpensive R/C airplane motor controllers are sensorless.

� Sensored motors can operate from 0 speed, but require a controller that can read them. These tend to be more expensive than their sensorless brethren.

� Additionally, if you add sensors to your motor, you have to place them in the correct spots. Hall sensor placement is a quasi-nontrivial process that requires knowledge of the motor's electrical slot ratio.

Two popular Hall Sensor placements exist: 60 degrees and 120 degrees. I glean over this on my website, but the degrees refers to how many electrical degrees apart the sensors are.

To place Hall sensors properly in your motor, you have to know how many electrical degrees each slot (or tooth) occupies:

°elec = 360 * p / t

where p = number of pole pairs. For a LRK motor, this is 7. Likewise, t, the stator slot count, is 12.

For a LRK motor, the electrical degree of one slot is 210 degrees.

Now that you know the °elec of your motor, you can technically place the first sensor anywhere. Let's call this the "A" sensor. I  have just wedged it between the Aa winding of the first phase.

You must place the B sensor in a slot that is °elec ahead of sensor A. This may or may not actually end up in the middle of a slot, and it is an iterative process. Each slot is 210 electrical degrees, so start adding. Begin at 0 degrees, the position of sensor A. Keep track of the number of times you add, wrapping around 360 degrees for each result, until the result is equal to 120.

That is:

1) 0 + 210 = 210. No need to modulo 360. The number of additions is 1.

2) 210 + 210 = 420. Subtract 360. The result is 60. The number of additions is 2.

3) 60 + 210 = 270. No need to modulo 360. The number of additions is 3.

4) 270 + 210 = 480. Subtract 360. The result is 120. The number of additions is 4. You win.

Thus, sensor B should be 4 slots away from sensor A, and sensor C a further 4 slots away.

Conveniently enough, in a LRK motor, a 120 degree hall sensor placement actually results in the sensors being physically 120 degrees apart. Isn't that awesome? 

� Sensors complicate the wiring issue because you need at least five more wires: Logic power, ground, and the three outputs A, B, and C.

However, I believe that sensored motors (or the wacky inductive sensorless jiggymabob) are the best for small EVs. And EVs in general. They allow you to take full advantage of the massive torque capabilties of BLDC motors by using them at 0 speed!

Conclusion

DIY electric vehicles are fun and exciting, as well as a treasure trove of learning opportunities. Engineering your own motor is no small feat, especially one destined to be operated in a vehicle of your own design.

Here's hoping that future regulations over the nascent electric vehicle industry and laws over their operation grant amnesty to, or even encourage, DIY mechanics, hobbyists, and experimenters.

The virtually rendered motor seen in the opening page is a motor for my next crazy EV project: Deathblades. I'm aiming to do what alot of people have been peer pressuring me to do, and drop RazEr's technology into some foot trolleys of certain head trauma. See my Youtube page for a snazzy animation of how the hub motor goes together. If you've been confused by my thousand-word explanation, this should help clear it up!

If you've never seen RazEr in action, check out its test video here.

I'll be updating, editing, and changing things around as I go, so if you see any glaring omissions or errors, absolutely point them out to me!

And good luck. See the next page for a list of resources!

Step 14: Resources, Links, and Knowledge Base

Motor Parts

GoBrushless
These guys mainly deal in small aircraft motors, but their rotor designer is a godsend. They also sell stock stators in the 50mm and 60mm size range.

Super Magnet Man
Reputable dealer of stock AND CUSTOM! neodymium high strength magnets. All of my motor magnets have come from him. George is a friendly person to deal with and chock full of all kinds of magnet information.

Custom magnets from George generally take 3 to 4 weeks to manufacture and are priced only slightly above stock magnets. This is absolutely phenomenal: For a bit more cash, you can have a full circle of magnets customized to your motor.

Protolam
These guys supplied the iron for the BWD Scooter gratis. They have in house punches and LASER cutters and will make small quantities for your experimentation

� Your local motor shop
Got a local electric motor rebuilder? Give them a visit. They'll be glad to see a motor which doesn't require a forklift and 8 guys to handle. High-grade magnet wire and potential harvestable motors.

General Parts

Hobby King

A certified legit™ hobby products dealer out of Hong Kong. Mind-blowing pricing on everything, and they make no attempt to hide the fact that their products are Chinese in origin. You can put together an entire EV hacker powertrain just from the parts on this site. Stock up on lithium batteries before the Fed regulate bare Li packs out of existence.

Their large outrunner motors are inexpensive enough to consider cannibalizing for stators.

McMaster-Carr

I shouldn't even have to mention these guys. If you can think of it, they probably carry it, else it's not worth buying. Magnet wire in "huge" and "holy crap" gauge, raw materials, bearings, adhesives, and hackable wheels are just a few motor-relevant things I can think of that you can find there.

Kelly Controller

Purveyors of fine (Chinese) motor controllers in sensored, sensorless, both, and neither (DC). Their KDS line of mini-controllers will be perfect for your small sensored hub motor. You can also be lazy and just buy one from them.

VXB Bearings

Because all legit bearing manufacturers have 3 letter names. Inexpensive bearings for your motors. I've gotten all my bearings for everything I've built from here. Everything I've built since discovering them, that is.

Speedy Metals

Where I got my Giant Steel Death-Tube from for Razer's motor. Get raw materials for the mechanical structure of your motor here.

Knowledge and Reference

The Southern Soaring Club Reader Articles

Contains one the best brushless motor primer I have seen. Electric Motors part 1 - 5 is worth a read to get more background on the matter.

Emetor Brushless Motor Designer

Everything I just said and more wrapped up in a handy spreadsheet style calculator! Forget "4 * N * B * L * R", it will give you everything from back EMF profile to torque ripped to phase voltages and inductances. To use it properly, you MUST know critical dimensions and materials of your motor. But it's about as close as you can get to building it and throw it on the dyno.


Powercroco

This site is a veritable platinum mine of motor information and theory... if you can read German. Alot is lost in translation if you use an automatic translator, so find your nearest German guy and press him into service? Dr. Okon is the progenitor of the famous and useful Kombinationstabelle.

� The RC Groups Motor Design and Construction forum

Always welcoming of newcomers and people with questions. The Crazy German R/C Airplane Guys here represent a vast majority of all motor limits-pushing that has occured in the hobby.

LRK Torquemax

Learn more about the background of the LRK winding here.

My site.

Not to be one to self-plug, but I have a bad good habit of keeping detailed build logs about EVERYTHING. Documented are all the rebuilds of RazEr, its predecessor Snuffles, and my most famous creation, the LOLrioKart.