USE WITH Arduino BOARDS

Yun Shieldは、スケッチのアップロードにSPIを使用し、BridgeクラスがAVRと通信するためにUARTポートを使用します。Yun ShieldをArduinoボードに接続する際には、以下の点を確認する必要があります。

Connect to Arduino Boards

General How To

Arduino IDEを使用してローカルエリアネットワーク経由でArduino / AVRをアップグレードするには、ユーザーは以下を行う必要があります。正しいボードタイプを追加Arduino IDEで。

ユーザーは、以下に示すように、異なるボードに対してハードウェアの変更を行う必要がある場合があります。

Yun Shieldのボードタイプを追加

Connect to a Leonardo

Yun ShieldをLeonardoの上に差し込み、DCジャック経由でLeonardoに電源を供給するだけです。Arduino IDEでは、ボードタイプを選択する必要があります。.

Connect to Arduino Uno

UNOでは、mega328Pとmega16u2間のUART接続がYun Shieldのブリッジ機能に影響を与えます。したがって、以下に示すように、mega16u2をリセットモードに設定して切断する必要があります。

Arduino UNOでの使用

注:Yun Shield v1.1.6およびYun Shield v2.4では、ジャンパーを接続する必要はありません。

注:この変更後、USBアップグレード/デバッグは機能しません。ユーザーは、Arduino IDEを介してWiFi経由でスケッチをアップグレードおよびデバッグする必要があります(例を参照)。

Yun ShieldをUnoの上に置き、DCジャック経由で電源を供給します。

Connect to Arduino Duemilanove/Diecimila

1) Duemilanove/Diecimilaでは、mega AVR UARTインターフェースがFTDIチップに接続されているため、以下の図に示すように切断する必要があります。

Arduino Duemilanove/Diecimilaでの使用

注:Yun Shield v1.1.6およびYun Shield v2.4では、これらのコンポーネントを取り外す必要はありません。

2) Arduino IDEでUNOと同じボードプロファイルを使用します。

3) Yun ShieldをDuemilanoveの上に置き、DCジャック経由で電源を供給します。

Connect to Arduino Mega2560

1) Mega2560では、Mega2560とmega16u2間のUART接続がYun Shieldのブリッジ機能に影響を与えます。したがって、以下に示すように、mega16u2をリセットモードに設定して切断する必要があります。

Arduino Mega2560での使用

注:Yun Shield v1.1.6およびYun Shield v2.4では、ジャンパーを接続する必要はありません。

2) Yun ShieldをMega2560の上に置き、DCジャック経由で電源を供給します。

Connect to Freetronics “Eleven”

Freetronic「Eleven」に接続する場合、ユーザーはUNOに接続する場合と同じプロファイルを使用できますが、Arduino Unoとは少し異なる以下のハードウェア変更を行う必要があります。

Quentin McDonald提供のFreetronics Elevenでの使用

注:Yun Shield v1.1.6およびYun Shield v2.4では、ジャンパーを接続したり、コンポーネントを取り外したりする必要はありません。

Connect to Dccduino UNO R3

Dccduino UNO R3での使用

注:Yun Shield v1.1.6およびYun Shield v2.4では、これらのコンポーネントを取り外す必要はありません。

Connect to Helvetino Kit

Helvetinoキットでの使用、SPIをICSPヘッダーに配線

Connect to Teensy

Teensyは、完全なUSBベースのマイクロコントローラ開発システムであり、多機能で強力です。カスタムのTeensyインストーラーとブリッジアプリケーションを使用すると、Teensy用のスケッチを簡単に作成し、Teensyにロードできます。すべてのプログラミングは、Arduinoと同様にUSBポート経由で行われ、特別なプログラマーは必要ありません。

Click here to get more information

Connect to Arduino DUE

Arduino DueはATSAM MCUをベースにした3.3VのArduinoです。Yun ShieldをArduino Dueに接続する際には、ユーザーは以下の点に注意する必要があります。

  • Yun Shieldのバージョンがv1.1.6未満またはv2.4未満の場合、ユーザーはI/O電圧ジャンパーを3.3Vに設定する必要があります。
  • User can’t upload sketch via WiFi, instead, User has to upload sketch to DUE use the via the DUE native USB port. (board and port both select: Arduino Due(Native USB port))
  • DUEとYun Shield間のブリッジは機能します。シリアルモニターで結果を確認するためにコンソールを使用する場合は注意してください。ユーザーはArduino Due USBポートではなく、Yun Shieldポートを選択する必要があります。

Detect Yun Shield

お使いのラップトップとYun Shieldが同じネットワーク上にあることを確認してください。Yun Shieldはこのネットワーク上でデータをブロードキャストし、Arduino IDEはこのデータを受信して、Yun Shieldを以下に表示します。ツール → ポート.

Arduino IDEでYun Shieldが検出されました

Upload Sketch

Upload via WiFi/ LAN from IDE

  • Arduino IDEで、AVRモジュールに正しいボードタイプを選択します。
  • Arduino IDE → ポートで、正しいポートを選択します。(IPアドレスを持つArduino Yunポートである必要があります)
  • Yun Shield GUI → センサーページで、アップロードに正しいボードタイプを選択します。
  • スケッチをコンパイルしてArduinoボードにアップロードします。アップロード中に、Yun Shieldはパスワードの入力を求めます。デフォルトでは、パスワードはdragino.

Yun用スケッチのコンパイル

Upload via Web

Web経由でアップロード –> センサーページ

Auto Update Sketch

現場でのスケッチの自動更新については、以下を参照してください。Manual for Auto update Sketch.

Bridge Library

ブリッジライブラリは、ArduinoボードとYun Shield間の通信を簡素化します。

AVR(Arduinoボード)からのブリッジコマンドは、Yun Shield上のPythonによって解釈されます。その役割は、Arduinoからの要求に応じてGNU/Linux側でプログラムを実行し、Arduinoとインターネット間でセンサーの読み取り値などのデータを共有するための共有ストレージスペースを提供し、インターネットからコマンドを受信して直接Arduinoに渡すことです。

Arduino公式サイトには、ブリッジの使用方法に関する詳細な説明と多くの例があります。参照リンクは次のとおりです。Yun Bridge Library

Quick Start

EXAMPLES

Example 1: Say hello to Linux

Arduino IDEからIPアドレスを検出:

この例は、ArduinoとYun Shield間のハローテストです。この例は以下にあります。Arduino IDE–>ファイル–>例–>ブリッジ–>ConsoleRead。この例のチュートリアルは以下にあります。http://arduino.cc/en/Tutorial/ConsoleRead。以下のコードリストには、Yun Shieldでの動作を理解するための詳細が含まれています。

Code:

#include "Console.h" //use Console class for Arduino IDE debug over WiFi, similar to Serial class,
String name;
 
void setup() {
  // Initialize Console and wait for port to open:
  Bridge.begin();
  Console.begin();
 
  // Wait for Console port to connect
  while (!Console);
 
  Console.println("Hi, what's your name?"); //Data flow: Arduino --> Yun Shield --> Arduino IDE
}
 
void loop() {
  if (Console.available() > 0) {
    char c = Console.read(); //read the next char received, data flow: IDE --> Yun Shield--> Arduino
    // look for the newline character, this is the last character in the string
    if (c == '\n') {
      //print text with the name received
      Console.print("Hi ");
      Console.print(name);
      Console.println("! Nice to meet you!");
      Console.println();
      // Ask again for name and clear the old name
      Console.println("Hi, what's your name?");
      name = "";  // clear the name string
    }
    else {  	 // if the buffer is empty Cosole.read() returns -1
      name += c; // append the read char from Console to the name string
    }
  }
}

スクリーンショット:

Result

Example 2: Upload data to IoT Server

Introduction:

この例は、公開IoTサーバー「」にデータをログする方法を示しています。Xively」。この例は、異なるArduinoボードに合わせてSerialをConsoleに変更し、WiFi経由でデバッグするように変更されたバージョンです。Arduino IDE–>ファイル–>例–>ブリッジ–>XivelyClient。この例のチュートリアルは以下にあります。http://arduino.cc/en/Tutorial/YunXivelyClient

スケッチをアップロードする前に、以下を確認してください。

  • Yun Shieldがすでにインターネットにアクセスできること。
  • チュートリアルに従ってFEED IDとAPI KEYを入力してください。FEED IDは二重引用符「」で囲む必要があります。
  • 異なるAVRに合わせてSerialクラスをConsoleクラスに変更します。

以下のコードリストには、Yun Shieldでの動作を理解するための詳細が含まれています。

Code:

// include all Libraries needed:
#include "Process.h"	//Process lib use to call Linux Commands in Yun Shield
#include "Console.h"	//Console lib, used to show debug info in Arduino IDE
#include "passwords.h"      // contains my passwords, see below
 
/*
  NOTE: passwords.h is not included with this repo because it contains my passwords.
 You need to create it for your own version of this application.  To do so, make
 a new tab in Arduino, call it passwords.h, and include the following variables and constants:
 
 #define APIKEY        "foo"                  // replace your pachube api key here
 #define FEEDID        “0000”                   // replace your feed ID
 #define USERAGENT     "my-project"           // user agent is the project name
 */
 
 
// set up net client info:
const unsigned long postingInterval = 60000;  //delay between updates to xively.com
unsigned long lastRequest = 0;      // when you last made a request
String dataString = "";
 
void setup() {
  // start console:
  Bridge.begin();
  Console.begin();
 
  while (!Console);   // wait for Network Serial to open
  Console.println("Xively client");
 
  // Do a first update immediately
  updateData();
  sendData();
  lastRequest = millis();
}
 
void loop() {
  // get a timestamp so you can calculate reading and sending intervals:
  long now = millis();
 
  // if the sending interval has passed since your
  // last connection, then connect again and send data:
  if (now - lastRequest >= postingInterval) {
    updateData();
    sendData();
    lastRequest = now;
  }
}
 
void updateData() {
  // convert the readings to a String to send it:
  dataString = "Temperature,";
  dataString += random(10) + 20;
  // add pressure:
  dataString += "\nPressure,";
  dataString += random(5) + 100;
}
 
// this method makes a HTTP connection to the server:
void sendData() {
  // form the string for the API header parameter:
  String apiString = "X-ApiKey: ";
  apiString += APIKEY;
 
  // form the string for the URL parameter:
  String url = "https://api.xively.com/v2/feeds/";
  url += FEEDID;
  url += ".csv";
 
  // Send the HTTP PUT request, form the linux command and use Process Class to send this command to Yun Shield
 
  // Is better to declare the Process here, so when the
  // sendData function finishes the resources are immediately
  // released. Declaring it global works too, BTW.
  Process xively;
  Console.print("\n\nSending data... ");
  xively.begin("curl");
  xively.addParameter("-k");
  xively.addParameter("--request");
  xively.addParameter("PUT");
  xively.addParameter("--data");
  xively.addParameter(dataString);
  xively.addParameter("--header");
  xively.addParameter(apiString);
  xively.addParameter(url);
  xively.run();
  Console.println("done!");

スクリーンショット:

結果スクリーンショット

ビデオ説明:

Example 3: Log Data to USB flash

Introduction:

この例は、USBフラッシュにデータをログする方法を示しています。この例で使用されているスケッチは、以下と同じです。Log Data to USB Flash。ソースコードは以下にあります。this link.

Yun ShieldはUSBフラッシュを/mnt/sda1ディレクトリに自動マウントします。スケッチはセンサーデータをファイル/mnt/sda1/data/datalog.csvに追加します。スケッチを実行する前に、USBフラッシュにそのようなファイルがあることを確認してください。

Code:

#include "FileIO.h"     //FileIO class allow user to operate Linux file system
#include "Console.h"  //Console class provide the interactive between IDE and Yun Shield
 
 
void setup() {
  // Initialize the Console
  Bridge.begin();
  Console.begin();
  FileSystem.begin();
 
  while(!Console);  // wait for Serial port to connect.
  Console.println("Filesystem datalogger\n");
}
 
 
void loop () {
  // make a string that start with a timestamp for assembling the data to log:
  String dataString;
  dataString += getTimeStamp();
  dataString += " , ";
 
  // read three sensors and append to the string:
  for (int analogPin = 0; analogPin < 3; analogPin++) {
    int sensor = analogRead(analogPin);
    dataString += String(sensor);
    if (analogPin < 2) {
      dataString += ",";  // separate the values with a comma
    }
  }
 
  // open the file. note that only one file can be open at a time,
  // so you have to close this one before opening another.
  // The USB flash card is mounted at "/mnt/sda1" by default
  File dataFile = FileSystem.open("/mnt/sda1/data/datalog.csv", FILE_APPEND);
 
  // if the file is available, write to it:
  if (dataFile) {
    dataFile.println(dataString);
    dataFile.close();
    // print to the serial port too:
    Console.println(dataString);
  }  
  // if the file isn't open, pop up an error:
  else {
    Console.println("error opening datalog.csv");
  } 
 
  delay(15000);  //Write every 15 seconds
 
}
 
// getTimeStamp function return a string with the time stamp
// Yun Shield will call the Linux "date" command and get the time stamp
String getTimeStamp() {
  String result;
  Process time;
  // date is a command line utility to get the date and the time 
  // in different formats depending on the additional parameter 
  time.begin("date");
  time.addParameter("+%D-%T");  // parameters: D for the complete date mm/dd/yy
                                //             T for the time hh:mm:ss    
  time.run();  // run the command
 
  // read the output of the command
  while(time.available()>0) {
    char c = time.read();
    if(c != '\n')
      result += c;
  }
 
  return result;
}

スクリーンショット:

Result

Example 4: Use MQTT

Introduction:

MQTTは、M2M(マシンツーマシン)/「モノのインターネット」接続プロトコルです。これは、非常に軽量なパブリッシュ/サブスクライブメッセージングトランスポートとして設計されました。小さなコードフットプリントが必要な場合や、ネットワーク帯域幅が貴重なリモートロケーションとの接続に役立ちます。たとえば、衛星リンクを介してブローカーと通信するセンサー、医療提供者との時折のダイヤルアップ接続、およびさまざまなホームオートメーションや小型デバイスのシナリオで使用されています。thc cartridges、そして様々なホームオートメーションや小型デバイスのシナリオで使用されています。また、その小型サイズ、低消費電力、最小限のデータパケット、そして1つまたは多数の受信者への効率的な情報配信により、モバイルアプリケーションにも最適です。

この例では、SSL MQTTプロトコルでYun Shieldを使用する方法を示します。

必要なパッケージをインストール

MQTTに必要な以下のパッケージをインストールします。

root@Arduino:~# opkg update
root@Arduino:~# opkg install libcares
root@Arduino:~# opkg install libopenssl
root@Arduino:~# opkg install libmosquitto
root@Arduino:~# opkg install mosquitto-client

公開MQTTテストサーバーでテスト:

test.mosquitto.orgは、公開されているMosquitto MQTTサーバー/ブローカーをホストしています。ユーザーはこのMQTTサーバーに投稿および購読してテストできます。SSL接続でこのサーバーをテストするには、ユーザーはサーバー接続を検証するために証明書機関ファイルmosquitto.org.crtをダウンロードする必要があります。

2つのSSHウィンドウを開きます。最初のウィンドウで、以下のコマンドでトピックを購読します。

 mosquitto_sub -h test.mosquitto.org -p 8883 --cafile mosquitto.org.crt -t dragino/device0/temperature

このコマンドは、このトピックをリッスンし、サーバー上の変更を表示します。

もう一方のウィンドウで、別のコマンドで変更を公開します。

mosquitto_pub -h test.mosquitto.org -p 8883 --cafile mosquitto.org.crt -t dragino/device0/temperature -m 31

公開コマンドが発行されると、購読コマンドに結果が表示されます。

Example 5: Use the 3G dongle

Introduction

これは、3G USBドングルを使用してYun Shieldに接続し、3G接続を確立する方法の紹介です。以下のデモでテストされたファームウェアは、で、3G USBドングルモデルはUMTSを使用して3G接続を行うHuaWei E303です。サービスプロバイダーはChina Unicomです。
必要なパッケージをインストール

Yun ShieldをWiFi経由でインターネットに接続するように設定し、以下のパッケージをインストールします。。出力は以下のようになります。

root@dragino:~# opkg update
Downloading http://www.dragino.com/downloads/downloads/motherboards/ms14/Firmware/Yun/Packages--v2.x/Packages.gz.
Updated list of available packages in /var/opkg-lists/attitude_adjustment.
Downloading http://www.dragino.com/downloads/downloads/motherboards/ms14/Firmware/Yun/Packages--v2.x/Packages.sig.
Signature check passed.
root@dragino:~# opkg install luci-proto-3g
Installing luci-proto-3g (0.11+svn10537-1) to root...
Downloading http://www.dragino.com/downloads/downloads/motherboards/ms14/Firmware/Yun/Packages--v2.x/luci-proto-3g_0.11+svn10537-1_ar71xx.ipk.
Installing comgt (0.32-21) to root...
Downloading http://www.dragino.com/downloads/downloads/motherboards/ms14/Firmware/Yun/Packages--v2.x/comgt_0.32-21_ar71xx.ipk.
Installing chat (2.4.5-10) to root...
Downloading http://www.dragino.com/downloads/downloads/motherboards/ms14/Firmware/Yun/Packages--v2.x/chat_2.4.5-10_ar71xx.ipk.
Configuring chat.
Configuring comgt.
Configuring luci-proto-3g.
root@dragino:~# opkg install kmod-usb-serial-option kmod-usb-serial-wwan usb-modeswitch-data usb-modeswitch
Installing kmod-usb-serial-option (3.3.8-1) to root...
Downloading http://www.dragino.com/downloads/downloads/motherboards/ms14/Firmware/Yun/Packages--v2.x/kmod-usb-serial-option_3.3.8-1_ar71xx.ipk.
Installing kmod-usb-serial-wwan (3.3.8-1) to root...
Downloading http://www.dragino.com/downloads/downloads/motherboards/ms14/Firmware/Yun/Packages--v2.x/kmod-usb-serial-wwan_3.3.8-1_ar71xx.ipk.
Installing kmod-usb-serial (3.3.8-1) to root...
Downloading http://www.dragino.com/downloads/downloads/motherboards/ms14/Firmware/Yun/Packages--v2.x/kmod-usb-serial_3.3.8-1_ar71xx.ipk.
Package kmod-usb-serial-wwan (3.3.8-1) installed in root is up to date.
Installing usb-modeswitch-data (20120120-1) to root...
Downloading http://www.dragino.com/downloads/downloads/motherboards/ms14/Firmware/Yun/Packages--v2.x/usb-modeswitch-data_20120120-1_ar71xx.ipk.
Installing usb-modeswitch (1.2.3-2) to root...
Downloading http://www.dragino.com/downloads/downloads/motherboards/ms14/Firmware/Yun/Packages--v2.x/usb-modeswitch_1.2.3-2_ar71xx.ipk.
Package usb-modeswitch (1.2.3-2) installed in root is up to date.
Configuring kmod-usb-serial.
Configuring kmod-usb-serial-wwan.
Configuring kmod-usb-serial-option.
Configuring usb-modeswitch.
Configuring usb-modeswitch-data.
root@dragino:~#

3G情報を設定

ページを開くシステム –> 詳細設定パネル –> ネットワーク –> インターフェース。クリック新しいインターフェースを追加

3Gインターフェースを作成

3Gインターフェースを設定

デバイスを再起動します。

再起動後、3Gが起動し、パブリックIPを取得します。

設定に関する注意

When configure 3G info, we have to choose the right ttyUSB port for dial up. If it possible you can’t see the ttyUSB port , especially in the Yun Shield v2.x version, becasue there is more than one USB device there. We can use the lsusb command to get the usb info. as below, we can see the 3G module we have here has the info 05c6:9090.

root@dragino-162124:~# lsusb 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 058f:6254 Alcor Micro Corp. USB Hub
Bus 001 Device 003: ID 058f:6366 Alcor Micro Corp. Multi Flash Reader
Bus 001 Device 004: ID 05c6:9090 Qualcomm, Inc.

次に、この行をファイルに入力します。/etc/module.d/60-usb-serial

usbserial vendor=0x05c6 product=0x9090

デバイスを再起動すると、ttyUSBポートが表示されます。

ビデオ説明

Example 6: Save Data to Google SpreadSheet

例には多くのコンテンツが含まれています。以下を参照してください。this link

Example 7: Save Data to MySQL

例には多くのコンテンツが含まれています。以下を参照してください。this link

FAQ

What is the difference between the official Arduino Yun and the Yun Shield?

ハードウェアの側面

The Arduino Yun and the Yun Shield have the same CPU, Memory size and RAM size for the Linux system. The Arduino Yun is an integrated Linux and MCU part. The Yun Shield is designed as a shield which can be used with existing Arduino boards.

基本的に、はArduino Yunに相当しますが、Yun ShieldはArduino Uno、Duemilanove、Diecimilaなどの他のArduinoボードでも使用できるため、より柔軟です。

Yun Shieldは複製可能で生産可能です。Yun Shieldの設計はオープンであり、最も複雑で困難な部分はDragino HEモジュールで行われています。ユーザーはDragino HEモジュールを別途購入して、IoTプロジェクトをカスタマイズし、独自のYunソリューションをリリースできます。

安定した柔軟なWiFiパフォーマンス:Arduino Yunはチップアンテナ設計を使用しています。Arduino Yunの上にシールドがある場合、WiFiは大幅にシールドされ、WiFiパフォーマンスが低下します。代わりに、Yun Shieldは外部アンテナ設計を使用しています。ユーザーはYun Shieldのi-pexコネクタに異なるタイプのアンテナを接続できます。これにより、設置がより柔軟になり、信号を数km離れた場所に転送することが可能になります。

ソフトウェアの側面

Yun Shieldソフトウェアは、Arduino Yunから派生しており、いくつかのバグが修正され、機能が追加され、より多くのボードタイプをサポートしています。

Is Yun Shield compatible with a variant Arduino Board?

Arduinoボードが以下に記載されているボードのバリアントである場合、Support Board Type 、互換性があるはずです。以下は互換性のチェックリストです。

  • バリアントは、Yun Shieldに電力を供給するためにVINピンに7〜15Vの電源を持っています。
  • バリアントは、公式ボードと同じICSPヘッダーにSPIピンの定義と位置を持っています。
  • バリアントは、公式ボードと同じICSPヘッダーにD0およびD1ピンの定義と位置を持っています。
  • AVRのSPIとUARTに接続されているICがあるかどうかを確認し、それらがYun ShieldとAVR MCU間の通信に影響を与えるかどうかを評価します。

The system structure セクションでは、Yun Shieldの動作原理を詳しく説明しています。ユーザーがYun Shieldが自分のボードと互換性があるかどうかまだ不明な場合、または互換性に問題がある場合は、[email protected]にボード情報を送信してください。当社のサポートチームが確認し、チェックします。

How to set up /www/sd and /mnt/sd?

/www/sdと/mnt/sdをArduino Yunと同じように使用するには、ユーザーはUSBフラッシュを準備し、USBフラッシュのルートに/arduinoと/arduino/wwwディレクトリを作成できます。次に、USBフラッシュをYun Shieldに差し込むと、自動的に/www/sdと/mnt/sdが作成され、/arduinoと/arduino/wwwにリンクされます。

Where can I find the source code of Yun Shield?

Yun Shieldのソースは以下にあります。https://github.com/dragino/linino

How to Upload, Download or Edit files in the Yun Shield

Yun ShieldにはLinuxシステムが内蔵されており、SCPプロトコルをサポートしています。ユーザーはSCPツールを使用してLinuxファイルをアップロード、ダウンロード、または編集できます。

Windows OSでは、SCPツールはWinSCPです。それをインストールし、以下のようにYun Shieldにログインします。

  • ホスト名:Yun ShieldのIPアドレス
  • ユーザー名:root
  • Password:Arduino(デフォルト)
  • Protocol:SCP

WinSCPウィンドウ

ログインプロセス中に2つの警告が表示されますが、無視してください。ログイン後、管理パネルが表示されます。このパネルの左側はPCのディレクトリ、右側はYun Shieldのディレクトリを示しており、ファイルをアップロード/ダウンロードするには、dragging、またはダブルクリックファイルを変更します。

WinSCPウィンドウ

How to reset the Yun Shield

Yun Shieldにはリセットに使用できるトグルボタンがあります。Yun Shieldのシステムが実行中に、ユーザーはトグルボタンを押してデバイスをリセットできます。このボタンを押すと、WLAN LEDが点滅します。

  • トグルボタンを押し、5秒後に離すと、WiFi設定をリセットし、他の設定は保持されます。
  • トグルボタンを押し、30秒後に離すと、すべての設定を工場出荷時のデフォルトにリセット .

How to recover the Yun Shield in case of a firmware crash

不適切なファームウェアのアップグレードやアップグレード中の電源喪失など、Yun Shieldが起動に失敗する場合があります。ユーザーは、Yun ShieldのFailsafe u-bootを使用してYun Shieldシステムを回復できます。

Windowsでの手順は以下のとおりです。

TFTPサーバーを設定

tftpサーバー(tftp32d.exeを推奨)をダウンロードし、最新のYunファームウェアを以下からダウンロードします。Yun Firmware 。必要なファームウェアはカーネルとrootfs-squashfsファイルです。これらのファームウェアファイルとtftp32dを同じディレクトリに配置します。tftpサーバーを起動します。

Herculesユーティリティをダウンロード

Download Hercules。これは、FailsafeモードでYun Shieldにコマンドを転送するために使用するツールです。Herculesを実行し、以下のように正しいパラメータを入力します。

Herculesウィンドウ

Protocol:UDP

モジュールIP:192.168.255.1

Port:6666

ローカルポート:6666

PCをYun Shieldに接続

PCとYun Shieldをイーサネットケーブルで接続します。PCを以下のLAN IPで設定します。192.168.255.2とネットマスク255.255.255.0。PCのファイアウォールを無効にします。

Yun ShieldをFailsafeモードで起動

Failsafeボタンを押し、Yun Shieldの電源を入れます。すべてのLEDが同時に点滅するのを確認できます。10秒後にボタンを離すと、Herculesパネルにいくつかのメッセージが表示されます。これは、Yun ShieldがFailsafe Netconsoleモードになり、コマンドにアクセスできる状態になったことを意味します。

ユーザーはHerculesでコマンドを入力して、Yun Shieldを工場出荷時の設定で最新のファームウェアに転送およびアップグレードできます。

更新コマンドは以下のとおりです。xxxを実際のバージョンに置き換えてください。

Herculesでコマンドを入力する際の注意:ユーザーは各コマンドの最後に「$」を追加する必要があります。「$」はHerculesの特殊文字です。入力する際は2回入力する必要があります(キー入力2、$)。

カーネルをアップグレード

tftpboot 0x81000000 dragino2-yun-common-v2.0.3-kernel.bin
erase 0x9fea0000 +0x140000 
cp.b 0x81000000 0x9fea0000 $filesize

rootfsをアップグレード

tftpboot 0x81000000 dragino2-yun-common-v2.0.3-rootfs-squashfs.bin
erase 0x9f050000 +0xe50000    
cp.b 0x81000000 0x9f050000 $filesize

新しいファームウェアにリセット

reset

ビデオ説明

Warning:ユーザーは、表示されているeraseおよびcp.b行に示されているアドレス番号を正確に使用する必要があります。間違ったアドレス番号は、Yun Shieldのブートローダーを破壊し、デバイスが起動しなくなる可能性があります。また、Yun Shieldの無線データを破壊し、WiFiパフォーマンスの低下やMACアドレスの誤りにつながる可能性があります。

Linuxでの回復はWindowsと似ています。主な違いは、Linuxで使用するツールがncで、以下で実行することです。。以下は、Yun ShieldがFailsafe Netconsoleモードになり、ncによって検出されたことを示しています。

How to use Yun Shield UART without an Arduino

ArduinoなしでYun Shield UARTを使用することも可能です。以下の図は、接続方法の詳細を示しています。

Yun Shield UART接続

Notice:

  • TXDとRXDは、レベルシフトが有効になった後(GPIO24がHighに設定された後)にのみUART_TX/UART_RXに接続されます。Dragino Yun OpenWrt環境ではGPIO24がHighに設定されているため、TXD/RXD側からはu-bootブートローダーUARTにアクセスできません。
  • Dragino Yunファームウェアは、Arduino Bridgeクラスに合わせるために、デフォルトで250000ボーレートを使用します。これは一般的なボーレートではないため、ユーザーはTXD/RXDで文字化けしたコードを見る可能性があります。ユーザーはOpenWrtでsttyコマンドを使用して、希望のボーレートを設定できます。ユーザーがUART経由でLinuxシステムにアクセスしたい場合は、IoT Mesh Firmwareボーレートが115200の

Trouble Shooting

Can not see the Yun Wireless network

  • Arduinoが電源アダプターで給電されており、入力電圧が7V〜12Vの間であることを確認してください。
  • Yun Shieldのi-pexソケットにアンテナが接続されていることを確認してください。
  • Yun ShieldがAPモードになっていることを確認してください。

Arduino IDE doesn’t detect Yun Shield

この問題が発生した場合は、以下の点を確認してください。

  • Arduino IDEのバージョンが1.5.4以降であること。
  • PCとYun Shieldが同じネットワーク上にあること。
  • Yun ShieldがArduino IDEより先に起動した場合、この問題が発生する可能性があります。Yun Shieldの電源を入れ直して再度確認してください。ユーザーは、arduino.localが指すIPアドレスをArduino IDEに伝えるためにドメインエントリを追加することもできます。これにより、Arduino IDEがYun Shieldを検出するのに役立ちます。ユーザーはYun Shieldと同じIPを割り当てる必要はありません。たとえば、Windows 7では、以下の行をC:\Windows\System32\drivers\etc\hostsファイル
10.130.2.1 arduino.local
  • If all above doesn’t work, try ssh to the yun shield and run 。これにより、Arduinoサービスがブロードキャストされ、Arduino IDEがそれを受信するはずです。

The Arduino Bridge doesn’t work

Hardware Possibility

ブリッジはAVRからのUARTインターフェースを使用します。Arduinoボードでは、これらのトレースは常にUSBをUARTチップに接続してスケッチをアップロードします。そうでない場合、ほとんどの場合、ブリッジが期待どおりに機能しなくなります。公式またはブランドのArduinoボードの変更例は、このリンクにあります。Connects_to_Arduino_Boards。異なるハードウェアを使用するArduinoバリアントボードはまだたくさんあります。基本的な概念は、UARTを可能な限りクリーンにすることです。参考として、お客様からのいくつかの回避策も以下に示します。

Seigei提供のCH340G USBチップ搭載Mega2560クローンへの接続

注:Yun Shield v1.1.6およびYun Shield v2.4のレベルシフト部分が改善されたため、この問題は発生しないはずです。

Software Possibility

一部のArduinoモデルでは、can’t use Serial and Bridgeスケッチで一緒に。詳細な理由については、このリンクを確認してください。Bridge doesn’t work with Mega328P/Mega2560

Upload Sketch Fail

Arduino IDE shows signature mismatch

Arduino IDEからの出力例は以下のとおりです。

Programmer Type : linuxgpio
Description : Use the Linux sysfs interface to bitbang GPIO lines

avrdude: Calibrating delay loop... calibrated to 49 cycles per us
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9801
avrdude: Expected signature for ATmega32U4 is 1E 95 87
Double check chip, or use -F to override this check.

上記の結果は、Yun Shieldがmega32u4 MCUを搭載したArduinoをプログラムしようとしているが、実際にはArduinoがシグネチャ0x1e9801を持つMega2560をベースにしているため、失敗することを示しています。この問題を解決するには、ユーザーはYun Shield Webインターフェース –> センサー –> Arduinoボード type.

Yun Shield can’t connect to the AVR

この問題に対するArduino IDEの典型的な出力は以下のとおりです。

        Programmer Type : linuxgpio
        Description     : Use the Linux sysfs interface to bitbang GPIO lines
 
avrdude: Calibrating delay loop... calibrated to 48 cycles per us
avrdude: AVR device not responding
avrdude: initialization failed, rc=-1
        Double check connections and try again, or use -F to override
        this check.
 
 
avrdude done.  Thank you.

これは、Yun ShieldとArduinoボード間のSPIインターフェースに問題があることを意味します。2つの可能性があります。

  • User doesn’t power the Yun Shield properly. Check this link for how to power it right
  • Please check if the SPI connection between them is clean and doesn’t have other components hooked onto it. Some components may interfere with the SPI connection.

以下は、Yun ShieldがAVRにスケッチをアップロードする方法と、どこが間違っているかをデバッグする方法です。

Yun Shieldスケッチアップロード構造

MOSI/MISO/SCK/RESETのハードウェア接続が期待どおりに機能するかどうかを確認します。以下はGPIOとのピンマッピングです。ユーザーはLinuxでGPIOをエクスポートし、以下のコマンドを実行してGPIOをHigh/Lowに設定できます。関連するSPIピンはそれに応じてHigh(+5V)/Lowになり、マルチメーターで確認できます。Lowは0V、HighはArduinoボードによって3.3Vまたは5Vです。以下は、GPIOが機能するかどうかを確認するためにタイプする必要があるコマンドです。

	echo 1 > /sys/class/gpio/gpio19/value   // enable level shift , GPIO19 will be 2.6v
 
	echo 18 > /sys/class/gpio/export     //export gpio 18
	echo "high" > /sys/class/gpio/gpio18/direction   // set direction to out and set level to high  .. GPIO18 will be 2.6V
	echo "1" > /sys/class/gpio/gpio18/value   // set this GPIO to high, SPI_SCK should be high in the ICSP header. 
	echo "0" > /sys/class/gpio/gpio18/value   // set this GPIO to low, SPI_SCK should be low in the ICSP header. 
 
	echo 21 > /sys/class/gpio/export     //export gpio 21
	echo "high" > /sys/class/gpio/gpio21/direction   // set direction to out and set level to high GPIO21 will be 2.6V
	echo "1" > /sys/class/gpio/gpio21/value   // set this GPIO to high, SPI_MOSI should be high in the ICSP header. 
	echo "0" > /sys/class/gpio/gpio21/value   // set this GPIO to low, SPI_MOSI should be low in the ICSP header. 
 
	echo 22 > /sys/class/gpio/export     //export gpio 22
	echo "high" > /sys/class/gpio/gpio22/direction   // set direction to out and set level to high GPIO22 will be 2.6V
	echo "1" > /sys/class/gpio/gpio22/value   // set this GPIO to high, SPI_MISO should be high in the ICSP header. 
	echo "0" > /sys/class/gpio/gpio22/value   // set this GPIO to low, SPI_MISO should be low in the ICSP header. 
 
	echo 20 > /sys/class/gpio/export     //export gpio 20
	echo "high" > /sys/class/gpio/gpio20/direction   // set direction to out and set level to high GPIO20 will be 2.6V
	echo "1" > /sys/class/gpio/gpio20/value   // set this GPIO to high, /RESET should be low in the ICSP header. 
	echo "0" > /sys/class/gpio/gpio20/value   // set this GPIO to low, /RERST should be high in the ICSP header.

Note: After export all the GPIOs, Yun Shield won’t be able to upload sketch to Arduino unless reboot the device.
デバッグケーススタディ

以下は、UNOクローンボードに接続する際にこの問題を解決するためのケーススタディです。

1/ Yun ShieldにSSH接続し、以下のコマンドを使用してSPI接続を有効にします。

echo 19 > /sys/class/gpio/export     //export gpio 19
echo "high" > /sys/class/gpio/gpio19/direction   // set direction to out and set level to high
echo 1 > /sys/class/gpio/gpio19/value // to set high

2/ 各SPI信号を確認し、問題がないか確認します。上記のGPIO設定コマンドを使用してHighとLowを設定し、マルチメーターでISCPヘッダーを測定します。SCKが期待される5Vではなく2.9Vしかないことがわかりました。そこで、UNOクローンボードのSCKトレースに接続されているコンポーネントがあるかどうかを確認したところ、LEDが接続されていることがわかりました。そこで、UNOからL LEDを取り外し、その後SPIが正常に機能するようにしました。

Arduino doesn’t work with Arduino IDE without YunShield

Yun Shield Web UIには、オプションがあります。ブートローダーをアップロードin the sensor page. When this option is uncheck, the Yun Shild will ignore the Arduino bootloader when uploading the Sketch. so the Arduino won’t have bootloader after upload. In this case, if user remove the Yun Shield and use the Arduino with Arduino IDE directly, it won’t work. So user need to check upload bootloader if want to use the Arduino seperate with the Arduino IDE

REFERENCE

Teensyでの使用