Development of a Microcontroller Based DC Motor Speed Control System

This work reports the development of a microcontroller based control system to change the speed of a DC motor. Pulse Width Modulation (PWM) technique was used to control the amount of power delivered to the load (the DC motor) without dissipating any wasted power. The components and assembly of this microcontroller circuit are highlighted in this paper, and the constructed circuit tested. This device was used to control the speed of a rotating fan attached to a DC motor. The DC motor speed variations were read from a Tachometer connected to this motor and the results obtained show good agreement with our expectations. DC Motor speed microcontroller devices find applications in many areas of life, and its applications in small scale industrial settings will no doubt enhance the quest for development in a developing nation like ours.


Introduction
Direct current (DC) motors find useful applications in many control systems [1].
DC motor speed control is about the change of the drive speed of the motor to a value required to perform a work process [2]. DC motors are made up of two basic parts namely the stator, which is the stationary part and the rotor, the inner rotating part, usually called the armature. The rotational speed of a DC motor depends on the interaction between the two magnetic fields set up by the stator's stationary permanent magnets and the armature's rotating electromagnets. By controlling this interaction, we can control the speed of rotation of the DC motor [3]. This speed control can be achieved in many different ways. A simple and easy method is the use of pulse width modulation, PWM technique, which can be achieved by driving the DC motor with a number of "on" and "off" pulses and varying the duty cycle of the pulses while the frequency is kept constant [4]. Changing or modulating the timing of these pulses, controls the speed of the motor, i.e., the longer the pulse is "on", the faster the motor will rotate and the shorter the pulse is "on", the slower the motor will rotate. Hence, the wider the pulse width, the more average voltage applied to the motor terminals, the stronger the magnetic flux inside the armature windings and the faster the motor will rotate. This way, the voltage across the terminals of the motor can be regulated, and, hence the power applied to the motor can be controlled. In cases "switching on" and "switching off" are done in quick succession, the motor rotates at a slower speed between zero and full rated speed [5]. This is what a PWM technique based controller does: it switches the motor "on" and "off" with a pulse train. When the motor is "on" for a short period and "off" for a long one, it will rotate slowly. When the motor is "on" for most of the time and "off" only for a short while, it will rotate at higher speed, say, nearly at full or maximum rated speed [6]. The aim of this work is to design and construct a circuit that will generate a pulse width modulation signal to control the motor speed. Initiating interrupt signals to the microcontroller using push switches (labelled as up-and down-buttons in this circuit) produces speed increase and decrease of the DC motor. This change in the motor's speed was measured by a tachometer connected to the motor's shaft, and the observations were in agreement with our expectations.

Materials and Methods
The circuit diagram shown in Figure 1 displays the DC motor speed controller circuit.
The whole assembly is composed of three main units namely; 1) the power source with its power-on reset switch sub-unit, 2) the main circuit (control unit) which obtains signals through the interrupt input switches, and 3) switching unit, incorporating the interrupt input switches and the switching power transistor for the DC motor. This acts as power-on reset for the ATmega 328P microcontroller. From the output terminal of IC1, a 0.1 µF capacitor labelled C2 is connected in series, which serves as a filter for the output from IC1. Across C2 is connected to a 330 Ω resistor labelled R1 which regulates the current passing to the LED1. Switch, S1 serves as the power-on-off for the circuit providing a manual control. World Journal of Engineering and Technology From this power supply unit, connection was made to the main circuit via switch S2. The oscillator circuit presented here to generate a pulse width modulation signal uses an 8-bit microcontroller, ATmega 328P labelled IC2, programmed by an ARDUINO C++ program. From the power supply pin, (1 of the microcontroller) connection is made to the power source using a 10 KΩ resistor, labelled R2, in series as a current limiter. Inputs to the appropriate pins of this microcontroller are made as shown in the circuit diagram. Output from the microcontroller is connected to a 16 × 2 liquid crystal display, LCD which interfaces this microcontroller, having a total of 32 characters (16 on each line). For each character there are 5 × 10 = 50 pixels, with all 50 pixels working together to display each character. The pixels are controlled by another controller (HD44780) in the display unit. As the pin numbers are defined on the microcontroller, it displays data on the LCD. Up and Down push buttons, serve as the speed increment and decrease switches. Two 10 KΩ resistors connected in series to these switches, labelled R3 and R4 regulates the current supplied to them. Two 22 pF non-electrolytic capacitors, labelled C4 and C5 are connected across the crystal oscillator, labelled XRO, and connected to pins 9 and 10 of the microcontroller.

Circuit Explanation
The PWM wave for speed control is generated using the ARDUINO UNO pre-programmed ATmega 328P microcontroller, which creates pulses of varying width (using timer 0) for PWM and thereby controls the motor speed. Up and Down push buttons are interfaced to interrupt the input to Pins 11 and 12 respectively of the microcontroller, IC2, controlling the increment and decrement respectively of the DC motor's speed. By pressing any of these switches, an in-terrupt is generated to change the duty cycle of the pulse train. The Up push button is interfaced to interrupt and increase the duty cycle of the pulse train while the Down push button is interfaced to interrupt and decrease the duty cycle of the pulse train. The duty cycle of the pulse waveform is displayed on the LCD. From Pin 5 of the microcontroller, connection is made to the base of an npn TIP41C transistor, (labelled Q1), via a 1 KΩ resistor labelled R5. This transistor acts as a switch (in this case) for the 12 V D.C motor, labelled M, and from the transistor's collector, connection is made to the motor M, and from the motor to the Power source. Diode D5 is an IN4007 rectifier diode, connected in parallel across the motor to prevent reverse current flow. A tachometer was connected to the D.C motor, M, which measures the speed of rotation of the motor. Outputs from the microcontroller (data pins 13 through 18 or data pins D7 through D12) are connected to the LCD. The LCD displays 10% of the value of the duty cycle, in other words, for a duty cycle of 10%, the LCD displays a value 1 and for a duty cycle 70%, the value displayed on the LCD is 7. The power for the LCD is sourced from the regulator of the power source. The wired components are shown in Figure 2.
After wiring the components together, the assembly is encased with switch S1, labelled as power-on-off button, the Up and Down push buttons are labelled as speed increase and speed decrease as shown on the case, the LCD and a fan connected to the shaft of the motor are also displayed on the case as shown in Figure 3.