DC motor control using arduino 1) Introduction: First we need to differentiate between DC motor and DC generator and where we can use it in this experiment. What is the main different between the DC-motor, DC-generator? - Both device are electromechanical device that convert the input energy form to output energy with another form. - Dc motor: electromechanical device that convert the electrical energy to mechanical energy. - Dc generator: electromechanical device that convert the mechanical energy to electrical energy A DC motor is any of a class of rotary electrical machines that converts direct current electrical power into mechanical power. The most common types rely on the forces produced by magnetic fields. Nearly all types of DC motors have some internal mechanism, either electromechanical or electronic, to periodically change the direction of current flow in part of the motor. DC motors were the first type widely used, since they could be powered from existing direct current lighting power distribution systems. A DC motor's speed can be controlled over a wide range, using either a variable supply voltage or by changing the strength of current in its field windings. Small DC motors are used in tools, toys, and appliances. The universal motor can operate on direct current but is a lightweight motor used for portable power tools and appliances. Larger DC motors are used in propulsion of electric vehicles, elevator and hoists, or in drives for steel rolling mills. The advent of power electronics has made replacement of DC motors with AC motors possible in many applications.
2) Control Systems: 2.1) Open Loop Systems: An open-loop control system is controlled directly, and only, by an input signal, without the benefit of feedback. A characteristic of the open-loop system is that it does not use feedback to determine if its output has achieved the desired goal of the input, this means that the system does not observe the output of the processes that it is controlling. Consequently, a true open-loop system cannot correct any errors that it could make. It also may not compensate for disturbances in the system.
2.2) Closed Loop Systems: A closed-loop system uses feedback to control states or outputs of a dynamical system. A closed loop system compensates for disturbances by measuring the output response, feeding that measurement back through a feedback path, and comparing that response to the input at the summing junction. If there is any difference between the two responses, the system drives the plant, via the actuating signal, to make a correction. If there is no difference, the system does not drive the plant, since the plant's response is already the desired response. This means that a closed-loop system is able to regulate itself in the presence of disturbance or variations in its own characteristics.
The measurement output signal reading by sensor it can be a voltage signal or current signal or variable resistance like LDR. Now, stop and ask yourself an important question how I can compare between two values with different types as (angle and voltage). So, now we will see the complete closed loop system for position control of dc motor and we will analyze it.
3) Position control of DC motor: 3.1) Motor Drivers: ( direction control ) Motor drivers are essentially power amplifiers, their function is to take a lowcurrent control signal, and turn it into a proportionally higher-current signal that can drive a motor. Note here that the control signal is likely on the order of 10 mA, and the motor may require 100mA to make it turn. An example of a motor driver is an H-Bridge, an H-bridge is an electronic circuit which 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. H-bridges are available as integrated circuits, or can be built from discrete components.
An H-bridge is built with four transistors (medium or high power). When the transistor Q1 and Q4 are closed (and Q2 and Q3 are open) a positive voltage will be applied across the motor. By opening Q1 and Q4 switches and closing Q2 and Q3 switches, this voltage is reversed, allowing reverse direction of the motor
Note: The transistors Q1 and Q2 should never be closed at the same time, as this would cause a short circuit on the input voltage source (External power source). The same applies to the transistors Q3 and Q4.
3.2 : pwm (Pulse Width Modulation) (Speed control ) Pulse width modulation (PWM) is a fancy term for describing a type of digital signal. Pulse width modulation is used in a variety of applications including sophisticated control circuitry. A common way we use them here at SparkFun is to control dimming of RGB LEDs or to control the direction of a servo motor. We can accomplish a range of results in both applications because pulse width modulation allows us to vary how much time the signal is high in an analog fashion. While the signal can only be high (usually 5V) or low (ground) at any time, we can change th e proportion of time the signal is high compared to when it is low over a consistent time interval .
Duty Cycle When the signal is high, we call this “on time”. To describe the amount of “on time” , we use the concept of duty cycle. Duty cycle is measured in percentage. The percentage duty cycle specifically describes the percentage of time a digital signal is on over an interval or period of time. This period is the inverse of the frequency of the waveform. If a digital signal spends half of the time on and the other half off, we would say the digital signal has a duty cycle of 50% and resembles an ideal square wave. If the percentage is higher than 50%, the digital signal spends more time in the high state t han the low state and vice versa if the duty cycle is less than 50%. Here is a graph that illustrates these three scenarios:
Eng.Mohammed albhaisi Example # 1 : DC motor speed and direction control Arduino diagram :
Labview code :
: we use this block to generate PWM its name ( PWM write pin )
3.3 : servo motor : A servomotor is a rotary actuator or linear actuator that allows for precise control of angular or linear position, velocity and acceleration. It consists of a suitable motor coupled to a sensor for position feedback. It also requires a relatively sophisticated controller, often a dedicated module designed specifically for use with servomotors. Servomotors are not a specific class of motor although the term servomotor is often used to refer to a motor suitable for use in a closed-loop control system. Servomotors are used in applications such as robotics, CNC machinery or automated manufacturing
Mechanism A servomotor is a closed-loop servomechanism that uses position feedback to control its motion and final position. The input to its control is a signal (either analogue or digital) representing the position commanded for the output shaft.
The motor is paired with some type of encoder to provide position and speed feedback. In the simplest case, only the position is measured. The measured position of the output is compared to the command position, the external input to the controller. If the output position differs from that required, an error signal is generated which then causes the motor to rotate in either direction, as needed to bring the output shaft to the appropriate position. As the positions approach, the error signal reduces to zero and the motor stops. What's inside the servo? a small DC motor, potentiometer, and a control circuit
Eng.Mohammed albhaisi How is the servo controlled? Servos are controlled by sending an electrical pulse of variable width, or pulse width modulation (PWM) There is a minimum pulse, a maximum pulse, and a repetition rate A servo motor can usually only turn 90 degrees in either direction for a total of 180 degree movement The motor's neutral position is defined as the position where the servo has the same amount of potential rotation in the both the clockwise or counter-clockwise direction. he PWM sent to the motor determines position of the shaft, and based on the duration of the pulse sent via the control wire; the rotor will turn to the desired 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
Eng.Mohammed albhaisi Example # 2 : servo motor Proteus :
Lab work : 1. picture for protues and labview in example 1,2 must be in your report. 2. What is the H-bridge driver circuit, and what is the main function of it?
3. Discuss how we can protect it from short circuit and working in both direction in the same time? 4. What is the main benefit of the diode which connect in parallel with transistor and what is the common name of it?