Sie sind auf Seite 1von 12

Atmega32

www.ir-micro.com

8-bit Microcontroller MegaAVR Series Atmega32


With 32K Bytes In-System Programmable Flash
8-channel, 10-bit ADC 32 x 8 General Purpose Working
Registers
Power Consumption at 1 MHz, 3V, 25C 4.5 - 5.5V for
ATmega3
Six Sleep Modes: Idle, ADC Noise Reduction, Power-save,
Power-down, Standby and Extended Standby
40-pin PDIP, 44-lead TQFP, and 44-pad MLF
Figure 0
MQ-2 Type Sensor in air quality control-HanWei
17 Semiconductor Type Gas Sensor
Target gas: smoke, hydrogen, NH3, propane, ammoniac, etc.
Standard circuit conditions:
Heater voltage: 5V DC/AC
Circuit voltage: 3~15V DC
Heater power consumption: 750 mW
Temperature range: -20deg. C to +40 deg. C
Size: Diameter19mmHigh17mm
Figure 1
Paradox PA-476
Improved Auto Pulse Signal Processing
Detecteur DE Mouvement Analogue Avance
& Advanced Analog Motion Detecto

Figure 2
This is Improve Circuit of End Product Example
Anti Fire and Squrity System
For Home Situate or Other Simple Place!
By Buzzer or Multisonous Output
Micro Resolution Power in Multifarious Sensor's
Signal Processing

Figure 3

! "
A,B,C,D

# $

% &'

PORT 4
&' %$#"!

PIN 8
( )

0 1 /

*+ ,

5 678
9

. A

- $0 1
,

$0 1

<=

- .&

A
:.

4=

? 1D I

<; J E

PORTA 78

<= 0

F G4

JAJ 'A3 E M4 =

H4

N1= -

+
:.

- =

B
.

/ VCC

GK + *I L 4 -

/ GND

0 MG=

:.

*I L 4

1
RESET

O =

? 1D

FG

7 = 0 44 <

<= 0
:. 0

-= (
; + <; J E

FQ P
/ XTAL1

( ) / XTAL2
/ AVCC

1 :)

4
4

F.

RESET
P

ADC=(Analog to Digital Converter)

;+

/ RESET

0 44 <
1

*I

0
.

*+ 0 1

*+ ,

<=

GND
44

PORTB PA

: ; PORT A.3

0> ?
.

3 2-

PIN A.3 /

C PB

FGR
A

S; :
E

( ')* $+

0T

- 0U

Figure 4

E VGX
V4
V
`

+ Z(
V_ \ DV <>
V GD4V. V \
`
` LPG
DataSheet V
GV=
< V VG V ( A
A

? VB <V W V X
YVZ[ V
4= \
4
]K >
0
H 1 A 4G
4
D=
=4 0 >
4^1 A
V V -V
-+<
=4
4= \
A
^1
-+ =4
4= \
- 0 MG= 4^1
V A<= 0 L_ (
H4 1
U
` G
4 D( www.hwsensor.com < =
4=
.
( )
MQ2
< Da (
Figure 5

G= b

,0
(

c X NG ; DK
PIR
4=. 1
e
g >G
( A
?
e(h
;P
A
GK
LED
LED (
9 - 0 MG=
. A
) E
. g >G
(<

K < X
)

1 d
f
N4 A

4=

( ')* $+
< X-=
P

B
X
>G
<
1 GX A
X
e )
0 < X
4=
4 0 MG= (Buzzer) 9
LED (
X
. LED
e )
(
Figure 6
. 4
`&2 0 > - 4 i
1 (
Q5
- <; k' J
*I U G; 0 > j32
K n
4=
0 =
i A
( mJ lX
F8
4i A
K 4 < Xe
K AAAA
= T 1G) =
o )
- K
4
, 1 0 :1i
4=
G
.
4GVVVV
VVVV= o - & : VVVV - VVVV
VVVV(
VVVV 1VVVV d VVVV VVVV8
A< <; k' m
? 1D
<
*I
F oVC O p V= PV V= - LV_
<
( Tamper ,
=o -P
V
1 dh 1 + ; <
G
i <; X O p =
0
GK +
O p V= P
1 d
G <4
L_
A
Op=
4 V < ,= A
Op=
1 dh
D
Vi 1R V ls= 44
= Tamper O p = < X q 5
r Op=
VV4 VV :VVQG VV + - GVV = PVV
9VV 0 CGVV=
VVT - - VV VV
- Tamper O p = 1 G ;
V= - V= o - V r
=
< < Xq5
9
=o-P
V4 V - V O p V= A
q5
G X
4=
A0
GK + O p = P
V GV
%2! - V GX BC337 2N3904 G 9 P P1
1

: V

<; J 2
A
) -

<
.

< Xq5
A

Figure 7

t G
Op=
s P

%k!
4

. * ! / 0
MISO - MOSI - SCK - RESET PIN = A 4
0
T - ( ) 4i
n
% l
CG !A 0 MG= T Figure 10

PIN - =
, +
. .
0 MG= GND - VCC
A-D-C-B
Td
4i
0 MG=

NOTE: should you do parallel R1 and connected to the between micro vcc pin
and buffer vcc Pin
U2

1
14
2
15
3
16
4
17
5
18
6
19
7
20
8
21
9
22
10
23
11
24
12
25
13

19
1

A0
A1
A2
A3
A4
A5
A6
A7
CE
AB/BA

B0
B1
B2
B3
B4
B5
B6
B7
GND
VCC

18
17
16
15
14
13
12
11
10
20

74HC244

R1 100 K
100k

U1
9
10
13
12

V cc 5

J3

2
3
4
5
6
7
8
9

40
39
38
37
36
35
34
33
1
2
3
4
5
6
7
8

CONN-D25M

NOTE:should you do parallel R1 and connected to the bitween micro vcc pin and buffer vcc

Figure 11,12

RESET
Vcc
XTAL1
XTAL2
PA0/ADC0
PA1/ADC1
PA2/ADC2
PA3/ADC3
PA4/ADC4
PA5/ADC5
PA6/ADC6
PA7/ADC7
PB0/XCK/T0
PB1/T1
PB2/INT2/AIN0
PB3/OC0/AIN1
PB4/SS
PB5/MOSI
PB6/MISO
PB7/SCK
ATMEGA32

PC0/SCL
PC1/SDA
PC2/TCK
PC3/TMS
PC4/TDO
PC5/TDI
PC6/TOSC1
PC7/TOSC2
PD0/RXD
PD1/TXD
PD2/INT0
PD3/INT1
PD4/OC1B
PD5/OC1A
PD6/ICP
PD7/OC2
GND
AVCC
AREF

22
23
24
25
26
27
28
29
14
15
16
17
18
19
20
21
11
30
32

Bascom
V
V8
V+

111111111111111111111111112! -

A<V=
AVR
<V= PV 9 Basic A 0 MG=
V
G= Y; _
G
1 0 G Z s

Z s

GK D -

Z s

Z) Z s
G=
=
1

Basic

f - 1
4 0 G

V VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV
HEX
. <= Basic 1
n
AVR

V
:.

TK : _ =
1
,+

Bascom-AVR ,

<= 0

AVR

<Z_

G;
=

G4 Bascom-8051 ,

Figure 8

4 0 MG=

P -

AVR

1
C

Figure 9

! !
regfile = "m32def.dat"
crystal = 1000000
Config Portd = Output
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Dim W As Word
Dim M As Word
Declare Sub Gas(byval W As Word )
Declare Sub Motion(byval M As Word )
Start Adc
Do
W = Getadc(0)
Call Gas(w)
M = Getadc(1)
Call Motion(m)
Set Portd.5
Waitms 500
Reset Portd.5
Waitms 600
Loop
End
Sub Motion(m As Word )
If M > 600 Then
Set Portd.6
Waitms 200
Reset Portd.6
Else
Reset Portd.6
End If
End Sub
Sub Gas(w As Word )
If W > 300 Then
Set Portd.6
Wait 3
Else
Reset Portd.6
End If
End Sub

3 $ !
<; k' F Q
D

(0

G =

*C ( E K :X
-

<; J

1 dA

Figure 13,14

,R - l
)0

Das könnte Ihnen auch gefallen