總網頁瀏覽量

2011年9月27日 星期二

Line Tracing Robot (自走車) = Arduino + CNY70 + L298N

這幾天把放一段時間的五顆 CNY70 紅外線sensor拿出來自做了一台自走車,還沒有調整很好,隨手用蝴蝶夾固定sensor,意思到就好! 用家裡也擺一段時間的黑色膠帶黏在白板背面當作車子軌道.9V的電池被我操的快沒電了! 有興趣或有問題的朋友們可以email to me: sinocgtchen@gmail.com 




材料:
1. CNY70 sensor x 5 (三顆也可以)
2.Arduino board x 1
3. L298N board x 1
4. 9V battery x 2
5. 線材幾條


ps.所有材料拍賣網站都可以買到包含平台車.







My email : sinocgtchen@gmail.com
My Youtube: http://www.youtube.com/user/sinocgtchen
Motoduino 參考網站: http://motoduino.com



2011年9月26日 星期一

Arduino Atmega328 supporting

很少人會拿到Atmega328要用在arduino上開發,通常都是用Atmega328P, 如何修改Arduino環境來使用 Atmega328(不是Atmega328p),基本上只有Signature不一樣,Atmega328P是1E950F, Atmega328是1E9514,最簡單方式就是修改arduino signature的check.底下做法也可以用在其他Mega系列.

1.修改AtmegaBoot_168.c
增加底下定義
#elif defined __AVR_ATmega328__
#define SIG2 0x95
#define SIG3 0x14
#define PAGE_SIZE 0x40U //64 words

2.修該Makefile
增加底下定義
atmega328_pro16: TARGET = atmega328_pro_16MHz
atmega328_pro16: MCU_TARGET = atmega328
atmega328_pro16: CFLAGS += '-DMAX_TIME_COUNT=F_CPU>>4' '-DNUM_LED_FLASHES=1' -DBAUD_RATE=57600 -DDOUBLE_SPEED
atmega328_pro16: AVR_FREQ = 16000000L
atmega328_pro16: LDSECTION  = --section-start=.text=0x7800
atmega328_pro16: $(PROGRAM)_atmega328_pro_16MHz.hex

3.產生bootloader的 command :
    >make clean
    >make atmega328_pro16
  將產生  ATmegaBOOT_168_atmega328_pro_16MHz.hex
   
4.修改avrdude.conf

#------------------------------------------------------------
# ATmega328P
#------------------------------------------------------------

 signature = 0x1e 0x95 0x0F;
改成
 signature = 0x1e 0x95 0x14;

5.在 boards.txt修改或增加一項,如下
##############################################################

pro5v328.name=My Arduino Pro(16MHz) w/ ATmega328

pro5v328.upload.protocol=stk500
pro5v328.upload.maximum_size=30720
pro5v328.upload.speed=57600

pro5v328.bootloader.low_fuses=0xFF
pro5v328.bootloader.high_fuses=0xDA
pro5v328.bootloader.extended_fuses=0x05
pro5v328.bootloader.path=atmega328Led
pro5v328.bootloader.file=ATmegaBOOT_168_atmega328_pro_16MHz.hex
pro5v328.bootloader.unlock_bits=0x3F
pro5v328.bootloader.lock_bits=0x0F

pro5v328.build.mcu=atmega328p
pro5v328.build.f_cpu=16000000L
pro5v328.build.core=arduino

6.利用Arduino把bootloader燒錄:
  a.打開arduino選擇Tools的Board: "My Arduino Pro(16MHz) w/ ATmega328"
  b.選擇Burn Bootloader 如USBtinyISP

下圖(手機拍攝不是很清楚)我把Atmega328 mounting上去的arduino板子,一切正常work.
有興趣或有問題的arduino同好,可以mail me: sinocgtchen@gmail.com

2011年9月17日 星期六

手機無線遙控車 = mobile phone + Arduino + WiFi + Car + L298N

這次改用田宮出品的玩具車套件來組裝一台車,Arduino板子可以用螺絲固定在底板上面,電池用雙面膠暫時黏住,提供Arduino電源. 利用 Android 手機來控制 WiFi (http server)車子. 影片在此  http://www.youtube.com/user/sinocgtchen , 架起來拍錄比較容易.

田宮材料表較貴但是質感比較好,拍賣網站可以買到我組裝的所有材料!
想了解如何製作或有興趣可以mail me : sinocgtchen@gmail.com



                                               利用自己寫的簡單web page控制車子.


My email : sinocgtchen@gmail.com
My Youtube: http://www.youtube.com/user/sinocgtchen
Motoduino 參考網站: http://motoduino.com




 有任何問題或有興趣朋友,歡迎來信討問,謝謝!!

                   

無線遙控車 = Arduino + WiFi + Web Server + Browser + Car + L298N

這次利用Cooperhead WiFi Shield 加到Arduino board可以透過手機,PC, Notebook來控制小車子, Arduino上寫了一個簡單的web server (Http server),可以解析從瀏覽器傳過來的命令, 試過無線AP設定網路安全機制為WEP及 WPA都可以正常運作.
車子可以前進,後退,左轉,右轉,停止.




 WiFi Shield 未疊上去

 WiFi Shield 疊上去後


簡單控制車子的 webpage


材料需求:
1. Arduino L298N or L293 Motor Driver Shield (驅動馬達用)
2.Cooperhead WiFi Shield (802.11b 無線傳輸擴充板)
3. 9V 電池一顆(Arduino用), 1.5V電池四顆or 9V電池一顆也可以(Motor用)
4. 兩輪車子底盤一組
5. 一些24 or 20 AWG線材等.....


這些材料拍賣網站都可以買的到,有興趣的可以自己DIY,有問題可以互相討論,
順便看一下影片:  http://www.youtube.com/user/sinocgtchen

我的email: sinocgtchen@gmail.com  



2011年9月4日 星期日

Arduino + UltraSonic + Servo + L293D + Car


This time I attached a ultrasonic and Servo to arduino (Atmega328P) with motor driver IC(L293D). The car can avoid objects by using a ultrasonic. If anyone is interested in this, or any questions, mail me: sinocgtchen@gmail.com (my youtube: http://www.youtube.com/user/sinocgtchen  ) . 


這次把超音波感測器裝上arduino小車,偵測障礙物距離避開障礙物. 整個控制還未調整到理想狀態.有時間在進行改良! 這次也把兩個輪子的馬達改成減速馬達,扭力較大在圓型的底盤也較好控制. 詳細做法及sketch可以參考這期的 Make: 01雜誌.


影片在我的Youtube : http://www.youtube.com/user/sinocgtchen 







相關影片請看: http://www.youtube.com/user/sinocgtchen
   部落格 :  http://sinocgtchen.blogspot.com
   相關購買資訊: http://motoduino.com

   有任何問題或有興趣朋友,歡迎來信討問,謝謝!!

2011年8月25日 星期四

Arduino + SPI LED (8 digital bits serial LED)

今天來試試小東西 SPI 介面的 LED 如下圗,程式也不難.
此例是從PC鍵盤輸入任何數字都可以顯示(數字會往右Shift).







//Pin connected to latch pin (ST_CP) of 74HC595
const int latchPin = 8;
//Pin connected to clock pin (SH_CP) of 74HC595
const int clockPin = 3;
////Pin connected to Data in (DS) of 74HC595
const int dataPin = 9;
byte Tab[]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90,0xff};
void setup() {
  //set pins to output because they are addressed in the main loop
  pinMode(latchPin, OUTPUT);
  pinMode(dataPin, OUTPUT);  
  pinMode(clockPin, OUTPUT);
  Serial.begin(9600);
  Serial.println("reset");
}
void loop() {
  if (Serial.available() > 0) {
    // ASCII '0' through '9' characters are
    // represented by the values 48 through 57.
    // so if the user types a number from 0 through 9 in ASCII, 
    // you can subtract 48 to get the actual value:
  int bitToSet = Serial.read() - 48;
  // write to the shift register with the correct bit set high:
  digitalWrite(latchPin, LOW);
  // shift the bits out:
  shiftOut(dataPin, clockPin, MSBFIRST, Tab[bitToSet]);
    // turn on the output so the LEDs can light up:
  digitalWrite(latchPin, HIGH);
  }
}







2011年8月17日 星期三

Arduino: bluetooth name/baud rate changing 使用FT232RL(USB轉TTL)改變藍牙Baud rate

這次來說明最簡單的方式修改bluetooth設定值,如  Name, Baud rate,......
1.把bluetooth module和FT232RL連接起來.如圖 .
2.插入USB到PC,打開Arduino 的COM Port Monitor.
3.注意monitor中的"baud rate"設定跟 "no line ending".要設定正確!
4.直接在monitor的command line下AT command.例如 AT+BAUD7(表示設定baud rate成 57600)
5.然後按下Send, bluetooth 將會回應 OK57600之類的訊息,表示修改成功!
有問題可以email me: sinocgtchen@gmail.com