Presentation is loading. Please wait.

Presentation is loading. Please wait.

MICROCONTROLLER AND INTERFACING

Similar presentations


Presentation on theme: "MICROCONTROLLER AND INTERFACING"— Presentation transcript:

1 MICROCONTROLLER AND INTERFACING
PREPARED BY : RUCHI KHANT( ) FORAM NAIK ( ) MILIND TRIVEDI( ) ADITYA LAKKAD ( )

2 PWM PROGRAMMING AND DC MOTOR CONTROL IN AVR

3 Speed Control Of DC Motor Using Microcontroller
In many applications, it is important to control the speed of DC motor where precision and protection are essence. Here we will use a technique called PWM (pulse width modulation) to control the speed of DC motor. We can achieve speed control of DC motor using mechanical or electrical techniques but they require large size hardware to implement but Microcontroller based system provides easy way to control the speed of DC motor.

4 UNIDIRECTIONAL CONTROL
The direction of rotation reverses as polarity of supply voltage polarity reverses. Figure shows the DC motor rotation for clockwise and anticlockwise direction.

5 BIDIRECTIONAL CONTROL
By using switches for charging the power supply polarity we can control the direction of rotation of DC motor. All the switches are open, so motor does not turn on.

6 Interfacing DC Motor using L293 H-Bridge
Usually H-bridge is preffered way of interfacing a DC motor. H-bridge can also be made with the help of trasistors and MOSFETs etc. rather of being cheap, they only increase the size of the design board, which is somtimes not required so using a small 16 pin IC is preffered for this purpose.

7 Interfacing DC Motor using L293 H-Bridge

8 Interfacing DC Motor using L293 H-Bridge
L293D is a dual H-Bridge motor driver, So with one IC we can interface two DC motors which can be controlled in both clockwise and counter clockwise direction and if you have motor with fix direction of motion the you can make use of all the four I/Os to connect up to four DC motors. L293D has output current of 600mA and peak output current of 1.2A per channel. Moreover for protection of circuit from back EMF ouput diodes are included within the IC. The output supply (VCC2) has a wide range from 4.5V to 36V, which has made L293D a best choice for DC motor driver.

9 Interfacing DC Motor using L293 H-Bridge
As you can see in the circuit, three pins are needed for interfacing a DC motor (A, B, Enable). If you want the o/p to be enabled completely then you can connect Enable to VCC and only 2 pins needed from controller to make the motor work. As per the truth mentioned in the image above its fairly simple to program the microcontroller. It is also clear from the truth table of BJT circuit and L293D the programming will be same for both of them, just keeping in mind the allowed combinations of A and B

10 Pulse Width Modulation

11 Pulse Width Modulation
DC motor speed is dependent on three factors: 1.Voltage 2. Current 3.Load For a fixed load steady speed can be maintained by using a technique called pulse width modulation. By changing(modulating) the width of the applied pulse to DC motor we can increase or decrease the amount of power provided to the motor, thereby increasing or decreasing the motor speed.

12 Pulse Width Modulation
Although the voltage has a fixed amplitude, its duty cycle varies.The wider the pulse greater is the motor speed. Hence PWM is widely used in DC motor control. The ability to control the speed of DC motor using PWM is one of the reasons why DC motors are preferable over AC motors.

13 Timers We are very well aware that the AVR provides us with an option of 8 and 16 bit timers. 8bit timers count from 0 to 255, then back to zero and so on. 16bit timers count from 0 to 65535, then back to zero. Thus for a 8bit timer, MAX = 255 and for a 16bit timer, MAX =

14 PWM Modes of Operation In general, there are three modes of operation of PWM Timers: 1.Fast PWM 2.Phase Correct PWM 3.Frequency and Phase Correct PWM

15 Fast PWM

16 Fast PWM In simple terms, this is Fast PWM! We have a sawtooth waveform, and we compare it with a fixed voltage level (say A), and thus we get a PWM output as shown (in A). Now suppose we increase the compare voltage level (to, say B). In this case, as we can see, the pulse width has reduced, and hence the duty cycle. But, as you can see, both the pulses (A and B) end at the same time irrespective of their starting time. In this mode, since sawtooth waveform is used, the timer counter TCNTn (n = 0,1,2) counts from BOTTOM to TOP and then it is simply allowed to overflow (or cleared at a compare match) to BOTTOM.

17 Phase Correct PWM

18 Phase Correct PWM Here instead of a sawtooth waveform, we have used a triangular waveform. Even here, you can see how PWM is generated. We can see that upon increasing the compare voltage level, the duty cycle reduces. But unlike Fast PWM, the phase of the PWM is maintained. Thus it is called Phase Correct PWM.

19 Frequency and Phase Correct PWM

20 Frequency and Phase Correct PWM
Technically, Phase Correct PWM and Frequency and Phase Correct PWM are same if the TOP remains same. If we have a variable TOP, the frequency of the output wave will keep changing as shown below. Thus, for this, we need Frequency and Phase Correct PWM. Since in most cases the value of TOP remains same, it doesn’t matter which one we are choosing – Phase Correct or Frequency and Phase Correct PWM.

21 THANK YOU


Download ppt "MICROCONTROLLER AND INTERFACING"

Similar presentations


Ads by Google