A Little Extra About Electric Motors

1. Motors

Electric motors convert electricity into mechanical energy. Electric motors that use direct current are called DC motors. Almost all motors powered by batteries are DC motors. Electric motors have been around for a very long time. As early as the 1740s the Scottish Benedictine monk and scientist, Andrew Gordon, developed the first electric motor. Those early motors were interesting but not very useful. Since those early days, electric have been dramatically improved and many different types of electric motors have been invented.

The science behind an electric motor can be quite complex. A basic motor has magnets and coils of wire. Electric current is sent thru the coils of wire which interact with the magnets causing the spindle or shaft of the motor to spin. This is beacuse the flow of direct current thru the coils creates a force that is perpendicular to the magnetic field's direct and the current's direction. This force, called the Lorentz Force, can be calculted using the Lorentz Law.

This interaction between the magnetic field and the electrical field, i.e., the Lorentz Force, is what causes the motor's axle to turn. Torque is a measure of how strong the rotational force happens to be any particular time. The strength of the torque, i.e., the speed with which the motor's axle turns, can be controlled by adjusting the amount of current flowing thru the coils. Electric Motor

In the above diagram you can see two permanent magnets: N and S. Inside the magnets, there is the motors axle which is connected to arms with purple wire coiled around two arms. Power is provided to the coils via the "+" and "-" wires which should be connected to a power supply, usually a battery or something similar.

Electric motors can require a lot of power. Generally speaking, smaller motors require less power than large motors. The XRP only needs 4 AA batteries for its operation, including its motors. However, when designing your own robot you may need a secondary power source for your motors. It is usually good practice to isolate your motors from direct connection to your main CPU. For example, the XRP uses DRV8411A H-Bridge Motor Drivers to isolate the motors from direct connection to its CPU (the Raspberry Pi Pico). The RPI sends commands directly to the Motor Drivers which control the motors via the "+" and "-" power wires. Note that in the illustration, the power wires appear to be touching the orange contacts attached to the motor's axle. In an actual motor, the power wires would be attached to electrical brushes and the brushes would touch the orange contacts as the motor spun.

For simple projects, it is useful to understand the difference between the main types of motors used by hobbists: DC motors, Steppers and Servos.

1.1 DC Motors

These are usually simple (two wire), fast, continuous rotation motors. Provide power and they spin. Remove the power and they stop. Reverse polarity of the electric current and the motor spins in the opposite direction. They are used for anything that needs to spin continuously or at a high RPM e.g. radio controled car wheels, fans, etc. They can be very inexpensive. You may have read about "brush" and "brushless" motors. Brushless motors can be more efficient and have less wear over time, but they usually cost more money. For most hobby projects brushless motors are overkill.

Each XRP DC motor is paired with a gearbox to reduce its speed while increasing its torque (rotational force). One disadvantage of a gearbox is that it slightly reduces the precision of motor commands, depending on the manufacturing tolerances of the gearbox.

1.2 Servo Motors

Servo motors are designed for precise, linear positioning - up and down or left and right. They are fequently used as an alternative to stepper motors and are well suited for robotic arms/legs or rudder control etc. The XRP uses a servo to control it's simple mechanical arm.

1.3 Stepper Motors

Steppers provide precise control over rotation and they are usually easy to set up & control. They are well suited for 3D printers and similar devices where accurate positioning is essential.

The XRP does not have stepper motors. However, its DC motors have "encoders" hich make it possible to approximate the behavior of steppers. An encoder provides a means to measure the speed, position and direction of the motor.

For example, a simple DC motor controls its motion by turning on a off the power. It does not have a direct means to determine how far it has moved. Steppers move in "steps" which are a well defined fraction of 360 degrees. Often a stepper will be configured to take 200 steps to rotate the motor's axle 360 degrees. Adding an encoder to such a motor makes it possible for the XRP to "count the steps" of a DC motor.