[iPhone][AVR]iPhoneにAVRマイコン(Atmel ATtiny2313)をつないでみた
iPhoneのDock Connectorにマイコンをつないでみた。
使ったのは、AVRのATtiny2313。
BASCOM-AVRでUSARTに9600bps/8/1/NONEで「test」という文字列を送り続けるプログラムを焼いて、それをiPhoneに接続してみた。
接続は以下の通り。
| iPhone | → | Atmel ATtiny2313 |
| GND (1pin) | → | GND (10pin) |
| TXD (12pin) | → | RXD (2pin) |
| RXD (13pin) | → | TXD (3pin) |
| +3.3V Power (18pin) | → | VCC (20pin) |
参考: http://en.wikipedia.org/wiki/Dock_Connector
参考: http://devdot.wikispaces.com/Iphone+Serial+Port+Tutorial
iPhone側では、CydiaからインストールしたRubyに、セルフコンパイルしたruby-serialportを追加して、以下のようなスクリプトを実行。
#!/usr/bin/env ruby require "serialport" port = "/dev/tty.iap" sp = SerialPort.new(port, 9600, 8, 1, SerialPort::NONE) while (res = sp.gets) puts res end
これでマイコンから送信された文字列の受信を確認できた。
iPhoneからの送信もそのうち実験してみよう。
ちなみに、iPhoneがスリープして数秒たつと、Dock Connectorからの給電は止まってしまう。
メールを受信したらスリープ中もLEDを光らせるユニットを考えていたんだけど、これではだめだね。
でも、いろいろなことができそうだ。
うさん臭いDock Connectorユニットを作ってみよう。
8ピンのAVRはUSARTが無くて面倒臭いので、SOIC版のATtiny2313を仕入れてこようか。
« [AVR]ATmega644PにSanguinoのBootloaderを焼いてみたり | Main | [iPhone][AVR]iPhoneにAVRマイコン(Atmel ATtiny45)をつなぎ温度計測してみた »
The comments to this entry are closed.





Comments
Interesting article , we have also make use of the iphone dock serial port to link to Holux GPS for the addon module for the iPhone 2G.
some demo video for the iPhone GPS cable
http://igpsd.wordpress.com/2008/10/08/iphone-version-20-navigation-with-freemap-for-israel/
Posted by: Chris Chan | 2008.10.23 at 07:16 PM
iPhone2Gを使ってシリアル通信を試してるのですが
http://www.kako.com/neta/2008-010/2008-010.html
Dockコネクタの11pinに細工をしないと警告がでたりします。
iPhone3Gだと問題ないのでしょうか?
Posted by: kako | 2008.10.23 at 08:47 PM
Hi Chris,
Thank you for your interest.
And I'm quite interested in your project/product.
"iPhone GPS Cable" is a Serial-USB reverse direction converter, Isn't it?
If that is true, very very niche product.
However, It is awesome for a GPS addicts like myself. Great!
I would like to run gpsbabel on iPhone, and download log from GPS Logger.
I guess maybe "iPhone GPS Cable" help it.
Could you tell me your opinion?
My equipments are shown below:
* Holux m-241
* Wintec WBT-201
* B-Speech GPS 20C
* i-Blue 757 Pro
I'm the same breed.
I wish that iPhone supports SPP for quite a while....
Posted by: moyashi | 2008.10.24 at 03:09 AM
>>kako
ページ拝見させていただいてます。
11番、21番に関する記述は方々で見ていますが、特に特別な処置はいらないようですね。
iPod touch以前の情報もあるので、必要だったり、必要でなかったりという話が出てくるのだと思ってます。
あとは使うAPIによるのかもしれません。
IOKit経由だと警告が出るのかもしれません。
今回はtermioなんかからだと思うので、それが結果に影響しているかもしれません。
Posted by: moyashi | 2008.10.24 at 03:16 AM