Motors: Maths, Mystery, Mastery

Motors. One of the most intriguing aspects of DIY and electronics work. They are what we use to make things go. Conceptually, a motor is a fairly simple thing. There are some coils which create an electromagnetic field, and a spinning piece in the middle which is effected by those fields. The fields being generated in just the right way can pull the motor around, and the strength of the field (usually this would be B) is going to determine the speed of the spinning motion. When you get even more advanced, you start looking at finer control than just “on” and “off”. A stepper motor – which is able to move a fraction of a rotation at a time, is used for many different things, but most commonly for timing sensitive projects. Even better, is a bipolar stepper motor, which when given the correct signals can move both backwards and forwards. As you might imagine, this is used in manufacturing devices such as 3D printers and CNC machines.

Maths

So, why are motors complicated? In part it is because most people don’t study enough physics to wrap their heads around torque, and the difference between a rotational force and a single direction force. If you do basic engineering, robotics, or physics, you will know this stuff. The average human isn’t using it from day to day. So when it comes to DIY, you suddenly have to cast your mind back to when you did study it, and re-gain the instinctual knowledge of what is important. Even worse, many DIY-ers didn’t study this field. So, what to do? What do all those numbers mean? Which one is important, and what impact is it going to have on the system you are building?

Talking about Torque

What even is torque? Very simply, without going into the definition of vectors and other fun mathematical concepts, torque is a rotational type of force. It is not the same as force (F) which is defined with Newton’s laws (you might be familiar with F = ma). Torque (τ) is measured in units of Newton metres (Nm) as opposed to force simply being Newtons (N), and is most easily defined with the equation τ = rFsinΘ. Where r is the radius of the rotation (e.g. radius of a pulley) and F is the straight line force. Θ is the angle at which the force is measured. So, rather than worrying about trigonometry making this even more complicated, we make sure that F is measured perpendicular (i.e. 90°) and we can enjoy the fact that sin(90) = 1. So that term vanishes from our equations.

Of course, no aspect of physics would be complete without a second definition of the same thing. So, if we do not have the perpendicular force of the system, how do we calculate torque? The second definition is τ = Iα. Where I is the moment of inertia of the system, and α is the angular acceleration. Nothing ever being simple when circles are involved, the units for inertia are kg·m² (kilogram metres squared), and the units for angular acceleration are rad/s² (radians per second squared). Radians being a “dimensionless” SI unit they aren’t super important here, I simply mention all of this to show that when combined, you get kg·m²·rad/s² = rad·kg·m²/s² = rad Nm, and since rad is dimensionless, that is just Nm.

These definitions are all very well and good, but what do they mean in practice? How do they help us to choose the right motor for the project we’re working on? Let’s have a look at the specs for a couple of fairly easy to find motors, which may look familiar to the deep DIY-er or mechatronics fan. The most simple motor is the 28BYJ-48 which is as cheap as R30, and is mentioned in many different tutorials. You can, if you want to, spend over R1000 on more powerful and complex motors, with finer controls, and higher torque, but for most applications that is over kill. Some of the important aspects for project planning will be voltage, pull-in (or holding) torque, and detent torque. It would be helpful to also know the moment of inertia, and newer motors do provide that, but theoretically the torque is sufficient.

Pulling Power

To be clear, I’m using “pulling power” colloquially, and not scientifically. This isn’t about Watts, it is about how much mass this motor can move. That’s really what we care about when we look at the torque of a motor. How much “stuff” can I move around quickly and accurately?

Newton’s laws are pretty clear here. Once the system is moving, it is much harder to stop it, and reverse direction (or change direction) than it is to just keep going in a straight line. For a linear system (say a box sliding on a flat table) you care about friction. Your total force (F_t) is going to be a combination of the backwards frictional force (F_f) and the forwards applied force (F_a), giving you the fairly simple F_t = F_a - F_f. Each of which can be broken down into terms we already know, giving us F_t = ma - µmg where µ is what is known as the coefficient of friction, or “how sticky is this surface”. In our DIY project, we haven’t really defined what we want the motor to be doing. If it is going to be lifting items through air, then µ is going to be mostly irrelevant, and the opposing force will essentially be caused by gravity. If we are sliding something along a rail (e.g. in a 3D printer or CNC machine) then µ becomes very relevant. In order to minimise this aspect, we can use linear bearings and very smooth surfaces (even greased) to reduce the force required to overcome friction. If you can get µ small enough, you can even neglect that term in your calculations.

If we have negligible friction, then the amount of force required to maintain linear motion is also going to be negligible. Moving at a constant speed (or velocity for the physicists) does not require acceleration. What does require acceleration is the act of changing from stopped to going. Or the act of changing from going forward at 10mm/s to going backward at 10mm/s. So really this is where the torque of the motor comes in. Let’s make some bold assumptions now, about this system (remember this is all still theoretical, we can assume anything). We will claim that the body we are moving has a mass of 500g = 0.5kg, we will measure the pulley we have attached to the spindle of our motor as having a radius of 7mm = 0.007m, and we will read off the torque of our motor from the spec sheet as being τ = 29.4mNm = 0.0294Nm. We will also assume that we have a very smooth surface with nice bearings, and µ is so small that we can neglect the friction term.

Now, running some calculations:

τ   = F_a·R
F_a = τ/R
    = 0.0294/0.007
    = 4.2N

F_t = F_a - F_f # but we neglect friction for now
F_t = F_a
F_a = ma

a = F_a/m
  = 4.2/0.5
  = 8.4m/s²
  = 8400mm/s²

As a sanity check, if we were lifting this mass through air, using the same numbers, we would set µ = 1 (essentially) and get:

F_t = F_a - F_g
F_t = ma - mg
F_t = 4.2 - 0.5·9.8
F_t = -0.7N

Which is to say, we would not be able to lift a mass of 0.5kg with this motor.

Mystery

So, if this little hobby motor can’t even lift 500g (which is quite a lot, let’s be real) why do we still think it is any good? Can we afford to neglect the friction term in our equations? What about the friction inherent to the motor housing itself, have we considered that? There are a lot of questions here, some of which we can answer easily, other we can’t.

The easy question to answer, is what purpose this tiny motor serves. It is very easy to use, there are many tutorials on the interwebs for connecting it up to your Pi, Arduino, or other micro-computer, and it is cheap. There is something very gratifying about plugging some pins together, writing (or copying) a simple script, and seeing the motor start moving. This is a great place to start, getting kids, DIYers, hobbyists, you name it, into the idea that they can make things.

There are some mysteries still. Not really the friction questions – the answer there is that we should consider those numbers, they are just quite difficult to find and so it is easier to do the theoretical part without them. Essentially, we know that the system may be under powered, but horizontal movement on a low friction system will be easier than vertical movement. Far more interesting are the mysteries of “why does the spec sheet read τ ≥ 29.4mNm rather than =?” Or “all the explanations of running one of these is for a 5 wire motor, how do I run a 4 wire motor?” Or “this has a voltage rating, but not current, does it need 1A, 2A, 3A?”

I have yet to answer some of these mysteries. Mostly the one regarding the number of wires, and I don’t have the time to try and figure it out just yet (I may have to, but not today). I have theories regarding the the spec sheet and current rating though. This has to do with the way that motors work. The coil which generates the magnetic field will draw up to a certain amount of current, but if less is provided it will still draw. The amount of current will directly influence the strength of the field, and so whilst there is a minimum current required to generate the 29.4mNm of torque which makes the motor move, providing more current (at the required voltage) will cause the magnetic fields to be stronger, and as such raise the torque of the motor. Would it be enough to lift our 500g load? I don’t know.

Mastery (or is it misery?)

I mentioned that I might need to figure out the four wire motors. This is because the newer, more powerful (and more expensive) motors only have four wires. Rather than having a dedicated voltage wire, each coil is powered individually. It allows for a smoother rotation, and better stepping. It also allows for finer control over the torque. It also complicated the chip setup required to run the system.

So, for now, knowing that sufficient current will allow me to lift a load (in theory) of 400g. So, if I can reduce the friction in my project far enough, and can reduce any unnecessary mass from the system, I should be able to slide a bearing along a rail with this motor. If I can’t get it all moving the way I want, I will have to figure out four wire motors, and keep pushing onward. That would be the misery of the system.