Sản phẩm sau khi hoàn thiện

Một phần của tài liệu ĐỒ ÁN HỆ THỐNG ĐIỀU KHIỂN TỰ ĐỘNG (Trang 27)

TS. Vũ Văn Phong

Hình 4- 8 Mặt trên của robot.

TS. Vũ Văn Phong

CHƯƠNG 5

KẾT LUẬN VÀ HƯỚNG PHÁT TRIỂN 5.1 Kết luận

Ưu điểm:

- Động cơ chạy tương đối ổn định.

- Tốc độ sử lí nhanh, đáp ứng nhanh ít bị vọt lố. - Tín hiệu sử lí tốt không bị nhiễu sóng.

Khuyết điểm

- Có một số tốc độ chạy vẫn có độ vọt lố khá cao. - Mô hình vẫn chưa được đẹp mắt.

5.2 Hướng phát triển

- Có thể phát triển giải thuật và phần cứng lên để ứng dụng vào nhiều thiết kế điều khiển hơn.

- Xây dựng giải thuật hoàn chỉnh hơn nữa để dù chạy ở tốc độ nào thì động cơ đều có độ vọt lố thấp nhất.

TS. Vũ Văn Phong

TÀI LIỆU THAM KHẢO

[1]http://arduino.vn/bai-viet/42-arduino-uno-r3-la-gi. [2] https://advancecad.edu.vn/khai-niem-co-ban-ve-truyen-thong-uart-so-do-khoi-ung- dung/. [3] https://hshop.vn/products/mach-thu-phat-bluetooth-hc-05-do-ra-chon-master [4] https://nshopvn.com/product/arduino-motor-shield-l293d/ [5] https://icdayroi.com/dong-co-giam-toc-v1 [6] http://arduino.vn/bai-viet/281-mach-cau-h-va-dieu-khien-dong-co-voi-sn754410

[7] Nguyễn Đình Phú, giáo trình thực hành vi điều khiển PIC, Đại Học Sư Phạm Kỹ Thuật TP Hồ Chí Minh, 2017.

TS. Vũ Văn Phong

PHỤ LỤC

Chương trình chính://ArduinoBluetooth Controlled Car//

//// Before uploading the code you have to install the necessary library//

//AFMotor Library https://learn.adafruit.com/adafruit-motor-shield/library-install //

#include <AFMotor.h>

//initial motors pin

AF_DCMotor motor1(1); AF_DCMotor motor2(2); AF_DCMotor motor3(3); AF_DCMotor motor4(4); char command; void setup() {

Serial.begin(9600); //Set the baud rate to your Bluetooth module.

}

void loop(){

if(Serial.available() > 0)

{

TS. Vũ Văn Phong

Stop(); //initialize with motors stoped

//Change pin mode only if new command is different from previous.

//Serial.println(command); switch(command) { case 'F': forward(); break; case 'B': back(); break; case 'L': left(); break; case 'R': right(); break; } }

TS. Vũ Văn Phong

}

void forward ()

{

motor1.setSpeed(255); //Define maximum velocity

motor1.run(FORWARD); //rotate the motor clockwise

motor2.setSpeed(255); //Define maximum velocity

motor2.run(FORWARD); //rotate the motor clockwise

motor3.setSpeed(255);//Define maximum velocity

motor3.run(FORWARD); //rotate the motor clockwise

motor4.setSpeed(255);//Define maximum velocity

motor4.run(FORWARD); //rotate the motor clockwise

}

void back ()

{

motor1.setSpeed(255); //Define maximum velocity

motor1.run(BACKWARD); //rotate the motor anti-clockwise

motor2.setSpeed(255); //Define maximum velocity

TS. Vũ Văn Phong

motor3.setSpeed(255); //Define maximum velocity

motor3.run(BACKWARD); //rotate the motor anti-clockwise

motor4.setSpeed(255); //Define maximum velocity

motor4.run(BACKWARD); //rotate the motor anti-clockwise

}

void right()

{

motor1.setSpeed(255); //Define maximum velocity

motor1.run(BACKWARD); //rotate the motor anti-clockwise

motor2.setSpeed(255); //Define maximum velocity

motor2.run(BACKWARD); //rotate the motor anti-clockwise

motor3.setSpeed(255); //Define maximum velocity

motor3.run(FORWARD); //rotate the motor clockwise

motor4.setSpeed(255); //Define maximum velocity

motor4.run(FORWARD); //rotate the motor clockwise

}

void left()

TS. Vũ Văn Phong

motor1.setSpeed(255); //Define maximum velocity

motor1.run(FORWARD); //rotate the motor clockwise

motor2.setSpeed(255); //Define maximum velocity

motor2.run(FORWARD); //rotate the motor clockwise

motor3.setSpeed(255); //Define maximum velocity

motor3.run(BACKWARD); //rotate the motor anti-clockwise

motor4.setSpeed(255); //Define maximum velocity

motor4.run(BACKWARD); //rotate the motor anti-clockwise

}

void Stop()

{

motor1.setSpeed(0); //Define minimum velocity

motor1.run(RELEASE); //stop the motor when release the button

motor2.setSpeed(0); //Define minimum velocity

motor2.run(RELEASE); //rotate the motor clockwise

motor3.setSpeed(0); //Define minimum velocity

motor3.run(RELEASE); //stop the motor when release the button

TS. Vũ Văn Phong

motor4.run(RELEASE); //stop the motor when release the button

Một phần của tài liệu ĐỒ ÁN HỆ THỐNG ĐIỀU KHIỂN TỰ ĐỘNG (Trang 27)