使用機材
ESP-WROOM-02 ユニバーサル基板実装
v0.1 http://qiita.com/drafts/89b24045bf5e44f97be4/edit
概要
ESP8266でAmazon Dash Button(以下ADB)のボタン押下を受けようとしている。
v0.2
今回の調査
- モバイルルータのSSID, WPA KEYでADBをセットアップする
- モバイルルータ: 401HW
- 同じSSID, WPA KEYのESP8266 をアクセスポイントにする
- ESP8266 でUDPポート53のチェックをする。
code v0.2
SSIDとPasswordはセキュリティの関係上、意図的に別の文字にしています。
esp8266_161226_detectAmazonDash.ino
#include <ESP8266WiFi.h>
#include <WiFiUdp.h>
/*
* v0.2 Dec. 27, 2016
* - use [SSID],[password] for mobile router
* v0.1 Dec. 26, 2016
* - implement loop()
* - implement setup()
* - add WiFi_setup()
*/
static const char *kSsid = "401HWa-XX314";
static const char *kPassword = "3141592a";
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");
}
結果
- ADBボタンの登録: 成功
- ESP8266でのボタン押下検知: 失敗
同じSSIDだからといって、受信できるわけではなさそう。
IMEIのチェックとかしているのだろうか。
最近のADBはDNS問い合わせでなくDHCP問い合わせに変わってきている、という情報を見てport67も確認したがだめだった。
http://stackoverflow.com/questions/37302925/amazon-dash-button-stopped-arping