Complete Motor Guide for Robotics
by taifur in Circuits > Robots
279117 Views, 2163 Favorites, 0 Comments
Complete Motor Guide for Robotics
Robot is an electromechanical device which is capable of reacting in some way to its environment, and take autonomous decisions or actions in order to achieve a specific task.
Roboticists develop man-made mechanical devices that can move by themselves, whose motion must be modelled, planned, sensed, actuated and controlled, and whose motion behavior can be influenced by “programming”.
This definition implies that a device can only be called a “robot” if it contains a movable mechanism, influenced by sensing, planning, actuation and control components. Motors and actuators are the devices which make the robot movable. Motors and actuators convert electrical energy into physical motion. The vast majority of actuators produce either rotational or linear motion.
In this instructables I will explain more common types of motors and actuators, their basics and how to control them.
Types of Motors
You already know that electric motors are used to “actuate” something in your robot: its wheels, legs, tracks, arms, fingers, sensor turrets, camera, or weapon systems. There are literally dozens of types of electric motors but I will discuss the most common types used in amateur robotics. Motors are classified as:
- AC motor
- Brushed DC motor
- Brushless DC motor
- Geared DC motor
- Servo motor
- Stepper motor
- DC Linear Actuator
AC (alternating current) motors are rarely used in mobile robots because most of the robots are powered with direct current (DC) coming from batteries. Also, since electronic components use DC, it is more convenient to have the same type of power supply for the actuators as well. AC motors are mainly used in industrial environments where very high torque is required, or where the motors are connected to the mains / wall outlet. So, I will not explain about AC motors here.
Motor Controller
A motor controller is an electronic device that helps microcontroller to control the motor. Motor controller acts as an intermediate device between a microcontroller, a power supply or batteries, and the motors.
Although the microcontroller (the robot’s brain) decides the speed and direction of the motors, it cannot drive them directly because of its very limited power (current and voltage) output. The motor controller, on the other hand, can provide the current at the required voltage but cannot decide how the motor should run.
Thus, the microcontroller and the motor controller have to work together in order to make the motors move appropriately. Usually, the microcontroller can instruct the motor controller on how to power the motors via a standard and simple communication method such as UART or PWM. Also, some motor controllers can be manually controlled by an analogue voltage (usually created with a potentiometer).
The physical size and weight of a motor controller can vary significantly, from a device smaller than the tip of your finger used to control a mini sumo robot to a large controller weighing several Kg. The size of a motor controller is usually related to the maximum current it can provide. Larger current means larger size.
Since there are several types of motors, there are several types of motor controllers (different type of motor requires different type of controller) :
- Brushed DC motor controllers: used with brushed DC, DC gear motors, and many linear actuators.
- Brushless DC motor controllers: used with brushless DC motors.
- Servo Motor Controllers: used for hobby servo motors.
- Stepper Motor Controllers: used with unipolar or bipolar stepper motors depending on their kind.
Brushed DC Motor
A brushed DC motor is one which uses two brushes to conduct current from source to armature. There are several variations on the brush DC motor, but permanent magnet DC motor (PMDC) is used extensively in robotics. Brushed DC motors are widely used in applications ranging from toys to push-button adjustable car seats. Brushed DC (BDC) motors are inexpensive, easy to drive, and are readily available in all sizes and shapes.
The brush DC Motor consists of six different components: the axle, armature/rotor, commutator, stator, magnets, and brushes. A Brush DC Motor consists of two magnets facing the same direction, that surrounding two coils of wire that reside in the middle of the Brush DC Motor, around a rotor. The coils are positioned to face the magnets, causing electricity to flow to them. This generates a magnetic field, which ultimately pushes the coils away from the magnets they are facing, and causes the rotor to turn.
The Brush DC Motor has two terminals; when voltage is applied across the two terminals, a proportional speed is outputted to the shaft of the Brush DC Motor. A Brush DC Motor consists of two pieces: the stator which includes the housing, permanent magnets, and brushes, and the rotor, which consists of the output shaft, windings and commutator. The Brush DC Motor stator is stationary, while the rotor rotates with respect to the Brush DC Motor stator.The stator generates a stationary magnetic field that surrounds the rotor. The rotor, also called the armature, is made up of one or more windings. When these windings are energized they produce a magnetic field. The magnetic poles of this rotor field will be attracted to the opposite poles generated by the stator, causing the rotor to turn. As the motor turns, the windings are constantly being energized in a different sequence so that the magnetic poles generated by the rotor do not overrun the poles generated in the stator. This switching of the field in the rotor windings is called commutation.
Unlike other electric motor types (i.e., brushless DC, AC induction), BDC motors do not require a controller to switch current in the motor windings. Instead, the commutation of the windings of a BDC motor is done mechanically. A segmented copper sleeve, called a commutator, resides on the axle of a BDC motor. As the motor turns, carbon brushes slide over the commutator, coming in contact with different segments of the commutator. The segments are attached to different rotor windings, therefore, a dynamic magnetic field is generated inside the motor when a voltage is applied across the brushes of the motor. It is important to note that the brushes and commutator are the parts of a BDC motor that are most prone to wear because they are sliding past each other.
Applications:
- Toys
- RC Servos
- Gear Motors
Advantages:
- Inexpensive
- Lightweight
- Reasonably Efficient
- Good low-speed torque
Limitations: In addition to the audible whine from the commutator brushes, these motors create a lot of electrical noise which can find its way back into other circuitry and cause problems.
Visit for DC motor: https://www.sparkfun.com/categories/247
Controlling of Brushed DC Motor
By the term controlling I mean both direction control and the speed control. The direction of the DC motor can be reverse by simply reversing the polarity of the battery connection. The speed of the motor can be control by changing the voltage level and dc voltage level can be changed by PWM signal. For higher voltage level speed will be higher and for lower voltage level speed will also be lower.
Practically, Drive circuits are used in applications where a controller of some kind is being used and speed control is required. The purpose of a drive circuit is to give the controller a way to vary the current in the windings of the BDC motor. The drive circuits discussed in this section allow the controller to pulse width modulate the voltage supplied to a BDC motor. It is more efficient way to vary the speed of a BDC motor compared to traditional analog control methods. In some cases the motor only needs to spin in one direction then a single switch topology with PWM modulation can be used to vary the voltage applied to the motor and thus to control its speed. The higher the PWM duty cycle, the faster the motor will go. Figure shows circuit for driving a BDC motor in one direction using single FET (field effect transistor).
Note that in the circuit there is a diode across the motor. This diode is there to prevent Back Electromag- netic Flux (BEMF) voltage from harming the MOSFET. BEMF is generated when the motor is spinning. When the MOSFET is turned off, the winding in the motor is still charged at this point and will produce reverse current flow. D1 must be rated appropriately so that it will dissipate this current.
Resistors R1 and R2 in the Figure are important to the operation of the circuit. R1 protects the microcontroller from current spikes while R2 ensures that transistor is turned off when the input pin is tristated.
When positioning is required or when both directions of rotation are needed (most robots need) a full H-bridge with PWM control is used. The H-Bridge is a 4-transistor circuit that allows you to reverse the current flow to the motor. With an H-Bridge and a PWM pin, you can control both the speed and direction of the motor.
To understand please follow the next step.
H Bridge
A H bridge is an electronic circuit that enables a voltage to be applied across a load in either direction. These circuits are often used in robotics and other applications to allow DC motors to run forwards and backwards.
An H-bridge is a transistor-based circuit capable of driving motors both clockwise and counter-clockwise. It’s an incredibly popular circuit – the driving force behind countless robots that must be able to move both forward and backward. Fundamentally, an H-bridge is a combination of four transistors with two inputs lines and two outputs:(Note: there’s usually quite a bit more to a well-designed H-bridge including flyback diodes, base resistors and Schmidt triggers.)
To understand this, the H-bridge must be broken into its two sides, or half-bridges. Referring to Q1 and Q2 make up one half-bridge while Q3 and Q4 make up the other half-bridge.
Each of these half-bridges is able to switch one side of the BDC motor to the potential of the supply voltage or ground. When Q1 is turned on and Q2 is off, for instance, the left side of the motor will be at the potential of the supply voltage. Turning on Q4 and leaving Q3 off will ground the opposite side of the motor. The switching elements (Q1..Q4) are usually bi-polar or FET transistors, in some high-voltage applications IGBTs.
Note the diodes across each of the transistor (D1-D4).
These diodes protect the transistors from current spikes generated by BEMF when the transistors are switched off. The top-end of the bridge is connected to a power supply (battery for example) and the bottom-end is grounded.
A capacitor can be used with parallel to the diode. But it is optional. The value of these capacitors is generally in the 10 pF range. The purpose of these capacitors is to reduce the RF radiation that is produced by the arching of the commutators.
The basic operating mode of an H-bridge is fairly simple: if Q1 and Q4 are turned on, the left lead of the motor will be connected to the power supply, while the right lead is connected to ground. Current starts flowing through the motor which energizes the motor in (let’s say) the forward direction and the motor shaft starts spinning.
..............................................................................................................
If Q2 and Q3 are turned on, the reverse will happen, the motor gets energized in the reverse direction, and the shaft will start spinning backwards.
.............................................................................................................................................................................................
In a bridge, you should never ever close both Q1 and Q2 (or Q3 and Q4) at the same time. If you did that, you just have created a really low-resistance path between power and GND, effectively short-circuiting your power supply. This condition is called ‘shoot-through’ and is an almost guaranteed way to quickly destroy your bridge, or something else in your circuit.
There are many different models and brands of H-Bridge IC is available. Most commonly used are Texas Instruments L293NE or a Texas Instruments SN754410 and L298 from STMicroelectronics.
L293D
The L293NE/SN754410 is a very basic H-bridge. It has two bridges, one on the left side of the chip and one on the right, and can control 2 motors. It can drive up to 1 amp of current, and operate between 4.5V and 36V. The small DC motor generally used in robot bots can run safely off a low voltage so this H-bridge will work just fine.
The H-bridge has the following pins and features:
- Pin 1 (1,2EN) enables and disables our motor whether it is give HIGH or LOW
- Pin 2 (1A) is a logic pin for our motor (input is either HIGH or LOW)
- Pin 3 (1Y) is for one of the motor terminals
- Pin 4-5 are for ground
- Pin 6 (2Y) is for the other motor terminal
- Pin 7 (2A) is a logic pin for our motor (input is either HIGH or LOW)
- Pin 8 (VCC2) is the power supply for our motor, this should be given the rated voltage of your motor
- Pin 9-11 are unconnected as you are only using one motor in this lab
- Pin 12-13 are for ground
- Pin 14-15 are unconnected
- Pin 16 (VCC1) is connected to 5V Below is a diagram of the H-bridge and which pins do what in our example.
- Included with the diagram is a truth table indicating how the motor will function according to the state of the logic pins (which are set by our Arduino).
Bear in mind that all motors are available in different sizes.
Small motors are engineered for applications where compactness is valued over torque. While there are small high-torque motors, these tend to be expensive because they use rare earth magnets, high efficiency bearings, and other features that add to their cost.Large motors may produce more torque, but also require higher currents. High current motors require larger capacity batteries, and bigger control circuits that won’t overheat and burn out under the load. Therefore, match the size of the motor with the rest of the robot. Don’t overload a small robot with a large motor when big size isn’t important.When decided on the size of the motor, compare available torque after any gear reduction. Gear reduction always increases torque. The increase in torque is proportional to the amount of gear reduction: if the reduction is 3:1, the torque is increased by about three times (but not quite, because of frictional losses).
For H-bridge IC and module please visit :
Arduino DC Motor Control
As you already know DC motor must not connect directly to arduino pin because it can burn your arduino. So you must connect a transistor between arduino and motor. Let's first control a small DC motor using single transistor. Using single transistor you know only speed can be control. PWM is used to control speed of a DC motor. Connect your circuit as Figure-1. Arduino PWM pin must be connected to the base pin of transistor.
/* Single transistor DC Motor control */ int motorPin = 3; int speed = 100; void setup() { pinMode(motorPin, OUTPUT); } void loop() { // analogWrite() function is used to generate PWM signal. // speed define the duty cycle of the PWM. // if the speed = 0 means duty cycle is 0 and motor is off // the maximum value of speed can be 255, then motor will run with maximum speed analogWrite(motorPin, speed); delay(1000); // wait 1 sec analogWrite(motorPin, 175); delay(1000); analogWrite(motorPin, 255); // maximum speed delay(1000); }
Now, connect the motor using H-Bridge IC (I used L293 here). Follow Fig-3 & Fig-4. We can control both speed and direction now. Pin 9 is used as PWM pin and a switch is added to control the speed.
const int switchPin = 2; // switch input const int motor1Pin = 3; // H-bridge leg 1 (pin 2, 1A) const int motor2Pin = 4; // H-bridge leg 2 (pin 7, 2A) const int enablePin = 9; // H-bridge enable pin //In the setup(), set all the pins for the H-bridge as outputs, //and the pin for the switch as an input. The set the enable pin high //so the H-bridge can turn the motor on. void setup() { // set the switch as an input: pinMode(switchPin, INPUT); // set all the other pins you're using as outputs: pinMode(motor1Pin, OUTPUT); pinMode(motor2Pin, OUTPUT); pinMode(enablePin, OUTPUT); pinMode(ledPin, OUTPUT); // set enablePin high so that motor can turn on: digitalWrite(enablePin, HIGH); } //In the main loop() read the switch. If it’s high, //turn the motor one way by taking one H-bridge pin high and the other low. // If the switch is low, reverse the direction by reversing the states of // the two H-bridge pins. void loop() { // if the switch is high, motor will turn on one direction: if (digitalRead(switchPin) == HIGH) { digitalWrite(motor1Pin, LOW); // set leg 1 of the H-bridge low digitalWrite(motor2Pin, HIGH); // set leg 2 of the H-bridge high } // if the switch is low, motor will turn in the other direction: else { digitalWrite(motor1Pin, HIGH); // set leg 1 of the H-bridge high digitalWrite(motor2Pin, LOW); // set leg 2 of the H-bridge low } }
L293 is a dual H bridge IC. So, you can control two motor by single IC. Connect two motor to the IC as like figure 5 and use the following code. Make modification according to your requirement.
/* * created by Md. Khairul Alam * Control 2 DC motors with arduino * 2015 */ int motor1Pin1 = 3; // pin 2 on L293D IC int motor1Pin2 = 4; // pin 7 on L293D IC int motor1EnablePin = 6; // pin 1 on L293D IC int motor2Pin1 = 8; // pin 10 on L293D IC int motor2Pin2 = 9; // pin 15 on L293D IC int motor2EnablePin = 11; // pin 9 on L293D IC int Speed = 100; void setup() { // sets the pins as outputs: pinMode(motor1Pin1, OUTPUT); pinMode(motor1Pin2, OUTPUT); pinMode(motor1EnablePin, OUTPUT); pinMode(motor2Pin1, OUTPUT); pinMode(motor2Pin2, OUTPUT); pinMode(motor2EnablePin, OUTPUT); // sets enable1Pin and enable2Pin high so that motor can turn on: //digitalWrite(Motor1EnablePin, HIGH); //digitalWrite(Motor2EnablePin, HIGH); // initialize serial communication at 9600 bits per second: Serial.begin(9600); } void loop() { //write your code here } void forword(){ // run two motor in forward direction digitalWrite(motor1Pin1, HIGH); digitalWrite(motor1Pin2, LOW); digitalWrite(motor2Pin1, LOW); digitalWrite(motor2Pin2, HIGH); analogWrite(motor1EnablePin, Speed); analogWrite(motor2EnablePin, Speed); //Serial.println("Go Forward!"); } void backword(){ // run two motor in reverse direction digitalWrite(motor1Pin1, LOW); digitalWrite(motor1Pin2, HIGH); digitalWrite(motor2Pin1, HIGH); digitalWrite(motor2Pin2, LOW); analogWrite(motor1EnablePin, Speed); analogWrite(motor2EnablePin, Speed); //Serial.println("Go Reverse!"); } void turnRight(){ // motor 1 off, motor 2 forward digitalWrite(motor1Pin1, LOW); digitalWrite(motor1Pin2, LOW); digitalWrite(motor2Pin1, LOW); digitalWrite(motor2Pin2, HIGH); analogWrite(motor1EnablePin, Speed); analogWrite(motor2EnablePin, Speed); //Serial.println("Turn Right"); } void turnLeft(){ // motor 2 off, motor 1 forward digitalWrite(motor1Pin1, HIGH); digitalWrite(motor1Pin2, LOW); digitalWrite(motor2Pin1, LOW); digitalWrite(motor2Pin2, LOW); analogWrite(motor1EnablePin, Speed); analogWrite(motor2EnablePin, Speed); //Serial.println("Turn Left"); } void Stop(){ two motor off digitalWrite(motor1Pin1, LOW); digitalWrite(motor1Pin2, LOW); digitalWrite(motor2Pin1, LOW); digitalWrite(motor2Pin2, LOW); analogWrite(motor1EnablePin, Speed); analogWrite(motor2EnablePin, Speed); //Serial.println("Stop"); }
.
DC Gear Motor
Geared DC motors can be defined as an extension of DC motor which already had its Insight details demystified before. A geared DC Motor has a gear assembly attached to the motor. The speed of motor is counted in terms of rotations of the shaft per minute and is termed as RPM .The gear assembly helps in increasing the torque and reducing the speed. Using the correct combination of gears in a gear motor, its speed can be reduced to any desirable figure. This concept where gears reduce the speed of the vehicle but increase its torque is known as gear reduction. This Insight will explore all the minor and major details that make the gear head and hence the working of geared DC motor.
Working of the DC Geared Motor
The DC motor works over a fair range of voltage. The higher the input voltage more is the RPM (rotations per minute) of the motor. For example, if the motor works in the range of 6-12V, it will have the least RPM at 6V and maximum at 12 V. In terms of voltage, we can put the equation as: RPM= K1 * V, where, K1= induced voltage constant V=voltage applied.
The working of the gears is very interesting to know. It can be explained by the principle of conservation of angular momentum. The gear having smaller radius will cover more RPM than the one with larger radius. However, the larger gear will give more torque to the smaller gear than vice versa. The comparison of angular velocity between input gear (the one that transfers energy) to output gear gives the gear ratio. When multiple gears are connected together, conservation of energy is also followed. The direction in which the other gear rotates is always the opposite of the gear adjacent to it. In any DC motor, RPM and torque are inversely proportional. Hence the gear having more torque will provide a lesser RPM and converse. In a geared DC motor, the concept of pulse width modulation is applied.
For example, an unloaded DC motor might spin at 12000 rpm and provide 0.1 kg-cm of torque. A 225:1 geardown is added to proportionally reduce the speed and increase the torque: 12000 rpm / 225 = 53.3 rpm and 0.1 x 225 = 22.5 kg-cm. The motor will now be able to move significantly more weight at a more reasonable speed.
In a geared DC motor, the gear connecting the motor and the gear head is quite small, hence it transfers more speed to the larger teeth part of the gear head and makes it rotate. The larger part of the gear further turns the smaller duplex part. The small duplex part receives the torque but not the speed from its predecessor which it transfers to larger part of other gear and so on. The third gear’s duplex part has more teeth than others and hence it transfers more torque to the gear that is connected to the shaft.
Controlling of Geared Motor
DC gear motor can be controlled exactly the same way DC motor control.
Applications:
- Robot Drive Trains
- Radio Control Vehicles
- Cordless Tools
Advantages:
- Speed Reduction - Many DC motors simply run too fast to be useful in direct-drive applications.
- Increased Torque - A lot of work can be coaxed from a relatively small motor if fitted with a suitable gear train.
Limitations: This is especially a problem with low-cost plastic gear trains used with low-voltage motors. The extra resistance can make these gear-trains balky at low speeds.
For Controller & Motor browse: www.sparkfun.com
Brushless DC Motor
Brushless DC (BLDC) motors are called by many names: brushless permanent magnet, permanent magnet ac motors, permanent magnet synchronous motors etc. The confusion arises because a brushless dc motor does not directly operate from a dc voltage source. However, as we shall see, the basic principle of operation is similar to a dc motor.
A BLDC has a rotor with permanent magnets and a stator with windings. It is essentially a dc motor turned inside out. The brushes and commutator have been eliminated and the windings are connected to the control electronics. The control electronics replace the function of the commutator and energize the proper winding. As shown in the animation, the winding are energized in a pattern which rotates around the stator. The energized stator winding leads the rotor magnet, and switches just as the rotor aligns with the stator. There are no sparks, which is one advantage of the BLDC motor.
The brushes of a dc motor have several limitations; brush life, brush residue, maximum speed, and electrical noise. BLDC motors are potentially cleaner, faster, more efficient, less noisy and more reliable. However, the BLDC motor requires electronic control.
Then the construction of a brushless DC motor is very similar to the AC motor making it a true synchronous motor but one disadvantage is that it is more expensive than an equivalent “brushed” motor design.
Inrunners vs Outrunners
There are two types of Brushless RC motors, inrunners and outrunners.
The permanent magnets of inrunner brushless motors are positioned on the inside of the electromagnets. An outrunner brushless motor has the permanent magnets on the outside of the electromagnets.
The faster a motor spins, the more efficient it is. Inrunner motors turn very fast and are much more efficient than outrunner motors. Inrunner Brushless RC Motors require a speed reducing gearbox between the motor and propeller of your RC airplane.
The downside of an inrunner is the added parts that can and do fail. The gears get stripped, and the gearbox shafts are easily bent. It can also be an obstacle when mounting the gearbox motor combination for your RC airplane neatly, especially under a cowling.
Theory of Operation
The mechanics of a brushless motor are incredibly simple. The only moving part is the the rotor, which contains the magnets. Where things become complicated is orchestrating the sequence of energizing windings. The polarity of each winding is controlled by the direction of current flow. The animation demonstrates a simple pattern that controllers would follow. Alternating current changes the polarity, giving each winding a “push/pull” effect. The trick is keeping this pattern in sync with the speed of the rotor. There are two (widely used) ways this can be accomplished. Most hobby controllers measure the voltage produced (back EMI) on the un-energized winding. This method is very reliable in high velocity operation. As the motor rotates slower, the voltage produced becomes more difficult to measure and more errors are induced. Newer hobby controllers and many industrial controllers utilize Hall effect sensors to measure the magnets position directly. This is the primary method for controlling computer fans.
Control
The control of the brushless DC motors is very different from the normal brushed DC motor, in that it this type of motor incorporates some means to detect the rotors angular position (or magnetic poles) required to produce the feedback signals required to control the semiconductor switching devices. The most common position/pole sensor is the “Hall Effect Sensor”, but some motors also use optical sensors. Using Hall effect sensors, the polarity of the electromagnets is switched by the motor control drive circuitry. Then the motor can be easily synchronized to a digital clock signal, providing precise speed control. Brushless DC motors can be constructed to have, an external permanent magnet rotor and an internal electromagnet stator or an internal permanent magnet rotor and an external electromagnet stator.
In figure 4 (A), the GREEN winding labeled “001” is energized as the NORTH pole and the BLUE winding labeled as “010” is energized as the SOUTH pole. Because of this excitation, the SOUTH pole of the rotor aligns with the GREEN winding and the NORTH pole aligns with the RED winding labeled “100”. In order to move the rotor, the “RED” and “BLUE” windings are energized in the direction shown in figure 4(B). This causes the RED winding to become the NORTH pole and the BLUE winding to become the SOUTH pole. This shifting of the magnetic field in the stator produces torque because of the development of repulsion (Red winding – NORTH-NORTH alignment) and attraction forces (BLUE winding – NORTH-SOUTH alignment), which moves the rotor in the clockwise direction.
Speed Control
Brushless dc motor are actually three phase ac motors. To controll the speed an electronic speed control or ESC is used. Brushless ESC systems basically create a tri-phase AC power output of limited voltage from an onboard DC power input, to run brushless motors by sending a sequence of AC signals generated from the ESC's circuitry, employing a very low impedance for rotation. Brushless motors, otherwise called outrunners or inrunners depending on their physical configuration, have become very popular with "electroflight" radio-control aeromodeling hobbyists because of their efficiency, power, longevity and light weight in comparison to traditional brushed motors. However, brushless AC motor controllers are much more complicated than brushed motor controllers.
The correct phase varies with the motor rotation, which is to be taken into account by the ESC: Usually, back EMF from the motor is used to detect this rotation, but variations exist that use magnetic (Hall Effect) or optical detectors. Computer-programmable speed controls generally have user-specified options which allow setting low voltage cut-off limits, timing, acceleration, braking and direction of rotation. Reversing the motor's direction may also be accomplished by switching any two of the three leads from the ESC to the motor.
Current Rating of ESC
An ESC will have a power limit. To handle more power, the ESC needs to be larger, heavier, and is more expensive. It’s important to know the peak current your motor is going to pull at full throttle. This determines the current rating you should look for in an ESC. Always choose an ESC with a current rating that is higher than what you need. If the motor is going to pull 12A, a 25A-rated ESC is a much better choice than a 10A-rated one. The 10A ESC will probably overheat and cook, even if you only fly at half throttle. ESCs are relatively light and maintain great resale value, so this is one item in your power system where skimping isn’t worth while. Choosing the correct type and identifying the minimum current rating are the two big steps. The next choices depend on your preferences.
Voltage Rating
All ESCs have voltage limits. Some even have more than one! What is your battery voltage? Choose an ESC that is designed to work with an equal or higher voltage. Some ESCs are designed for low voltages (below 13V), some for medium voltages (below 25V), and some for high voltages (above 25V). You shouldn’t connect a high voltage battery to a low voltage ESC, but it is also wasteful to use a high voltage ESC with a low voltage battery.
Advantages
Advantages of the Brushless DC Motor compared to its “brushed” cousin is higher efficiencies, high reliability, low electrical noise, good speed control and more importantly, no brushes or commutator to wear out producing a much higher speed. However their disadvantage is that they are more expensive and more complicated to control.
Arduino Control
Brushless motors designed for autonomous and remote control aircraft and vehicles typically require a separate controller. These are typically of the sensorless type and use standard servo type pulsed signals for speed control.
Controlling BLDC motor is very easy. Most of the ESCs need a 50Hz frequency i.e. a 20 ms cycle and the speed depends upon the duty cycle you provide. 1ms will reduce its speed to minimum or even stop it (it depend upon the ESC model) while a 2ms pulse will run the motor on its fullest speed. The values between them give you a variation in speed.
Usually ESCs need a voltage higher than the one provided by the Arduino from his 5V pin: typically they need 2 LiPo cells (around 8V). To achieve that all the circuit must be powered from an external power supply connected directly to the ESC and not via the Arduino, which will be powered by the BEC circuit of the ESC. To make that happen it’s enough to connect the red and black of the control connector to the 5V and GDN of the Arduino board.
The rest of the circuit is pretty easy: from pin 9 of the Arduino we have the signal for the ESC, and into pin 0, the voltage reading from the potentiometer comes in.
Sometimes ESC needs calibration and in terms of ESCs, calibration means to set the max and min speeds of
the motor in relation to the max and min width of the PWM signal sent by the Arduino. The PWM signal read by the ESC is the same type as a servo signal, meaning the Servo library from Adruino can be used to calibrate and control the ESCs. The ESC sets the speed of the motor depending on the ratio of high to low signals. Calibration involves programming the ESC to understand the PWM waves corresponding to the stop and maximum speeds of the motor.
The default signal range for most servo motors and ESCs is a high signal width between 1000 and 2000 microseconds over a repetition period of 20 milliseconds (assuming a 50hz PWM signal). For the quad copter, however, we want the range to be as wide as possible to allow for greater incremental control of the motor. To this end, we calibrated the ESCs to read a signal width from 700 to 2000 microseconds with 700 being the stop speed and 2000 being the max speed. Some ESC could not read a signal lower than 700 microseconds.
Calibrating the ESCs is quite simple. To enter programming mode, the maximum servo signal (2000 microseconds) is sent to the ESC, the ESC is powered on and waits for two seconds, then the minimum servo signal is sent (700 microseconds). Once the ESC emits a series of confirmation beeps (special wave signals sent to the motor to emit beeping sounds), the ESC is calibrated (check the ESC specific datasheet for details).
// For calibrating you may use the following code snipet #include <Servo.h> #define MAX_SIGNAL 2000 #define MIN_SIGNAL 700 #define MOTOR_PIN 9 Servo motor; void setup() { Serial.begin(9600); Serial.println("Program begin..."); Serial.println("This program will calibrate the ESC."); motor.attach(MOTOR_PIN); Serial.println("Now writing maximum output."); Serial.println("Turn on power source, then wait 2 seconds and press any key."); motor.writeMicroseconds(MAX_SIGNAL); // Wait for input while (!Serial.available()); Serial.read(); // Send min output Serial.println("Sending minimum output"); motor.writeMicroseconds(MIN_SIGNAL); } void loop() { } // For controlling you may use the following code #include <Servo.h> // include servo library Servo esc; int throttlePin = 0; void setup() { esc.attach(9); } void loop() { int throttle = analogRead(throttlePin); // read from pot throttle = map(throttle, 0, 1023, 0, 179); esc.write(throttle); // throttle value define the speed of esc }
It just takes the reading of the “throttle”, maps it from 0-1023 to 0-179 (analog reading to servo “degrees”) and then sends it to the ESC via the Servo library. Even in its extreme simplicity this sketch it very useful when you want to calibrate a new ESC to work with the Servo library of Arduino.
Applications:
- Multicopters
- Drones
- Radio Control Vehicles
- Disk Drives
- Fans
- Industrial Servos
- Hybrid Vehicles
- High-End Gearmotors
Advantages:
- Quiet
- Efficient
Limitations: Some types of brushless motors require a separate controller for operation.
For brushless DC motor visit https://www.sparkfun.com/categories/245
Servo Motor
A servo motor is an electrical device which can push or rotate an object with great precision. If you want to rotate and object at some specific angles or distance, then you use servo motor. It is just made up of simple motor which run through servo mechanism. If motor is used is DC powered then it is called DC servo motor, and if it is AC powered motor then it is called AC servo motor. We can get a very high torque servo motor in a small and light weight packages. Doe to these features they are being used in many applications like toy car, RC helicopters and planes, Robotics, Machine etc. The position of a servo motor is decided by electrical pulse and its circuitry is placed beside the motor.
Now day’s servo system has huge industrial applications. Servo motor applications are also commonly seen in remote controlled toy cars for controlling direction of motion and it is also very commonly used as the motor which moves the tray of a CD or DVD player. Beside these there are other hundreds of servo motor applications we see in our daily life. The main reason behind using a servo is that it provides angular precision, i.e. it will only rotate as much we want and then stop and wait for next signal to take further action. This is unlike a normal electrical motor which starts rotating as and when power is applied to it and the rotation continues until we switch off the power. We cannot control the rotational progress of electrical motor; but we can only control the speed of rotation and can turn it ON and OFF.
Servo Mechanism
It consists of three parts:
- Controlled device
- Output sensor
- Feedback system
It is a closed loop system where it uses positive feedback system to control motion and final position of the shaft. Here the device is controlled by a feedback signal generated by comparing output signal and reference input signal.
Here reference input signal is compared to reference output signal and the third signal is produces by feedback system. And this third signal acts as input signal to control device. This signal is present as long as feedback signal is generated or there is difference between reference input signal and reference output signal. So the main task of servomechanism is to maintain output of a system at desired value at presence of noises.
Working principle of Servo Motors
A servo consists of a Motor (DC or AC), a potentiometer, gear assembly and a controlling circuit. First of all we use gear assembly to reduce RPM and to increase torque of motor. Say at initial position of servo motor shaft, the position of the potentiometer knob is such that there is no electrical signal generated at the output port of the potentiometer. Now an electrical signal is given to another input terminal of the error detector amplifier. Now difference between these two signals, one comes from potentiometer and another comes from other source, will be processed in feedback mechanism and output will be provided in term of error signal. This error signal acts as the input for motor and motor starts rotating. Now motor shaft is connected with potentiometer and as motor rotates so the potentiometer and it will generate a signal. So as the potentiometer’s angular position changes, its output feedback signal changes. After sometime the position of potentiometer reaches at a position that the output of potentiometer is same as external signal provided. At this condition, there will be no output signal from the amplifier to the motor input as there is no difference between external applied signal and the signal generated at potentiometer, and in this situation motor stops rotating.
Controlling Servo Motor:
Servo motor is controlled by PWM (Pulse with Modulation) which is provided by the control wires. There is a minimum pulse, a maximum pulse and a repetition rate. Servo motor can turn 90 degree from either direction form its neutral position. The servo motor expects to see a pulse every 20 milliseconds (ms) and the length of the pulse will determine how far the motor turns. For example, a 1.5ms pulse will make the motor turn to the 90° position, such as if pulse is shorter than 1.5ms shaft moves to 0° and if it is longer than 1.5ms than it will turn the servo to 180°. Servo motor works on PWM (Pulse width modulation) principle, means its angle of rotation is controlled by the duration of applied pulse to its Control PIN. Basically servo motor is made up of DC motor which is controlled by a variable resistor (potentiometer) and some gears. High speed force of DC motor is converted into torque by Gears. We know that WORK= FORCE X DISTANCE, in DC motor Force is less and distance (speed) is high and in Servo, force is High and distance is less. Potentiometer is connected to the output shaft of the Servo, to calculate the angle and stop the DC motor on required angle.
To recap, there are two important differences between the control pulse of the servo motor versus the DC motor. First, on the servo motor, duty cycle (on-time vs. off-time) has no meaning whatsoever—all that matters is the absolute duration of the positive-going pulse, which corresponds to a commanded output position of the servo shaft. Second, the servo has its own power electronics, so very little power flows over the control signal. All power is draw from its power lead, which must be simply hooked up to a high-current source of 5 volts.
Continuous Rotation Servo Motors
Continuous rotation servo motors are actually a modified version of what the servos are actually meant to do, that is, control the shaft position. The 360° rotation servos are actually made by changing certain mechanical connections inside the servo. However, certain manufacturer like parallax sells these servos as well. With the continuous rotation servo you can only control the direction and speed of the servo, but not the position.
Arduino Servo Control
Servo motors have three wires: power, ground, and signal. The power wire is typically red, and should be connected to the 5V pin on the Arduino or Genuino board. The ground wire is typically black or brown and should be connected to a ground pin on the board. The signal pin is typically yellow, orange or white and should be connected to pin 9 on the board.
Code
#include <Servo.h> Servo myServo; // create servo object to control a servo // twelve servo objects can be created on most boards int pos = 0; // variable to store the servo position void setup() { myServo.attach(9); // attaches the servo on pin 9 to the servo object } void loop() { for (pos = 0; pos <= 180; pos += 1) { // goes from 0 degrees to 180 degrees // in steps of 1 degree myservo.write(pos); // tell servo to go to position in variable 'pos' delay(15); // waits 15ms for the servo to reach the position } for (pos = 180; pos >= 0; pos -= 1) { // goes from 180 degrees to 0 degrees myservo.write(pos); // tell servo to go to position in variable 'pos' delay(15); // waits 15ms for the servo to reach the position } }
Applications:
- Robotics
- Animatronics
- Radio Control Cars/Boats/Planes
Advantages:
- Low cost - (RC Servos) Smaller sized servos can be purchased for just a few dollars.
- Variety - There is a wide range of sizes and torque ratings
- Simple to control - using logic level pulses from a microcontroller or a dedicated servo controller
Limitations: Most RC servos are limited to 180 degrees of motion and positioning accuracy and repeatability of +/- 1 degree is typical.
You can find different types of Servo motor at Sparkfun.com
Stepper Motor
A stepper motor is an electromechanical device which converts electrical pulses into discrete mechanical movements. The shaft or spindle of a stepper motor rotates in discrete step increments when electrical command pulses are applied to it in the proper sequence. The motors rotation has several direct relationships to these applied input pulses. The sequence of the applied pulses is directly related to the direction of motor shafts rotation. The speed of the motor shafts rotation is directly related to the frequency of the input pulses and the length of rotation is directly related to the number of input pulses applied.
Stepper motors are great motors for position control. They can be found in desktop printers, plotters, 3d printers, CNC milling machines, and anything else requiring precise position control. Steppers are a special segment of brushless motors. They are purposely built for high-holding torque. This high-holding torque gives the user the ability to incrementally “step” to the next position. This results in a simple positioning system that doesn’t require an encoder. This makes stepper motor controllers very simple to build and use.
One of the most significant advantages of a stepper motor is its ability to be accurately controlled in an open loop system. Open loop control means no feedback information about position is needed. This type of control eliminates the need for expensive sensing and feedback devices such as optical encoders. Your position is known simply by keeping track of the input step pulses.
What are stepper motors good for?
A stepper motor can be a good choice whenever controlled movement is required. They can be used to advantage in applications where you need to control rotation angle, speed, position and synchronism.
Positioning – Since steppers move in precise repeatable steps, they excel in applications requiring precise positioning such as 3D printers, CNC, Camera platforms and X,Y Plotters. Some disk drives also use stepper motors to position the read/write head.
Speed Control – Precise increments of movement also allow for excellent control of rotational speed for process automation and robotics.
Low Speed Torque - Normal DC motors don't have very much torque at low speeds. A Stepper motor has maximum torque at low speeds, so they are a good choice for applications requiring low speed with high precision.
Theory of Operation
Stepper motors behave exactly the same as a brushless motor, only the step size is much smaller. The only moving part is the the rotor, which contains the magnets. Where things become complicated is orchestrating the sequence of energizing windings. The polarity of each winding is controlled by the direction of current flow. The animation demonstrates a simple pattern that controllers would follow. Alternating current changes the polarity, giving each winding a “push/pull” effect. A notable difference is how the magnet structure of a stepper is different. It is difficult to get an array of magnets to behave nicely on a small scale. It’s also very expensive. To get around this, most stepper motors utilize a stacked plate method to direct the magnetic poles into “teeth”.
There are two types of stepper motors: unipolar and bipolar stepper motors. On a fundamental level, these two types work exactly the same way; electromagnets are turned on in a sequential fashion, inducing the central motor shaft to spin.
The difference between the two types is the voltage levels. A unipolar stepper motor only operates with positive voltage, so the high and low voltages applied to the electromagnetic coils would be something like 5V and 0V. A bipolar stepper motor has two polarities, positive and negative, so its high and low voltages would be something like 2.5V and -2.5V. Taking these electrical differences into account, the physical difference between these two styles is that the unipolar configuration requires an extra wire in the middle of each coil to allow current to flow through either to one end of the coil or the other. These two opposite directions produce the two polarities of the magnetic field, effectively mimicking the positive and negative voltage capabilities of the bipolar stepper motor. Although both of these have a overall voltage range of 5V, the bipolar stepper motor will actually have more torque because current flows the entire coil, producing a stronger magnetic field to induce the shaft to rotate to the appropriate angle. On the other hand, unipolar stepper motors only utilize half of the coil length due to the extra wire in the middle of the coil, so less torque is available to magnetically hold the shaft in place.
A two phase bipolar motor has 2 groups of coils. A 4 phase unipolar motor has 4. A 2-phase bipolar motor will have 4 wires - 2 for each phase. Some motors come with flexible wiring that allows you to run the motor as either bipolar or unipolar.
Driving a Stepper
Driving a stepper motor is a bit more complicated than driving a regular brushed DC motor. Stepper motors require a stepper controller to energize the phases in a timely sequence to make the motor turn.
There are several different ways that stepper motors are able to be driven including full step, half step, and microstepping. Each of these driving styles offer different amounts of torque and step sizes that the stepper motor can use.
A full step drive always has two of the electromagnets "turned on". To rotate the central shaft, one of the electromagnets gets turned off and the next electromagnet is turned on, causing the shaft to rotate 1/4 of a tooth (at least for hybrid stepper motors). This style of always having two electromagnets on has the most torque out of all of the styles, but the largest step size. A half step drive alternates between having two electromagnets and just one electromagnet turned on. To rotate the central shaft, the first electromagnet is energized as the first step, then the second one is also energized while the first one is still powered for the second step. The third step turns off first electromagnet and the fourth step turns on the third electromagnet, all while the second electromagnet is still powered. This pattern, shown in a picture above, uses twice as many steps as the full step drive, allowing for half of the step size, but it also has less overall torque since there are not always two electromagnets holding the central shaft in place. Microstepping, not surprisingly, has the smallest possible step size out of these styles. One of the most common ways to peform microstepping is to do "sine cosine microstepping". This means that the current flowing through each coil is manipulated such that a sine/cosine wave is created. The "overlap" of the waves between two coils results in a large number of substeps. The actual number of substeps is dependent on how many distinct changes in current you can provide to the coils, but microstepping will still have the smallest step sizes, and thus the most precise movement, out of all of the styles. The torque associated with this style is dependent on how much current is flowing through the coils at a particular time, but will always be less than the full step drive.
The simplest type of driver can be built with a handful of transistors. These are simply switched on and off in sequence to energize the phases and step the motor. Unipolar drivers are relatively inexpensive to build, but only work with unipolar motors. There is an excellent tutorial on how to build one at the Arduino site.
Driving a bipolar motor requires 2 full H-bridges so it can reverse the current to the phases. H-bridges can be tricky to build from scratch. But there are plenty of H-bridge chips available to simplify the task.The L293D is one of the most popular and economical chips. These can be found at the heart of most first-generation motor shields.
Following code snippet can be used to control stepper motor using arduino board.
// Global variables int timeDelay = 3000; void setup(){ // declaring the four pins to be outputs pinMode(34, OUTPUT); pinMode(32, OUTPUT); pinMode(30, OUTPUT); pinMode(28, OUTPUT); // setting the inital state of the electromagnets digitalWrite(34, HIGH); digitalWrite(32, LOW); digitalWrite(30, LOW); digitalWrite(28, HIGH); delay(10); // a small time delay to allow the motor to move }// end of setup void loop(){ for(int i=0; i<202; i++){ // looping through this chunk of code for ~ a full rotation digitalWrite(30, LOW); digitalWrite(34, HIGH); delayMicroseconds(timeDelay); digitalWrite(28, LOW); digitalWrite(32, HIGH); delayMicroseconds(timeDelay); digitalWrite(34, LOW); digitalWrite(30, HIGH); delayMicroseconds(timeDelay); digitalWrite(32, LOW); digitalWrite(28, HIGH); delayMicroseconds(timeDelay); }// end of looping // preparing the electromagnets to go the other direction digitalWrite(32, HIGH); digitalWrite(28, LOW); delayMicroseconds(timeDelay*500); for(int j=0; j<204; j++){ // looping through this chunk of code for ~ a full rotation in the other direction digitalWrite(30, LOW); digitalWrite(34, HIGH); delayMicroseconds(timeDelay); digitalWrite(28, HIGH); digitalWrite(32, LOW); delayMicroseconds(timeDelay); digitalWrite(34, LOW); digitalWrite(30, HIGH); delayMicroseconds(timeDelay); digitalWrite(32, HIGH); digitalWrite(28, LOW); delayMicroseconds(timeDelay); }// end of looping // preparing the electromagnets to go the other direction digitalWrite(32, LOW); digitalWrite(28, HIGH); delayMicroseconds(timeDelay*500); }//end of loop
Applications:
- 3D Printers
- CNC Machines
- Camera rigs Robotics
- Printers
- Precision Gearmotors
Advantages:
- Precise repeatable positioning
- Precise speed control
- Excellent low-speed torque
- Excellent 'holding torque' to maintain position
Limitations:
- Low efficiency
- May need encoder or limit switch to establish a reference position
- Subject to missed steps if overloaded
More details of stepper motor: https://www.instructables.com/id/How-to-use-a-Step...
For good quality stepper motors & drivers visit Sparkfun.
How You Select Correct Motor for Your Robot?
Choosing a motor that is suitable for your task is one of the most important parts of planning a robotics project. The good news is that there are many types of motors from which to choose and, as the joke goes, the bad news is that there are many types of motors from which to choose.
To choose the electric motors that can fit for your project you should consider some important motor specifications:
- Torque
- Speed
- Precision and Accuracy
- Voltage
- Cost
- Form Factor
Torque is a measure of a motor’s ability to provide a “turning force”. In a robot, the motor torque is conveyed to a wheel or a lever, which then causes the robot to move or the lever to lift, push, or pull something. Torque is measured in terms of force times the perpendicular distance between the force and the point of rotation, i.e. the shaft of motor. It is usually given in terms of ounce-inches (oz-inch), gram-centimeters (gm-cm) or foot-pounds (ft-lbs). Ounce-inches (oz-in) is the most common.
Estimating the required torque is a difficult task. We need to know the mass of the load/rover and the friction in order to determine the torque for motor selection. Getting a mass estimate (or even better an actual mass) is critical for choosing a motor. If you are designing based on a mass estimate you should apply a good margin for mass bloating. Friction is a force than opposes the motion between two surfaces in contact with one another. You have to consider static friction, dynamic friction and rolling friction to accurately measure the torque.
In order to drive the robot, the motor torque must at a minimum overcome the external torque of the friction force acting on the radius of the wheel. Use the following equation to find required torque:
T = 8 x C x W x D
where:
- T is the torque in oz-in
- C is the coefficient of friction
- W is the weight in lbs
- D is the wheel diameter in inches
Friction varies from 0.001 to 0.03. As an example, for a C= 0.03, the minimum torque to move a 5 lb robot with 4 inch diameter wheels would be:
T = 8 x 0.03 x 5lb x 4in = 4.8 oz-in
A motor can maintain a constant speed only if the torque is greater than the combined forces in opposite of the robot movement. In case that the motor torque is smaller than the opposition torque, the motor will stop and may be damaged since the electrical energy cannot be converted into torque.
After determining how much force/torque you need, the next step is to determine the speed that the wheel needs to turn. Speed requirement is easier to estimate and depends on how fast your robot should run. DC motors run at speeds of thousands of RPMs with low torque but most robots required less speed compare to this. The output torque is much too low to move the robot. So, this is not suitable for driving a robot. In order to use the motor, we add a gearbox to reduce the motor speed and increase the output torque. The same motor may produce different torque and speed ratings depending on the gearing used between the motor and the gearbox output shaft. Many DC motors come with a gearbox already attached and these are simply called DC gear motors and are the type of motors. By reducing the speed, you also increase the positional accuracy of the motor. The speed, torque and accuracy of a gear motor are affected directly by the gear ratio, as seen in these equations:
Output Speed = Motor Speed / Gear Ratio
Output Accuracy = Motor Accuracy / Gear Ratio
Although the reduction ratio plays a large part in determining the Gearbox Output Torque, there is also an inefficiency that is introduced through the use of a gearbox. Some of the torque of the motor is converted into heat and lost due to friction between the gears. Another disadvantage is that gear motors are not precise. That is, two motors of the same model, manufactured on the same day, and operated with identical current and voltages, will NOT turn at exactly the same rate. Thus a robot with two drive motors, the most common configuration, will not move in a straight line without some way of controlling individual motor speeds.
With gearboxes, torque and speed can be seen as one interchangeable characteristic: If you need more torque and less speed, try to find the same motor with a gearbox with a higher reduction ratio. If you need more speed and less torque, try to find the same motor with a gearbox with a lower reduction ratio. However, it is not advisable buy gearboxes and motors separately to mix and match, unless they are specifically designed for each other. There's a lot that can go wrong in gearbox customization and for most users it's a lot less hassle to simply buy a motor with a gearbox already attached.
One main disadvantage is that gear head motors are not precise. Some applications have need of very precise movements and angles like robotic arms and model plane control surfaces. Stepper motors and servo motors are best suited to these sorts of applications. Servo motors have internal position regulation and are geared down to lower speeds, resulting in very precise position control. Stepper motors move step by step, using magnetic fields to move the motor in discrete increments. Depending on the step size of the motor and the step pattern of the controller stepper motors can achieve extremely accurate position. Often stepper motors have step angles as low as 1.8º and with micro-stepping controllers can be advanced one sixteenth of a step at a time. Stepper motors also have the advantage of high holding torque- when the motor is stopped but still powered, it will hold its position firmly.
In general, servo motors are smaller in size and have less torque than a stepper motor. Most servos also have limited range of motion. A typical servo motor has a rotation range of 180º or less, although there are some that are capable of multiple revolutions or even continuous rotation. Servos are most common in RC (remote control) applications where it is not necessary to have high torque or a large range of motion. Stepper motors, on the other hand, are used in applications where extreme precision or high torque is required. CNC (computer numerical control) machines are a prime example of what stepper motors are used for.
Some applications require high speed and light weight such as multi copter and drone, in that case high efficient brushless dc motor is used.
Another important consideration is operating voltage. Before planning what battery packs will be used in the project, you have to find the nominal voltage where the motor runs Typically the higher the voltage the higher the speed of the motor. You can look at the Voltage Constant from the motor data sheet to figure out how fast you will go per volt.
Most common electric motors used in robotics projects are the DC motors. Common preferred voltages for DC motors are 3, 6, 12 and 24 Volts. If to a motor is applied a voltage lower than the voltage listen in the data sheet, the torque will not overcome the internal friction – mostly from the brushes. Also, if a higher voltage than that supported is applied to the motor, it may heat up and can be damaged.
Conclusion
Most of the picture of this instructable is taken from the Internet. Some topic, image and text were copied from:
3. https://learn.adafruit.com/
If you liked this please don't forget to give me a kindly vote.