Now a days DC motors plays a vital role in most of the industrial areas, it can be seen in most of the electronic devices. They are mainly used for the mechanical movements of physical applications such as rolling the bundle of sheets or CD drives, lifts etc.
Many methods evolved to control the revolution of a motor. DC motors can be controlled either by software or directly by hardware. Software controlling needs computers which are bulky and common man cannot afford for it, so hardware controls are in use. Even in hardware if it is programmable device then it is preferred because it can be modeled according to the requirements of the user.
Advantages of using PIC over other controlling devices for controlling the DC motor are given below:
- SPEED: The execution of an instruction in PIC IC is very fast (in micro seconds) and can be changed by changing the oscillator frequency. One instruction generally takes 0.2 microseconds.
- COMPACT: The PIC IC will make the hardware circuitry compact.
- RISC PROCESSOR: The instruction set consists only 35 instructions.
- EPROM PROGRAM MEMORY: Program can be modified and rewritten very easily.
- INBUILT HARDWARE SUPPORT: Since PIC IC has inbuilt programmable timers, ports and interrupts, no extra hardware is needed.
- POWERFUL OUTPUT PIN CONTROL: Output pins can be driven to high state, using a single instruction. The output pin can drive a load up to 25mA.
- INBUILT I/O PORTS EXPANSIONS: This reduces the extra IC’s which are needed for port expansion and port can be expanded very easily.
- INTEGRATION OF OPERATIONAL FEATURES: Power on reset and brown/out protection ensures that the chip operates only when the supply voltage is within specification. A watchdog timer resets PIC if the chip ever malfunctions and deviates from its normal operation.
There are two types of DC motors, unidirectional and bidirectional. Unidirectional rotates in only one direction and it is specially meant for some specific applications while the bidirectional can be rotated in the clock-wise or the anti-clockwise direction. This the most widely used for industrial applications. There are two parameters to be considered in controlling the movements of a DC motor.
The first thing that can be controlled in a motor is its direction of rotation. Direction of the motor can be controlled by controlling the polarity of the current flowing through it. Usually a DC motors are driven by famous H-Bridge circuits made up of either transistors or the buffers or any other suitable methods.
Controlling the speed of the motor is another important area to be considered. The speed of motor is directly proportional to the DC voltage applied across its terminals. Hence, if we control the voltage applied across its terminal we actually control its speed.
A PWM (Pulse Width Modulation) wave can be used to control the speed of the motor. Here the average voltage given or the average current flowing through the motor will change depending on the ON and OFF time of the pulses controlling the speed of the motor i.e.. The duty cycle of the wave controls its speed.
This project is developed with a PIC IC 61F84A, which is programmable. The word PIC stands for PERIPHERAL INTERFACE CONTROLLER, a single chip microcontroller is developed by Microchip technology.
The block diagram of the circuit is shown above. This circuit controls the speed and direction of the motor. The PWM (Pulse Width modulation) output from the four port pins is given to the H-Bridge circuit which drives the motor. On changing the duty cycle (ON time), we can change the speed. By interchanging output ports, it will effectively change direction of the motor.
The PIC microcontroller is the brain of the circuit controlling all actions to be done. Inputs are given to control the speed and direction of the motor. The PIC output controls the DC motor.
The circuit consists three parts:
There are two inputs. One for direction control and the other for speed control. These generates interrupts for the PIC which are used for controlling the speed and direction.
There are 2 interrupts used as control signals for the PIC.
a. External interrupt.
b. PORTB input (interrupt on change).
Interrupts deviates the main program execution to interrupt subroutines (ISR) and return to the main program. The global enable bit in the INTCON register will allow all interrupts to occur. This will reset on going to ISR and set when coming out of it.
An interrupt on external interrupt pin will set flag INTF in the INTCON SFR(Special Function Register). At the same time the program execution is deviated to the ISR where there is a register used to controls the movement of direction (clockwise or anti-clockwise). An interrupt on portB 4 (4/5/6/7) pin will set flag RBIF in the INTCON SFR(Special Function Register). Meantime the program execution is deviated to the ISR, where there is a register used to control the speed of the motor (maximum or minimum).