DC 5V ESP8266 WIFI 4 Channel Relay Module Remote Control Switch IOT Wireless Transmitter For Smart Home

Wifi初期化方法
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/274715/6b755b0e-a4b8-42f0-93d9-6368ef7e575d.png)
http://www.icstation.com/esp8266-wifi-channel-relay-module-remote-control-switch-wireless-transmitter-smart-home-p-13420.html

Wifi Chipを取り外します。
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/274715/4a2c2a95-fff5-b09f-86d8-e9b6d676872d.png)

![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/274715/b8b129b3-87de-b96b-35f4-a06b5702caff.png)

Usbアダプターを使ってPCに接続します。
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/274715/7501ebbc-d808-a86a-cc6c-df2307a76c31.png)
設定は、次の通り
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/274715/c4a70b7c-abbe-25dd-4b44-1e06f67d5264.png)
Arduino IDEを開きます。
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/274715/7a5be770-aecd-fa81-a868-62270b999d65.png)
ツール->シリアルモ日を開きます。
**バージョンチェック

```
19:16:52.065 -> AT+GMR
19:16:52.065 -> AT version:1.1.0.0(May 11 2016 18:09:56)
19:16:52.065 -> SDK version:1.5.4(baaeaebb)
19:16:52.065 -> compile time:May 20 2016 15:08:19
19:16:52.065 -> OK

```
モードチェック

```
21:53:49.583 -> AT+CWMODE?

21:53:49.583 -> +CWMODE:1
21:53:49.583 -> 
21:53:49.583 -> OK
```

1であればStation Modeでwifi設定をする。
wifi環境を調べる

```
21:54:35.244 -> AT+CWLAP

21:54:37.400 -> +CWLAP:(3,"InageHigashi",-59,"58:52:8a:3f:8a:23",1,-36,0)
21:54:37.400 -> +CWLAP:(1,"hrd",-60,"5a:52:8a:3f:8a:23",1,-36,0)
21:54:37.400 -> +CWLAP:(0,"WARPSTAR-882EA6",-90,"00:1b:8b:8c:cd:73",1,0,0)
21:54:37.400 -> +CWLAP:(4,"08EDB97DB0F1",-73,"08:ed:b9:60:5b:01",2,-32,0)
21:54:37.400 -> +CWLAP:(3,"elecom-6059a7",-88,"04:ab:18:60:59:a9",4,-29,0)
21:54:37.400 -> +CWLAP:(3,"Buffalo-G-0B50",-81,"74:03:bd:93:0b:50",5,-36,0)
21:54:37.400 -> +CWLAP:(3,"elecom2g-b51471",-87,"bc:5c:4c:b5:14:71",5,-29,0)
21:54:37.400 -> +CWLAP:(1,"aterm-a4279c-gw",-89,"a6:12:42:4b:23:17",1,-16,0)
21:54:37.400 -> +CWLAP:(4,"F660A-ZTnD-G",-80,"cc:1a:fa:c8:ff:ae",6,-31,0)
21:54:37.467 -> +CWLAP:(4,"HUMAX-7A7FD",-84,"94:09:37:37:a8:0a",6,-31,0)
21:54:37.467 -> +CWLAP:(0,"Guest-20C0",-89,"18:c2:bf:4b:20:c3",8,-29,0)
21:54:37.467 -> +CWLAP:(3,"ELEKASHI-2.4G",-86,"10:da:43:c7:fb:7f",8,-34,0)
21:54:37.467 -> +CWLAP:(1,"00035088T",-88,"00:03:24:6a:d2:a7",8,-7,0)
21:54:37.467 -> +CWLAP:(3,"D-roomWiFi-ALSOK-G",-94,"50:c4:dd:82:95:28",1,-27,0)
21:54:37.467 -> +CWLAP:(4,"HUMAX-1D6A5",-91,"94:09:37:e1:d6:b2",1,-26,0)
21:54:37.467 -> +CWLAP:(2,"106F3F3DEF4D-1",-78,"10:6f:3f:3d:ef:4d",11,-61,0)
21:54:37.467 -> +CWLAP:(4,"106F3F3DEF4D",-75,"16:6f:3f:3d:ef:4d",11,-59,0)
21:54:37.467 -> +CWLAP:(3,"Buffalo-G-B560",-76,"74:03:bd:ca:b5:60",11,-37,0)
21:54:37.502 -> +CWLAP:(1,"106F3F3DEF4D-3",-78,"1e:6f:3f:3d:ef:4d",11,-59,0)
21:54:37.502 -> +CWLAP:(3,"DIRECT-D319A2AD",-83,"9e:ae:d3:19:22:ad",11,-21,0)
21:54:37.502 -> +CWLAP:(4,"HUMAX-BD454",-87,"90:f3:05:bb:d4:61",11,-34,0)
21:54:37.502 -> +CWLAP:(1,"ssw-wep-3225c7",-88,"00:24:6b:6b:55:75",11,-44,0)
21:54:37.502 -> +CWLAP:(3,"7777",-88,"e4:f4:c6:19:a3:e3",13,-19,0)
21:54:37.502 -> +CWLAP:(3,"D01572-12",-83,"0a:00:23:fd:36:49",13,-49,0)
21:54:37.502 -> +CWLAP:(3,"D01572-13",-81,"1a:00:23:fd:36:49",13,-47,0)
21:54:37.502 -> +CWLAP:(3,"D01572-14",-84,"2a:00:23:fd:36:49",13,-49,0)
```

wifiに参加する

```
21:57:25.587 -> AT+CWJAP="SSID","Password"

21:57:25.587 -> WIFI DISCONNECT
21:57:27.712 -> WIFI CONNECTED
21:57:30.457 -> WIFI GOT IP
21:57:30.594 -> 
21:57:30.594 -> OK
```

接続確認

```
21:59:13.207 ->  AT+CIFSR

21:59:13.207 -> +CIFSR:STAIP,"192.168.1.15"
21:59:13.207 -> +CIFSR:STAMAC,"b1:e1:21:68:22:ff"
21:59:13.207 -> 
21:59:13.207 -> OK
```