Tải bản đầy đủ (.pdf) (23 trang)

tiểu luận môn thiết kế hệ thống nhúng đề tài thiết kế thiết bị cảnh báo khí gas

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (746.07 KB, 23 trang )

HỌC VIỆN KĨ THUẬT MẬT MÃ
KHOA ĐIỆN TỬ- VIỄN THÔNG

THIẾT KẾ HỆ THỐNG NHÚNG

Đề tài: Thiết kế thiết bị cảnh báo khí gas

Nhóm sinh viên:

1. Lê Văn Bắc
2. Phong Ngọc Lộc
3. Đỗ Thị Mơ
4. Cao Đình Thiện

Giảng viên bộ mơn:

Dương Phúc Phần

Hà Nội – 2022


Mục lục
I. Giải pháp thiết kế.............................................................................................3
1.1. Sơ đồ khối giải pháp..................................................................................3
1.2. Phân tích chức năng các khối....................................................................3
II. Thiết kế hệ thống.............................................................................................4
2.1. Thiết kế phần cứng....................................................................................4
2.1.1. Giới thiệu STM32F103C8T6.................................................................4
2.1.1.1. Thông số kĩ thuật................................................................................5
2.1.1.2. Sơ đồ chân...........................................................................................8
2.1.2. Cảm biến khí gas MQ2........................................................................10


2.1.2.1. Thông số kĩ thuật..............................................................................11
2.1.2.2. Sơ đồ chân.........................................................................................12
2.1.2.3. Ứng dụng.......................................................................................12
2.1.3. Giới thiệu màn hình hiển thị LCD 16x2..............................................13
2.1.3.1. Thơng số kĩ thuật..............................................................................13
2.1.3.2. Sơ đồ chân..........................................................................................14
2.1.4. Mạch nguyên lý....................................................................................16
2.1.5. Mạch phần cứng...................................................................................16


tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas

2.2. Thiết kế phần mềm..................................................................................16

I.

Giải pháp thiết kế

I.1.

Sơ đồ khối giải pháp

I.2.

Phân tích chức năng các khối

-

Cảm biến khí gas MQ2: Dùng để phát hiện sự rị rỉ khí gas


-

Khối nguồn: Cung cấp nguồn cho toàn bộ hệ thống

tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas


tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas

-

Khối điều khiển trung tâm: Gồm STM32 và ESP8266: Nhận tín hiệu từ
cảm

biến khí gas, phát ra cịi và gửi các thông

số cho khối hiển thị
-

Khối cảnh báo: Gồm một loa phát ra cảnh báo khi nhận được tín hiệu từ
khối điều khiển trung tâm

-

Khối hiển thị: Gồm một màn hình LCD 16x2, hiển thị các thơng số nhận
được từ khối điều khiển trung tâm

tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas



tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas

II.

Thiết kế hệ thống

II.1. Thiết kế phần cứng
II.1.1.Giới thiệu STM32F103C8T6

STM32F103C8T6 là một trong những vi điều khiển tầm trung thuộc họ
STM32F103x8 theo kiến trúc vi mạch RISC. Bo mạch Blue Pill có chi phí thấp
có thể thay thế cho các bo mạch STM khác của hãng STMicroelectronics. Giá
của Blue Pill ở khoảng 2-3 $.

tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas


tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas

Bộ vi điều khiển STM32F103C8T6 có các chân GPIO, bộ xử lý, bộ nhớ, cổng
USB, bộ chuyển đổi tín hiệu Analog sang tín hiệu Digital và các thiết bị ngoại vi
khác. Một lõi ARM Cortex với tốc độ đáng kinh ngạc 72 MHz và hiệu suất năng
lượng tương đối.
Bo mạch STM32F103C8T6 blue-pill có lõi ARM 32-bit Cortex-M3 RISC với
bộ dao động bên trong 4 -16 MHz. Nó là một chip cơng nghệ flash CMOS. Chip
này có 37 chân GPIO và 10 chân Analog. Nó có một số giao thức giao tiếp hiện
đại như CAN và USB.

Các thiết bị ngoại vi cung cấp khả năng điều khiển vượt trội bo mạch vì nó hoạt
động với điện áp rất thấp, vì vậy nó phù hợp cho các ứng dụng cơng suất thấp.

Nó có một bộ watchdog và window watchdog timer để bo mạch vận hành chính
xác các dịng lệnh.
II.1.1.1. Thơng số kĩ thuật
Đặc tính và thiết bị ngoại vi

khả dụng

Kiến trúc vi mạch

RISC

Số lượng chân

47

SRAM

20 kiloBytes

Debug đường truyền dữ liệu nối tiếp

1

tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas


tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas

Bộ nhớ flash


64/128 KiloBytes

Tốc độ CPU

72 MHz (tối đa)

Cổng kết nối USB

Micro

ADC

2

Số bộ hẹn giờ

7

Giao tiếp truyền thơng

9

Module USB



I2C

2


SPI

2

Nhiệt độ hoạt động

-40 0 C – 105 0 C

Dòng điện sink/source

6 mA

Điện áp hoạt động

2.0V – 3.6V

tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas


tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas

Module USART

3

Bộ tạo dao động bên trong

4-16 MHz

Bộ hẹn giờ watchdog (WWDT)




Debug JTAG

1

 Một số đặc tính:
 Kiểm tra theo chu kỳ (CRC) để đảm bảo độ chính xác của dữ liệu dữ
liệu
 Có ba tùy chọn boot khác nhau (thông qua flash hoặc bộ nhớ hệ thống
hoặc SRAM) để reset bộ nhớ flash qua USART1
 7 bộ timer khác nhau để có các tốc độ lấy mẫu giá trị analog khác nhau
 Một giao thức nối tiếp JTAG (Joint Test Action Group) để gỡ lỗi và
kiểm tra bộ vi điều khiển
 Xung nhịp PLL để tạo sự ổn định bằng cách xử lý tín hiệu đầu ra và
đầu vào.
 Bộ timer Watchdog để quan sát các lỗi trong quá trình nhận và truyền
tín hiệu

tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas


tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas

II.1.1.2. Sơ đồ chân

Kiểu chân

Tên chân


Mô tả

Power

– 3,3V

1. Điện áp hoạt động đầu ra

– 5V

2. Chân cấp nguồn ở cổng USB

– GND

hoặc nguồn 5V bên ngoài
3. Chân nối đất

Chân Analog

PA0-PA7, PB0-PB1

Chân ADC độ phân giải 10, 12-

tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas


tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas

bit

Chân I / O

PA0-PA15, PB0-PB15, PC13-

37 chân I / O đa chức năng

PC15
Ngắt ngoài

PA0-PA15, PB0-PB15, PC13-

Chân ngắt

PC15
PWM

PA0-PA3, PA6-PA10, PB0-

15 chân điều chế độ rộng xung

PB1, PB6-PB9
Giao tiếp dữ liệu nối

TX1, RX1, TX2, RX2, TX3,

tiếp ( UART )

RX3

SPI


MISO0, MOSI0, SCK0,

Chân RTS, CTS USART

2 chân SPI

MISO1, MOSI1, SCK1, CS0
CAN

CAN0TX, CAN0RX

Chân Bus của mạng CAN

I2C

SCL1, SCL2, SDA1, SD2

Chân dữ liệu I2C và chân xung
nhịp

Đèn LED tích hợp

PC13

Đèn LED chỉ thị

tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas



tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas



Ngắt ngoài: Ngắt phần cứng được thực thi khi phát hiện sự thay đổi của
các tín hiệu bên ngồi.



PWM: Tổng cộng 15 chân điều chế độ rộng xung để tạo tín hiệu điện áp
tương tự analog từ các đầu ra PWM digital.



RTS / CTS: Request-to-Send / Clear-to-Send là một giao thức đảm bảo
kiểm soát việc truyền và nhận dữ liệu.



SPI : giao thức để giao tiếp giữa bộ vi điều khiển và thiết bị ngoại vi.



CAN: đường bus truyền dữ liệu theo hai hướng.



I2C : Một giao thức truyền dữ liệu nối tiếp khác để truyền dữ liệu đồng
bộ.


II.1.2.

Cảm biến khí gas MQ2

MQ2 là là cảm biến khí, dùng để phát hiện các khí có thể gây cháy. Nó
được cấu tạo từ chất bán dẫn SnO2. Chất này có độ nhạy cảm thấp với
khơng khí sạch. Nhưng khi trong mơi trường có chất ngây cháy, độ dẫn
của nó thay đổi ngay. Chính nhờ đặc điểm này người ta thêm vào mạch
đơn gian để biến đổi từ độ nhạy này sang điện áp.

tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas


tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas

Khi môi trường sạch điện áp đầu ra của cảm biến thấp, giá trị điện
áp đầu ra càng tăng khi nồng độ khí gây cháy xung quang MQ2 càng cao.
MQ2 hoạt động rất tốt trong mơi trường khí hóa lỏng LPG, H2, và
các chất khí gây cháy khác. Nó được sử dụng rộng rãi trong công nghiệp
và dân dụng do mạch đơn giản và chi phí thấp.
II.1.2.1. Thơng số kĩ thuật
 Điện áp hoạt động: 3.3V-5V
 Kích thước PCB: 3cm * 1.6cm
 Led đỏ báo nguồn vào, Led xanh báo gas
 IC so sánh : LM393
 VCC: 3.3V-5V
 GND: 0V

tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas



tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas

 DO: Đầu ra tín hiệu số (0 và 1)
 AO: Đầu ra Analog (Tín hiệu tương tự)
 Cấu tạo từ chất bản dẫn Sno2
 Có  2 dạng tín hiệu: Analog( AO)  và Digital (DO)             
      

 - Dạng tín hiệu : TTL đầu ra 100mA ( Có thể sử dụng trực
tiếp

Relay, Cịi cơng suất nhỏ...)

 - Điều chỉnh độ nhạy bằng biến trở
- Sử dụng LM393 để chuyển AO --> DO
 

 
 

tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas


tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas

II.1.2.2. Sơ đồ chân

Sơ đồ chân MQ2


tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas


tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas

- Trong đó:
o Chân 1,3 là A
o Chân 2,5 là B
o Chân 4,6 là C

tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas


tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas

 

II.1.2.3. Ứng dụng
Được sử dụng để phát hiện cácloại khí như :
+ LPG : là hỗn hợp hydrocarbon nhẹ, ở thể khí. LPG trong dân dụng
và cơng nghiệp chủ yếu có thành phần gồm Propane
+ Iso Butan ( C4H10 )
+ Propan : C3H8
+ Mêtan : CH4
+ Rượu : ROH

tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas


tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas


+ Hydrogen
+ Khói
II.1.2.4. Ưu điểm và nhược điêm
 Ưu điểm:
 Việc có chân ra số Dout rất tiện để mắc các ứng dụng đơn giản, không
cần đến vi điều khiển. Khi đó ta chỉ cần chỉnh giá trị biến trở tới giá trị
nồng độ ta muốn cảnh báo. Khi nồng độ MQ2 đo được thấp hơn mức
cho phép thì Dout = 1. Đèn Led tắt. Khi nồng độ khí đo được lớn hơn
nồng khí cho phép, Dout =0, đèn led sáng.
 Ta có thể ghép nối vào mạch Realy để điều khiển bật tắt đèn, còi, hoặc
thiết bị cảnh báo khác.
 Nhựơc điểm:
 Một điều khó khăn khi làm việc với MQ2 là ta khó có thể quy từ điện
áp Aout về giá trị nồng độ ppm. Rồi từ đó hiển thị và cảnh báo theo
ppm. Do giá trị điện áp trả về từng loại khí khác nhau, lại bị ảnh
hưởng nhiệt độ, độ ẩm nữa.
 Trong thiết, để xác định điểm cảnh báo phải thực hiện thủ công. Đầu
tiên đo trạng thái khơng khí sạch, giá trị thu được Vout1. Cho khí ga
từ bật lửa rị rỉ ra. Ta thấy giá trị Aout tăng lên. Khi đạt khoảng cách
khí ga từ bật lửa hợp lý rồi tương ứng với nồng độ khí bắt đầu nguy
hiểm, ta ghi lại giá trị Vout2. Ta chọn giá trị Vout2 là giá trị ngưỡng
cảnh báo. Nếu giá trị đo được lớn hơn thiết bị sẽ xuất tín hiệu cảnh
báo.
II.1.3.Giới thiệu màn hình hiển thị LCD 16x2
Thiết bị hiển thị LCD 1602 (Liquid Crystal Display) được sử dụng
trong rất nhiều các ứng dụng của VĐK. LCD 1602 có rất nhiều ưu
điểm so với các dạng hiển thị khác như: khả năng hiển thị kí tự đa dạng
(chữ, số, kí tự đồ họa); dễ dàng đưa vào mạch ứng dụng theo nhiều


tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas


tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas

giao thức giao tiếp khác nhau, tiêu tốn rất ít tài nguyên hệ thống, giá
thành rẻ,…

2.1.3.1. Thông số kĩ thuật
- Điện áp MAX : 7V
- Điện áp MIN : - 0,3V
- Hoạt động ổn định : 2.7-5.5V
- Điện áp ra mức cao : > 2.4
- Điện áp ra mức thấp : <0.4V
- Dòng điện cấp nguồn : 350uA - 600uA
- Nhiệt độ hoạt động : - 30 - 75 độ C

tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas


tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas

2.1.3.2. Sơ đồ chân

- Chân số 1 - VSS : chân nối đất cho LCD được nối với GND của mạch điều
khiển
- Chân số 2 - VDD : chân cấp nguồn cho LCD, được nối với VCC=5V của mạch
điều khiển
- Chân số 3 - VE : điều chỉnh độ tương phản của LCD
- Chân số 4 - RS : chân chọn thanh ghi, được nối với logic "0" hoặc logic "1":

+ Logic “0”: Bus DB0 - DB7 sẽ nối với thanh ghi lệnh IR của LCD (ở
chế độ “ghi” - write) hoặc nối với bộ đếm địa chỉ của LCD (ở chế độ
“đọc” - read)

tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas


tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas

+ Logic “1”: Bus DB0 - DB7 sẽ nối với thanh ghi dữ liệu DR bên trong
LCD
- Chân số 5 - R/W : chân chọn chế độ đọc/ghi (Read/Write), được nối với logic
“0” để ghi hoặc nối với logic “1” đọc
- Chân số 6 - E : chân cho phép (Enable). Sau khi các tín hiệu được đặt lên bus
DB0-DB7, các lệnh chỉ được chấp nhận khi có 1 xung cho phép của chân này
như sau:
+ Ở chế độ ghi: Dữ liệu ở bus sẽ được LCD chuyển vào thanh ghi bên
trong khi phát hiện một xung (high-to-low transition) của tín hiệu chân E
+ Ở chế độ đọc: Dữ liệu sẽ được LCD xuất ra DB0-DB7 khi phát hiện
cạnh lên (low-to-high transition) ở chân E và được LCD giữ ở bus đến khi
nào chân E xuống mức thấp
- Chân số 7 đến 14 - D0 đến D7: 8 đường của bus dữ liệu dùng để trao đổi thông
tin với MPU. Có 2 chế độ sử dụng 8 đường bus này là: Chế độ 8 bit (dữ liệu
được truyền trên cả 8 đường, với bit MSB là bit DB7) và Chế độ 4 bit (dữ liệu
được truyền trên 4 đường từ DB4 tới DB7, bit MSB là DB7)
- Chân số 15 - A : nguồn dương cho đèn nền
- Chân số 16 - K : nguồn âm cho đèn nền

tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas



tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas

II.1.4.Mạch nguyên lý

II.1.5.Mạch phần cứng
II.2. Thiết kế phần mềm - Arduino IDE
Arduino IDE được viết tắt (Arduino Integrated Development
Environment) là một trình soạn thảo văn bản, giúp bạn viết code để
nạp vào bo mạch Arduino.

tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas


tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas

Một chương trình viết bởi Arduino IDE được gọi là sketch, sketch
được lưu dưới định dạng .ino
Giao diện của Arduino IDE
Verify

Kiểm tra lỗi và biên dịch code

Upload

Dịch và upload code vào bo mạch đã được
cài đặt sẵn

New


Tạo sketch mới

Open

Mở một sketch có sẵn

tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas


tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas

tieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gastieu.luan.mon.thiet.ke.he.thong.nhung.de.tai.thiet.ke.thiet.bi.canh.bao.khi.gas



×