底下是主要的線路設計,最後還是用<MS小畫家>直接畫,為了方便性等等其他原因
全部都用模組化零件,這樣就算不是很懂電子電路的新手或小朋友也可以用麵包版,在不需任何焊接的情形下做好系統.
## <Below is my Bt_SmartCar H/W design & circuit ,It is conveinent to put all of modules on the Lab platform. without welding anything,I think it is good for children or education purpose.>
<Picture 1> 線路設計 <H/W Circuit> 可以另存新檔下載放大.
有一個設計的重點要特別注意,我是用4顆 L9110H分別4顆驅動直流馬達(一個L9110H模組上有兩棵),一般其他設計上 L9110H 的輸入端IA/IB 有一真值表如<picture 2>,直接控制輸入high(高電位) or low(低電位).來控制正反轉,但是這樣不能控制速度,於是我把它改成用PWM的方式輸入IA/IB.PWM訊號等於0時就相當於low. 其他值100-255之間就相當於High(H)同時也可以控制速度.低於100的值有可能太低馬達扭力不足於驅動車子.
##<One important point need to pay attention.I used 4 L9110H IC to driver motors ,(Each L9110H module with 2 L9110H IC)>.Generically , L9110H have the True/False table to control the motors' clockwise or anti-clockwise like as <Picture 2>But in this situation .we can not control the Speed.So in order to controll the speed I use the PWM as input signal to IA/IB .>
但是Arduino Nano 只有3組PWM ,D3,D5,D6,D9,D10,D11.所以底下第一版的設計,將後輪兩輪的輸入訊號都是由D10,D11同步控制,D3/D5 則單獨控制左前輪,D5,D6則單獨控制右前輪.
##<However,Arduino Nano just have 3 pairs of Pins can be as PWM function,They are D3,D5,D6,D9,D10,D11.so In my design I use D10,D11 to controll the both of Backsite Wheels
,D3/D5 for left-front side wheel and ,D6/D9 for left-front side wheel >
另外我是用兩顆18650锂電串聯,所以充飽電壓會到達8.4V之多,所以對感測器而言只能接5V,千萬不要接到Vin,否則感測器會燒掉.TT直流減速馬達,經過我試驗在全速跑時也就是近於8.4V最高壓時仍然可正常動作也不會過熱,加上我用PWM去控制,通常速度我都只設在70-80%所以目前試起來沒什麼問題.
##<I used 2s 18650 Li battery ,it's voltage can arrive max 8.4V . So for the sensor module must be connect to Pin +5V not Pin VIN,VIN will be connected to 18650 battery +. >
如果實際運轉時發現馬達轉向不對,那就試著把OA/OB對調就可以了
或是調整軟體
##<IF The motor driver direction is wrong ,you can try to exchange OA/OB or modify software like below sample >
A.如果這樣是反轉 (IF this is anti-clockwise)
speed =180; //defaul value 用手機可調整控制
analogWrite(M1APin,0);
analogWrite(M1BPin,speed);
analogWrite(M2APin,0);
analogWrite(M2BPin,speed);
analogWrite(M3APin,0);
analogWrite(M3BPin,speed);
B. 那改這樣就會正轉(then below will be clockwise)
analogWrite(M1APin,speed);
analogWrite(M1BPin,0);
analogWrite(M2APin,speed);
analogWrite(M2BPin,0);
analogWrite(M3APin,speed);
analogWrite(M3BPin,0);
<Picture 2>L9110H
Arduino 範例程式下載
Download Arduino sample codes:
https://www.dropbox.com/s/i2r27jhsa9z08qo/BT_SmartCar_A.ino?dl=0
裡面只提供預設手機遙控模式跟Debug 模式,也就直接燒錄這個程式配合下面的APP
可以有手機遙控功能,
##<The source code I provide have only Phone controlled mode and Debug mode(by serial port) >
Debug 模式就是連著USB到電腦用序列監控視窗 進行操作
要手動把code預設ModeSelect=='A' 手機模式設成ModeSelect=='Q'
這樣就可以用電腦鍵盤進行除錯工作.
##<For debug mode ,you need to change the default ModeSelect=='A' to ModeSelect=='Q'
and re-build source code,then you can use the serial port and PC's keyboard to controll the car.>
[code Sample:] When ModeSelect=='Q') //serial port debug mode
Serial.begin(115200);
Serial.println("press '0'~'9' : setup speed");
Serial.println("press 'S' : stop");
Serial.println("press 'F' : front");
Serial.println("press 'B' : back");
Serial.println("press 'R' : turn right");
Serial.println("press 'L' : turn left");
至於另兩個模式自動避障及循跡模式或是防掉落就保留給大家自由發揮吧.
##<Regarding other modes like as auto mode & trace mode ,just program it by your idea.>
Download Android APK:
https://www.dropbox.com/s/1j7myzv1gro9qlx/SmartCar_BT%20.apk?dl=0
Building the Android APP to control Arduino Smart Car (製作Android APP控制Arduino 智慧車)
3DP elements & assembly.
Build the BT_SmartCar with 3DP & Arduino -Mechanism part(用3D列印和arduino製作藍芽智慧小車-機構部分)