- 標題:[課程名稱] 準時就輸了
- 內容:
1. 組員名字:張子濰、許聿銘、謝秉哲
2. 各週實作紀錄、查找資料等等:- https://yunlinsong.blogspot.com/2016/09/arduino_15.html 上課時有提及可參考的網站(內容較完整)、有程式碼
- https://www.taiwaniot.com.tw/product/l9110s-雙通道直流電機驅動模組-兩路步進電機驅動板/ L9110S驅動板
- http://web.htjh.tp.edu.tw/B4/105-2robot/L298N馬達驅動模組介紹.pdf L298N 介紹
- https://livingtech.education/2018/06/03/arduino實用-hc-05-at-mode主從配對/ 工概助教發表的HC-05相關資料
- https://shopee.tw/Tello-原廠馬達(拯救自己的空拍機)-i.10011199.1405017012 空拍機的馬達:D
目前想法:
先照著網路上找到的資源複製出一台Arduino車,熟悉藍芽裝置和操控方式。
三輪架構(一前兩後),前為萬向輪,後輪目前設定使用發放的輪子和馬達,如果測試後覺得不夠理想,會找不同的零件改良。車體使用PP塑膠板,後續有更好的想法會再購買材料做改進。
12/16更新:今天去了今華跟光華,找了我們缺的一些零件後發現兩家價格差很大,簡直嚇死,怎麼同樣的東西可以差40塊,不久後就地震了,把我震回家找資料,看一下價格大概多少才是合理、也打算問一下學長姐的建議。
我們全新的零件需求(還缺的)有:
Arduino NANO x2
NRF24L01+ x2
RF+NANO x1
ADXL335 x1
TT 直流馬達 x4
輪子 x4
我們在網路上看到很帥的、可以用頃斜角度控制車子前進後退的方式,而她的優點在於不用擔心藍牙配對不到手機,因為他是接收器和發信器兩者連結,我覺得會比較穩定,目前在查更多資料,想辦法買到零件、完成這…車車
12/19課前更新:
原本打算開始執行上面的製作過程,不過實際走一趟商場及在網路上查資料後,有兩個零件買不到,一個是需要客製化的板子(有詢問過學長,不一定需要那個板子,可以用其他擴充板達到需求,不過組員覺得風險很高)、還有就是RF+Nano板也買不到,所以最後我們打算回歸用Arduino Uno製作車子,大致上材料都已經齊全,禮拜天會再更新直接完成車子,目前缺的材料有:
Motor Driver Shield x1
六腳開關一個 x1
最終定案:
使用L293D板子,接上四顆輪子,達到四輪皆可由馬達控制轉動的效果。
而車體使用先前製作氣球車多餘的PP塑膠板呈現,簡單的一個板子黏上Arduino板及電池盒,車底黏上四顆馬達,最後製作出一台像是越野車的藍芽車原型。
程式有別於設定電位差,我導入函式庫AF.motor.h 直接setspeed(數值)作為馬達轉動的依據
程式碼如下:
Install AF Motor Library
#include AFMotor.h
//initial motors pin
AF_DCMotor motor1(1, MOTOR12_1KHZ);
AF_DCMotor motor2(2, MOTOR12_1KHZ);
AF_DCMotor motor3(3, MOTOR34_1KHZ);
AF_DCMotor motor4(4, MOTOR34_1KHZ);
char command;
void setup()
{
Serial.begin(9600); //Set the baud rate to your Bluetooth module.
}
void loop(){
if(Serial.available() > 0){
command = Serial.read();
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;
}
}
}
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
motor2.run(BACKWARD); //rotate the motor anti-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 left()
{
motor1.setSpeed(255);
motor1.run(BACKWARD);
motor2.setSpeed(255);
motor2.run(BACKWARD);
motor3.setSpeed(255);
motor3.run(FORWARD);
motor4.setSpeed(255);
motor4.run(FORWARD);
}
void right()
{
motor1.setSpeed(255);
motor1.run(FORWARD);
motor2.setSpeed(255);
motor2.run(FORWARD);
motor3.setSpeed(255);
motor3.run(BACKWARD);
motor4.setSpeed(255);
motor4.run(BACKWARD);
}
void Stop()
{
motor1.setSpeed(0);
motor1.run(RELEASE);
motor2.setSpeed(0);
motor2.run(RELEASE);
motor3.setSpeed(0);
motor3.run(RELEASE);
motor4.setSpeed(0);
motor4.run(RELEASE);
}


成品圖:

使用的操控軟體為:
Arduino Bluetooth RC Car

製作過程中遇到的問題如下:
- 電池盒接觸不良,輕微震動會斷電導致需重新連接藍芽以繼續控制車子
除此之外並無大問題,最後雖然沒有跑前幾名但依舊順利從圖書館駛回科技與工程大樓一樓,還是非常的開心。能夠在大一上就體驗到自行製作藍芽車子並成功操縱的感覺很特別,未來可能會買材料回家自己做一台性能更好的車!