0% found this document useful (0 votes)
45 views

DC Uln2003 Uln2002 L293 L298 Avr

This document provides information on using DC motors with various motor driver ICs: 1) It compares the AVR ULN2003, ULN2002, L293, and L298 ICs for driving DC motors with an Arduino or other microcontroller with a DC power source. 2) Key specifications of the ICs like current rating, PWM control, and motor connections are outlined. 3) Examples are given of connecting DC motors to the ICs and controlling speed and direction with a microcontroller.

Uploaded by

Tavan faraz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
45 views

DC Uln2003 Uln2002 L293 L298 Avr

This document provides information on using DC motors with various motor driver ICs: 1) It compares the AVR ULN2003, ULN2002, L293, and L298 ICs for driving DC motors with an Arduino or other microcontroller with a DC power source. 2) Key specifications of the ICs like current rating, PWM control, and motor connections are outlined. 3) Examples are given of connecting DC motors to the ICs and controlling speed and direction with a microcontroller.

Uploaded by

Tavan faraz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 25

AVR DC

AVR ULN2003- ULN2002- L293- L298 DC

! AVR " "#$%!"& ' ( ! DC

1 "% ) *+ , " -" ./ $0


111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 DC
DC
DC
DC IC
L
L
DC
# $ % & PWM !"
' ( % & PWM "
)
( *#" PWM "
)
)
+,!
+,! + #
RPM # + - +,!
+,! . / ' + "
+,! "
MOSFET # +,! "
+,! 0
ULN # ULN
)
DC
#"1 ,2 . 3 #* 4 4 / " DC
DC 9 3 35 * *6 (78 9 :"
* +; * + <7 DC "1 #$ % &
1 0 " / " * #*
* ; >'# + "1 > $6 9 0# ?!. + (@ DC =
"0 A+ ?!. +B #
D" . 7 4C # # DC
1 9 E *0 # + ( B # +, # +
1 9 E "6 & + +, # + # 6
"; ; F G FH 5 1 ( + 6 B # 4 3 / < +
+; ;# ; ;# #";I B # * =5 DC
) "A B # 9 + 1 +1 B # #
37 "J + < "J " A H
DC
;< * K 0 FH 5 + 9 DC 4C # 9 (
FH ;5 ; "; ; K + ( B # + L! 4 < + " K
" "! K

SW1 SW2 SW3 SW4 $,(


1 0 0 1 3
0 1 1 0 3N5
0 0 1 1
1 1 0 0

DC M >$1
;1 P ;E ; ; # B ; # +; L! ;4 " " 6 M >$1 + O(
+; ; G AQ3 * 9(R " K
1 S #
DC
#T ; ; T " 7 5 + H >! " = >$1 "
"1 *

in1 in2 $,(


0 0
0 1 .J7
1 0 U $E
1 1

7 DC " M >$1

;VG I ; +; " ;1 ; ;4 ; 7 # "1


"# $ J H 'H 7
; BJT 7 5 " +VAL M >$1 + O(
; * ;3 W# BJT 7; * 6 * + "1
;; *0 # ;; # DC ;; ;; ;; ;; ;;3 X# ;; ;;
"1 BJT 7 + MOSFET 7
+; ; 0 ;< * # B # 7 # MOSFET 9 /# 9 (
" BJT +7 J 6 * < MOSFET , / '
" F ( MOSFET 5 H >! " = M >$1
MOSFET DC " M >$1

# .; ;$ / ;' +; LED " # * FH 5 * *6


# ; ; ; F ( I >$1 8 / '+
" * 6 LED "

LED F ( >$1

DC IC
; +; * + "1 +R + ,2 0
1 # LMD # SN154410 # L D#L N

L
";; + 7;; Y ; # ; 9;; # ; ;$ ; # ";; ; ; 9;;
Z; # [ (1 M >$1 "1 +R + PowerSo20 # Multiwatt15
" *6 9 + !
L298 + ! M >$1

+ ! $,(
# " 1 >S 9 + # J = +, # + " + !9
# A #H
1 >S 9 + nf * H = +, # + " + "1 + \K B #
# A ##
# B#A #H EG + !
9
1 >S 9 + nf * H = +, # + " + + \K #] B #
# B ##
# B #H

L298 + ! $,( M #"


" ^26 9 / S26 M #"
L298 / S26 M #"

" *6 L % & = S I M >$1

##
$,(
Eable C D

3
3N5

C X, D X 0 _5

L298 + S I M >$1

L
; ";1 ; # " " = L 0" ( L 0
+;VI / ;' +; ;N 0 #+ !/ '+ N0 * " L D
+; ;N 0 # + ; ! / ;' + A * < + 8 L N #" < H
* 6; L D ; + !Z # , (1 M >$1 "1 +VI / '
"
L D + ! M >$1

D" ^26 9 / S26 M #"

L293D / S26 M #"

" *6 LM + # S I M >$1

L293D + # S M >$1
A ## $,(
;; +;; ;; ` ;; >$;;1 D+;; $
Eable In2 In2
"1 ( # 64
3 ";1 + <E 0 >H 9
3N5

in1 x , in2 x 0 _5

DDC
; ; ; # ";1 +;a < ;O DC ; ; K 3 35 *
; " + +$, "1 ( G K DC
( 6 A # FH 5
K 9 *0 # + "1 ( B # E "1 + 4 + O(
; X# 9 ; ; ; ; ; ; * 4 + # B #
; ";1 +; G 4 ;8 / '+ + a = DC
" K + ( B # a 9 "1 <

a DC M >$1
9 ; ! ;$ ;# ; ; .; 0 + "1 < E ` X#
* `#" "1 !b * `#" DC # X#
9; ,;' "; ";1 ; * ; - 7 B $ = dPWMc !b
";J *0 +; ";1 ; + \K E B # ! < X#
3 7 dDutycyclec + [# * "' + + ( *
; G =; "; +; ; + 49" !b * `#" +, # + I
; # F ;G Dutycycle ; ; F ;G ; N; # ; e2 -
. F Dutycycle F

* " + O( * + "1 ( * T 7 !b
+ ( f B # +O + "1 ( B # #\@
"0 " g, 2 Dutycycle

1 T
V rms = V (t ) 2 dt
T 0

";1 ; ; ; ;! = + [# * K 4 + "1 +VAL + O(


" 3 V " A

+; 7 ! + [# * +, # + . 7 8 " 9
=; ; 1 ( 7 +
. ^26
M >$;1 " # A
.
In1 In2 $,(
0 0
0 PWM ! 3
PWM ! 0 3N5
1 1

DC # M >$1

# $ % & PWM !"


7; G # +; [# * PWM 7 !. 7 8 #$ % & 4 +
; +; " 1 PWM " " 9"5 ( " " + O( . " 2
. 7 PWM " + 8 Code Wizard (V # 7 "J

( ) % & PWM " '


& ;H 9 ;( +; . ; X ; (1 + K PWM = " I. "S8 @
; ; ' ( i PWM " , &+ #. 1 ( ( hI< #
. 8
D Fast PWM "
7 "1 8 "J + *" #" * (1 + Y# 1 ' "J (
not dATmaga16 + !*( c OC0 + ! dCompare (78 c OCR0
+ ! "J 9 + *" #" 0xff "J + " + H X (1 + #
I K . 7 8 Z 9" " j! ( # not # \
. K PWM ! OCR0 7
(78 # HY " ' ( /(V (78 V " e2 !
" *"1 EG k h Disconnected + 4 " e 2 Mode output
# U $E # HZ + non–inverted # inverted + 4 # "1 PWM
F ( Fast PWM " Q 4 >$1 " ^26 PWM U $E k
"

Fast PWM " Q 4

D" 0 " +O PWM W G


fclk − I / O
FOC 0 =
N .(256 −TCNT 0)
T T T J $ # .7 ! G . 7J Z R N ` +O
^26 Clock Value (78 Z R 9 c" lSH H+ T
"1 ( jL fclk-I/O # d 1

d 20% + # "J c " K + [# * , = G= D )

fclk − I / O
FOC 0 =
N .(256 −TCNT 0)
#include <mega16.h>
interrupt [TIM0_OVF] void timer0_ovf_isr(void)
{
TCNT0=0x06;
}
void main(void)
{
PORTB=0x00;
DDRB=0x08;

// Timer/Counter 0 initialization
// Clock source: System Clock
// Clock value: 250.000 kHz
// Mode: Fast PWM top=FFh
// OC0 output: Non-Inverted PWM
TCCR0=0x6B;
TCNT0=0x06;
OCR0=0x38; //OCR0 = 56
// Timer(s)/Counter(s) Interrupt(s) initialization
TIMSK=0x01;
// Global enable interrupts
#asm("sei")
while (1){
if(PIND.0==0)OCR0=++OCR0;
if(PIND.1==0)OCR0=--OCR0;
delay_ms(200);
};
}

D( *#" PWM " d


"; ; K ; +; [# * ; ; PWM W = / '+ . "S8 @
e ;2 ;! (;1 +; / ;' 9 "; ";1 7 % &9 PWM " .
; Dutycycle "; ; # "; #0 ; " dTce# # T G
" G g, 2

PW
% D u ty cy cle = × 100
T
; ; " ;! =; * ; ;' # =; * /" PWM "J 9 1
" 8 +E O ) " Y R 6 j . #0

)
" " m + [# * KHZ G= #$
. 9 E !* = #* '* /" G
1 1
T = = = 1m S
F 1K
PW
% 70 = = 0 .7 m S = 7 0 0 µ S
1m
S W = T − PW = 0 .3 m S = 3 0 0 µ S

#include <mega16.h>
#include <delay.h>
void main(void)
{
DDRB=0x01;
while (1)
{
PORTB.0=1;
delay_us(700);
PORTB.0=0;
delay_us(300);
};
}

D )
# 3; / ;' +; + - /" + up " , 6G DC = + "7 +
; # "; ; A + Y# 1 d" 9 6 + # Y# 1 9 ( cQ "
+; Y# ;1 Q ; "; # ;3N5 / ;' +; +; - /" + DOWN " , 6G
d 1+G 4 V KHZ Gc " ( A
1 1
T = = = 1mS
F 1K
SW + PW = 1mS

DC ) = (1 M >$1

#include <mega16.h>
#include <delay.h>
int sw,pw,i,i2,i3;

void delay_usec(long int ha){


for(i2=0;i2<=ha;i2++){
}
}

void main(void)
{
DDRB=0xFF;
DDRC=0x00;
PORTC=0xFF;
while (1)
{
PORTB.0=0;
PORTB.1=0;
//***********************righ
if(PINC.0==0){
PORTB.0=0;
sw=1000,pw=0;
for(i=0;i<=100;i++){
sw=(sw-10),pw=(pw+10);
for(i3=0;i3<=50;i3++){
PORTB.1=1;
delay_usec(pw);
PORTB.1=0;
delay_usec(sw);
}
}
}
//*************************left
if(PINC.1==0){
PORTB.1=0;
sw=1000,pw=0;
for(i=0;i<=100;i++){
sw=(sw-10),pw=(pw+10);
for(i3=0;i3<=50;i3++){
PORTB.0=1;
delay_usec(pw);
PORTB.0=0;
delay_usec(sw);
}
}
}
};
}
*+!
3 7# E8 9 E T AT @ * +,!
+,! "1 #Q T I = E8 % 8 0 +
# "; ; > ";< $ ;$ ; A +; $ $ !+ G S ! +, #
+;,! = # 7 3! 5 T =7 +,( > # 7
# ;1 ; "; H .; ;1 + (a 7& K j I +7 =
Y ; 9 # "; ;$ M >$1 "1 +& A Q + - F2 = +,
f; # ; =; # ; ? ;! . ; ;5 9 + " *6 +,!
"1 j 6

+,! ,H * ( H M >$1
# 9 /# " dc = /# +,! = $,( I
+;,! ; =; "; +VAL M >$1 + O( I A I
;j 6 # # ?!. 5 . + "1 . F1 #"
+;@ #" 1 >'# . + >H f # # 9 ) cf # .
+; Y# ;1 ; ; ? ;! . ; =; ; + 7! ( d 1 .
/ ;' +; M #"; "; 7 !" +,! = A " ( A
1 ( ?!. = + #"
A B C D A B C D
1 0 0 0 0 0 :LH
0 1 0 0 0 0 + J
+ J
0 0 1 0 0 0
0 0 0 1 0 0

?!. = + ( 7! M #"

Z; / ;' +; "; +;,! ; ; n ! . To I' $,( + 9


"; ; +; +;,! ; =; ; Q ;3 +; +; E * " 9 " 1 + \K
;H +; ; *0 $ $ 4C # " +$, 1 YL& 3 $ $ +S26
H 1
*+! * #
"; ; ; A +,! = " + T 1 ( ?!. $ + !+ 3
9 ; g;, 2 ; +; ; +,! = + p FH 5 + # >8 "A +,! + #
M #"; + q +,! + # 9 # " # "1 + + q #"I
" 9 E 1 ^26 +,! + # = +" + 7 ! "E
>; # = 1 +,! + # = +" + 7 ! "E ) * +
"1 "H n
+,! + # # = +,! "E

g, 2 +,! + # + ( 7! M #"
"H n # T q +,! + # +,! = + "7 + d )
#include <mega16.h>
#include <delay.h>

#define steper_motor PORTB


int i;
void main(void)
{
DDRB=0xFF;
for(i=0;i<=500;i++){
steper_motor=0b1000;
delay_ms(5);
steper_motor=0b0100;
delay_ms(5);
steper_motor=0b0010;
delay_ms(5);
steper_motor=0b0001;
delay_ms(5);
};
}

RPM # * , *+!
D" 0 " +O + - +,! # # +,!T+J 8 # RPM 9 +O

* , *+!
+ "1 + G 4 V Hr = + ! 9 " + ><8 ) + 4
; 7 !9 Hr 4 ) * + " ^26 + - +,! "J Hr 9
1 + - +,! "J "1 + - ,
RPM
# +; - +,! "J 9 1 4 ++ " 4 RPM +J 8 = # "E
+< I RPM "J * +,! "E
+; ; ; ; 9; 9 ; " 7; ! #0 64 +,! D+ $
1 ( +' #0 64
*+! - . ( * "
9 " " +,! . / ' + 0 +,! #0 64 F G
+; "; " ;1 "; # ? ! . # +VI = 9$( + E *"
"; H ; # 64 +,! + # *"1 gS # 1 gS +,! + # +,! . / '
. / '+ " ?!. = + 7! M #" "1
" *6 +,!
A B C D A B C D
0 0 0 1 1 0 0 1
0 0 1 1 :LH 1 0 0 0 %G
0 0 1 0 + J 1 1 0 0 + J
0 1 1 0 0 1 0 0
0 1 0 0 0 1 1 0
1 1 0 0 0 0 1 0
1 0 0 0 0 0 1 1
1 0 0 1 0 0 0 1

+,! . / ' + " M #"

*+! "
>S; ; # $ +; . J 7 / ' + +,! = * (" + O(
9; . ; ; ; " +,! + #$ S T
"1 # 0 TMOSFET T 7 > 1" / "
MOSFET # *+! "
MOSFET Y ; +; ";1 +,! " = M >$1 "
"1 7 + <7 6 *
+,! " " M >$1

$* 3 / '+ BJT 7 * * F G D+ $

*+! /
* ( H + " "1 +R + +,! ,2 0*
Y 9 G# E ; "1 > $;6 ;7 "E ;0 ) ;,H
"1 ULN # ULN 0 +,!

ULN # ULN
* ( H ; "; # ; ;$ mA * ; ; +;,! " 9
"1 > $6 * 3 W# 7 "E 9 ,H
ULN2002A ,H * ( H # + ! Z M >$1

" *6 9 +S26 M #"

ULN2002A +S26 M #"

;#J ";J ; 0 /# ; # " 3 "$ + <1 s < J ULN200X H


; =; ; ; ";J 9; M >$;1 + "1 7 #
^26 ULN200X H
M >$1

0 +S26 + "1 2700Ω #J "J ULN2003 (1 0


; ; ; # J ULN (1 0 4 TTL JO / "
" 4 Cmos JO / " 0 +S26 + 10.5K Ω #
; * 6; ULN2002 ; +; ;G ; 5 +,! = S I M >$1
"

ULN2002 + +,! S I M >$1


# +,! . / ' + + SW " , 6G + "7 + d )
+;,! Q ( / ' + # SW2 " , 6G # "H n + J A
"H n + J :LH #

+,! ) = (1 M >$1

#include <mega16.h>
#include <delay.h>

int i;
void main(void)
{
DDRB=0x00;
PORTB=0xFf;
DDRD=0xFF;
while(1){
if(PINB.0==0){
for(i=0;i<=100;i++){
PORTD=0b1001;
delay_ms(5);
PORTD=0b1000;
delay_ms(5);
PORTD=0b1100;
delay_ms(5);
PORTD=0b0100;
delay_ms(5);
PORTD=0b0110;
delay_ms(5);
PORTD=0b0010;
delay_ms(5);
PORTD=0b0011;
delay_ms(5);
PORTD=0b0001;
delay_ms(5);
}
}
if(PINB.1==0){
for(i=0;i<=250;i++){
PORTD=0b0001;
delay_ms(5);
PORTD=0b0010;
delay_ms(5);
PORTD=0b0100;
delay_ms(5);
PORTD=0b1000;
delay_ms(5);
}
}

};
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy