ArduinoでFonとシリアル通信(DD-WRT化)

arduino_and_fon

しばらくFonとして運用していましたが、MyPlace、FON_APともあまりにも遅く、接続が頻繁に途切れるなどトラブルが多かったので物置に眠っていたのですが、DD-WRT化の実験のために取り出してきました。

OSX + Arduino + Fonで正常に書き換えできましたのでメモしておきます。

コネクタケーブル作成

材料

  • Fon
  • Arduino
  • ケーブル
  • 1×6メスコネクタ

コネクタへケーブルを次のようにはんだづけします。

  • 黒: GND – 1pin
  • 緑: TX – 3pin
  • 黄: RX – 4pin

 

Fon、Arduinoと接続

IMG_0519.JPG IMG_0521.JPG

FonにはGND(黒)を箱側にして2列のIC側に接続します。Arduinoには黒-GND、緑-TX-6ピン、黄-RX-7ピンに接続します。

ソフトウェア

AF_SoftSerial libraryをダウンロードし、Arduinoのディレクトリのhardware/libraryにコピーします。

Arduinoに次のコードを入力し転送します。
[sourcecode language='c']
#include

AFSoftSerial mySerial = AFSoftSerial(6, 7);

void setup() {
pinMode(13, OUTPUT);
Serial.begin(9600);
// set the data rate for the SoftwareSerial port
mySerial.begin(9600);
}

void loop() // run over and over again
{
if (mySerial.available()) {
Serial.print((char)mySerial.read());
}
if (Serial.available()) {
mySerial.print((char)Serial.read());
}
}
[/sourcecode]

接続

Fonの電源を入れるとシリアルコンソールに起動画面が表示されるはずです。

OSXでは

ターミナルを立ち上げ

screen /dev/tty.usbserial-A4001sLW

とすることで、Fonと接続できます。接続ができたらこちらの手順にそってDD-DRT化することができます。

備考

FonのRXを接続したままでは電源を入れても起動しない場合があります。その場合はArduinoから黄色のケーブルを抜いておいて起動メッセージが表示された後にケーブルを接続します。

参考:

http://www.ladyada.net/make/eshield/download.html

http://www.dd-wrt.com/wiki/index.php/LaFonera_Software_Flashing

http://jauzsi.hu/2006/10/13/inside-of-the-fonera

http://www.easy2design.de/bla/?page_id=98

http://labs.echoditto.com/hacking-la-fonera-2

http://www.mariomix.net/mariomix-blog/2006/11/hacking-la-fonera-parte-3/

This entry was posted in Article (記事) and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>