정보나눔

오픈소스하드웨어 프로젝트에 대한 다양한 정보를 나누는 공간입니다.

wifi 쉴드 연결에 대해 문의드립니다.
김지수 | 2015-03-24

안녕하세요. 춘천에서 대학원생으로 공부하고 있는 학생입니다. 아두이노를 이용하여 스마트 폰 제어를 하려 합니다.
방식은 wifi방식입니다. 스마트 폰과 wifi쉴드를 연결하고 싶습니다. wifi쉴드가 스마트 폰과 제대로 연결되었는지 확인하는 과정에서
문제가 발생했습니다. wifi쉴드의 펌웨어 업데이트를 하라고 하여 인터넷 검색을 통해 펌웨어 업데이트를 1.1.0으로 만들었습니다.
wifi 연결 예제를 이용하여 업로드를 시켰습니다. 에러는 발생하지 않았습니다. 시리얼 모니터를 통해 제대로 인식되는지를 확인하는데 wifi 쉴드에서는 빨간불이 들어오고 시리얼 모니터에서는 펌웨어 버젼을 확인하는 메세지와 네트워크와 연결을 시도한다는 말을 반복합니다. 무슨 문제가 있는지 알고 싶습니다. 아두이노에 대해 자문 구할 곳이 마땅치 않아서 코코아팹에 문의드립니다.
답변주시면 감사드리겠습니다. 밑에 소스는 예제소스입니다. 이 소스를 첨부하여서 업로드하였습니다.

#include <SPI.h>
#include <WiFi.h>

char ssid[] = "Dynamics";     //  your network SSID (name)
char pass[] = "11110000";  // your network password
int status = WL_IDLE_STATUS;     // the Wifi radio's status

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

  // check for the presence of the shield:
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue:
    while (true);
  }

  String fv = WiFi.firmwareVersion();
  if ( fv != "1.1.0" )
    Serial.println("Please upgrade the firmware");

  // attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network:
    status = WiFi.begin(ssid, pass);

    // wait 10 seconds for connection:
    delay(10000);
  }

  // you're connected now, so print out the data:
  Serial.print("You're connected to the network");
  printCurrentNet();
  printWifiData();

}

void loop() {
  // check the network connection once every 10 seconds:
  delay(10000);
  printCurrentNet();
}

void printWifiData() {
  // print your WiFi shield's IP address:
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);
  Serial.println(ip);

  // print your MAC address:
  byte mac[6];
  WiFi.macAddress(mac);
  Serial.print("MAC address: ");
  Serial.print(mac[5], HEX);
  Serial.print(":");
  Serial.print(mac[4], HEX);
  Serial.print(":");
  Serial.print(mac[3], HEX);
  Serial.print(":");
  Serial.print(mac[2], HEX);
  Serial.print(":");
  Serial.print(mac[1], HEX);
  Serial.print(":");
  Serial.println(mac[0], HEX);

}

void printCurrentNet() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print the MAC address of the router you're attached to:
  byte bssid[6];
  WiFi.BSSID(bssid);
  Serial.print("BSSID: ");
  Serial.print(bssid[5], HEX);
  Serial.print(":");
  Serial.print(bssid[4], HEX);
  Serial.print(":");
  Serial.print(bssid[3], HEX);
  Serial.print(":");
  Serial.print(bssid[2], HEX);
  Serial.print(":");
  Serial.print(bssid[1], HEX);
  Serial.print(":");
  Serial.println(bssid[0], HEX);

  // print the received signal strength:
  long rssi = WiFi.RSSI();
  Serial.print("signal strength (RSSI):");
  Serial.println(rssi);

  // print the encryption type:
  byte encryption = WiFi.encryptionType();
  Serial.print("Encryption Type:");
  Serial.println(encryption, HEX);
  Serial.println();
}

프로필사진

Requiem 2015-04-17 13:31:38

일단 소스상으로는
String fv = WiFi.firmwareVersion();
if ( fv != "1.1.0" )
Serial.println("Please upgrade the firmware");
펌웨어 버전이 1.10이 아니면, '1.10으로 업그레이드하라'는 루틴이 있습니다.
지수님께서 체크하셔야 할 사항은 와이파이 모듈의 버전확인, Wi-Fi 라이브러리의 소스를 확인하시어
하나씩 하나씩 Serial.print와 Serial.println을 이용하여 디버깅하시는 방법.. 추천 드립니다
명쾌한 답변 못드려 죄송합니다..
성공하시기를 기원드립니다.

프로필사진

김수현 2016-02-15 00:29:11

파이팅입니다!

이전글   |    오렌지보드 질문이요 2015-03-23
다음글   |    wifi 쉴드에 대해 문의드립니다. 2015-03-24