LoginSignup
1
1

More than 5 years have passed since last update.

ESP8266 > Amazon Dash Buttonの接続先アクセスポイントになる > v0.1 (失敗編)

Last updated at Posted at 2016-12-26
使用機材
ESP-WROOM-02 ユニバーサル基板実装

気圧計に使っていた基板を使用
http://qiita.com/7of9/items/00b4e13d54f53774df69

アイデア

@soramimi_jp さんのコメントに書かれていたUDP53での確認を用いて、Amazon Dash Buttonのボタン押下を拾おうとした。
http://qiita.com/7of9/items/9359461ff30d015d8007

  • WiFiアクセスポイントになる
    • SSID: esp8266
    • password: 12345
  • UDP53の接続を拾う

v0.1

code

esp8266_161226_detectAmazonDash.ino
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>

/*
 * v0.1 Dec. 26, 2016
 *   - implement loop()
 *   - implement setup()
 *   - add WiFi_setup()
 */

static const char *kSsid = "esp8266";
static const char *kPassword = "12345";
static const int kLocalPort = 53; // for DNS check from Amazon Dash Button
static WiFiUDP wifiUdp;

void WiFi_setup() {
//  WiFi.softAPConfig(IPAddress(8, 8, 8, 8), IPAddress(8, 8, 8, 1), IPAddress(255, 255, 255, 0));

  WiFi.softAP(kSsid, kPassword);
  IPAddress myIP = WiFi.softAPIP();
  Serial.println("AP IP address: ");
  Serial.println(myIP);

  wifiUdp.begin(kLocalPort);  
}

void setup() {
  Serial.begin(115200);
  Serial.println();
  Serial.print("Configuring acess point...");

  WiFi_setup();
}

void loop() {
  int rcvdSize = wifiUdp.parsePacket();
  if (rcvdSize == 0) {
    delay(100); // msec
    return;
  }

  Serial.println("Received");
}

失敗

スマホのAmazonショッピングアプリにて、Dash Buttonのセットアップを行おうとした。
WiFi接続先として、ESP8266のSSID:esp8266とした。

WiFiの設定時に以下のエラーとなった。

Dash Buttonに接続できませんでした。

単順にWiFiアクセスポイントに接続するだけでなく、その先の処理(例: amazonと通信している?)が失敗しているのかもしれない。

余談

上のコードでESP8266をアクセスポイントにしておいて、スマホでESP8266に接続すると、以下のようになる。

Configuring acess point...AP IP address: 
192.168.4.1
Received
Received
Received

スマホがESP8266のネットワークにつながっていることで、UDPポート53の処理が定期的に行われる様子が見られた。

上記のReceivedは、スマホがスリープ中には追記されない。
スマホのボタンを押して、スマホがスリープから解除されると、Receivedが追記されるようになる。

Amazon Dash Buttonならぬ、スマホDash Buttonの誕生です。コストは2.5万円ほどしますが。ボタン押して2秒以内にReceivedが追記されるレイテンシーです。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1