Robofun 機器人論壇

 找回密碼
 申請會員
搜索
熱搜: 活動 交友 discuz

藍芽與arduino通訊問題

查看數: 26128 | 評論數: 19 | 收藏 0
關燈 | 提示:支持鍵盤翻頁<-左 右->
    組圖打開中,請稍候......
發佈時間: 2011-11-26 18:17

正文摘要:

我想用android手機經由藍芽傳送訊號給arduino http://arduino.cc/en/Main/ArduinoBoardUno   所以買了一個bluetooth V3的藍芽模組,http://goods.ruten.com.tw/item/show?21106153954524#auc    ...

回復

kevin1234 發表於 2014-12-3 08:55:05
其實露天或Y拍有些 實習套件 可用手機藍芽控制四組插座開關 ,整套arduino,藍芽,四組插頭都做好,還附上arduino 跟android手機的source code,程式碼說明等等...改成自己想要的功能很方便。電路圖也有,不用自己在研究老半天... 搜尋 arduino+藍芽...
http://goods.ruten.com.tw/item/show?21449881951934
submarine 發表於 2012-8-14 12:33:33
成功!
再次改 BAUD RATE。 其實早前做過但不成功。
今次又得。
可參考 : http://coopermaa2nd.blogspot.hk/ ... to-ttl-adapter.html

code 及 schematic  : http://arduino.cc/playground/Learning/Tutorial01
submarine 發表於 2012-8-9 11:18:48
回復  vegewell

很謝謝你,但我身邊朋友其實沒有甚麼人在玩arduino所以也沒有板子可以借

問題其實就像 ...
k29645806 發表於 2011-12-8 02:42



    我的情況跟你一樣,沒有其他人借來試。  花了三天才看到這文章。
如果用 softserial, 可否改用其他 pin 來收訊息?
http://arduino.cc/hu/Reference/SoftwareSerial

Example
  /*
  Software serial multple serial test

Receives from the hardware serial, sends to software serial.
Receives from software serial, sends to hardware serial.

The circuit:
* RX is digital pin 10 (connect to TX of other device)
* TX is digital pin 11 (connect to RX of other device)

Note:
Not all pins on the Mega and Mega 2560 support change interrupts,
so only the following can be used for RX:
10, 11, 12, 13, 50, 51, 52, 53, 62, 63, 64, 65, 66, 67, 68, 69

Not all pins on the Leonardo support change interrupts,
so only the following can be used for RX:
8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).

created back in the mists of time
modified 25 May 2012
by Tom Igoe
based on Mikal Hart's example

This example code is in the public domain.

*/
#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup()  
{
  // Open serial communications and wait for port to open:
  Serial.begin(57600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }


  Serial.println("Goodnight moon!");

  // set the data rate for the SoftwareSerial port
  mySerial.begin(4800);
  mySerial.println("Hello, world?");
}

void loop() // run over and over
{
  if (mySerial.available())
    Serial.write(mySerial.read());
  if (Serial.available())
    mySerial.write(Serial.read());
}
k29645806 發表於 2011-12-8 02:42:14
回復 16# vegewell

很謝謝你,但我身邊朋友其實沒有甚麼人在玩arduino所以也沒有板子可以借

問題其實就像是外國論壇所述,電阻的問題,但我不知道是過高還是過低,總之在bluetooth TX與她連接之後


再用示波器量測 bluetooth TX的訊號就變成了只剩0.幾V,所以arduino一定讀不到


解決方法是用http://www.cedmagic.com/tech-info/data/7407.pdf 這顆晶片

把TX訊號先拉到5V再輸入,這樣才不會被arduino內部的阻抗把電壓拉低,測試過後就可以了
vegewell 發表於 2011-12-7 19:25:08
回復 15# k29645806


我想你現在應該沒有問題了,
如果你捨棄Arduino Uno, 而改用 Arduino Diecimila 或是Arduino Mega 1280 或是 DFRduino Duemilanove ,
問題就解決了,

我是想看你的整組連接的圖,
就我所知,
Arduino board and pc through Bluetooth protocol.
其裝置如下展示:
(請從part 3, 2分50秒處看起)
http://www.youtube.com/watch?v=eF2G5MSy118

你的接法應該一樣吧,
vegewell 發表於 2011-12-1 20:38:04
本帖最後由 vegewell 於 2011-12-1 20:43 編輯
回復  vegewell

其實我原本的用意只是想找一個簡單的無線通訊裝置,但這一直克服不了


請問大家都是用哪種無線裝置跟arduino溝通啊?


Xbee wifi bluetooth ethernet? 哪種比較簡單??k29645806 發表於 2011-11-30 20:50



不必先找別的無線裝置,
還是先試試 連接 Arduino Diecimila 或是Arduino Mega 1280 或是 DFRduino Duemilanove 來用,
不想買用借的也行,

你說你的電腦,用電腦程式teraterm經由serial port com4與藍芽模組連接,
我沒有看到與電腦連線的圖片,
你能秀出來嗎?
你所謂的 [serial port com4與藍芽模組連接,]
是九針的 RS-232 Port還是 USB port 與藍芽模組連接?
k29645806 發表於 2011-12-1 00:19:55
回復 12# sinocgt

1.給3.3V時, 你有檢查arduino RX嗎? 也是3.3V?
2.TX, RX有問題的話應該不能燒入程式,我想arduino版子應該沒問題.
3.有試bluetooth module AT mode可以更改Baud rate? V3.0要注意AT mode跟normal mode的切換!

是,我用示波器bluetooth V3的TX也就是接到arduino的RX的接點約3.3V(電腦傳訊號時)
baud rate的default設定在9600應該是沒問題,因為電腦也確實收到bluetooth V3給的訊號

AT mode我調在數字的位置,也就是ON的另一邊所以應該是normal mode沒錯

請問arduino RX TX端當有訊號傳進傳出RX TX燈沒亮是正常現象嗎?
還是我有什麼東西沒開?
sinocgt 發表於 2011-11-30 20:59:10
1.給3.3V時, 你有檢查arduino RX嗎? 也是3.3V?
2.TX, RX有問題的話應該不能燒入程式,我想arduino版子應該沒問題.
3.有試bluetooth module AT mode可以更改Baud rate? V3.0要注意AT mode跟normal mode的切換!
k29645806 發表於 2011-11-30 20:50:16
回復 9# vegewell

我當初也不太想弄通訊的問題,畢竟我們實驗室不是搞通訊的,裡面也沒人會

但要製作機器人總要用無線的,才會想選用藍芽,以為藍芽是有效又簡單的通訊裝置


一直以為是傳輸端的問題,所以不僅用teraterm android手機 甚至用labview丟字串給它都無效


也一直找不到有關於藍芽原理或是實作的書...


其實我原本的用意只是想找一個簡單的無線通訊裝置,但這一直克服不了


請問大家都是用哪種無線裝置跟arduino溝通啊?


Xbee wifi bluetooth ethernet? 哪種比較簡單??
k29645806 發表於 2011-11-30 20:35:16
回復 8# sinocgt

我是用3.3V供電的,
嘗試用示波器看TX的波形,發現丟不同字串的確有不同的方波波型,大小約3.3V

用npn升壓至5V還是行不通,的確不是電壓的問題,

但波形都出來了,為什麼還會接收不到?

是訊號有檢查碼,還是該多對訊號做什麼處理嗎?不是就是serial的傳輸方式嗎?

還是arduino UNO的RX根本是有問題的,有辦法檢查嗎?
vegewell 發表於 2011-11-30 19:50:01
回復 7# k29645806


    我想如果連 DFRobot Forum 的 Administrator Ricky ,
都說[we have identified that DF-Bluetooth V3 is not compatible with offical Arduino UNO Mega 2560. ]

如果你去買 Arduino Diecimila 或是Arduino Mega 1280來用,應該就可以了,
多買一塊Arduino板子也是好的,反正你以後也可能用到,
Arduino UNO就是不行:
http://www.youtube.com/watch?v=rT31q1vdhAg
sinocgt 發表於 2011-11-30 08:26:29
你的藍芽Vcc是接多少電壓? 5V or 3.3V? 試者接3.3V!
k29645806 發表於 2011-11-29 23:26:46
回復 4# vegewell


加電阻測試後,還是無效~
而且他不是說電阻值過高嗎?怎麼還要加電阻~
sinocgt 發表於 2011-11-29 13:06:23
把你連接的硬體拍個照post上來看看,以及你的arduino 程式也post上來. 藍芽傳輸控制不是很難! 你說的TX  4.46V不是問題所在. 有空可以參考我的blog. http://sinocgtchen.blogspot.com
vegewell 發表於 2011-11-28 18:22:29
本帖最後由 vegewell 於 2011-11-28 18:28 編輯

回復 3# k29645806


    他的意思是:
[The only way is to modify the resistor.  Replace the 1k resistor to 4.7k will do the work. ]

也許你要在arduino RX端 接一顆 3.7K電阻(with 1k resistor 串聯)然後再接線到 Bluetooth
k29645806 發表於 2011-11-27 21:37:31
應該不是serial的問題,因為我是直接把訊號給arduino
我查到的是這個:

因為arduino RX的電阻值太高導致沒辦法接收到訊號,但似乎沒有solution
但判斷0跟1的訊號不是看電壓嗎?怎麼會跟電阻有關,
目前還是沒有想到解決的辦法~
http://ppt.cc/xU;v

http://ppt.cc/nKQ2



vegewell 發表於 2011-11-27 15:08:02
回復 1# k29645806


    你有沒有裝usb to serial驅動程式?

小黑屋|手機版|Archiver|機器人論壇 from 2005.07

GMT+8, 2024-6-12 05:32 , Processed in 0.366233 second(s), 12 queries , Apc On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回復 返回頂部 返回列表