ESP8266 SmartConfig

来自Jack's Lab
(版本间的差异)
跳转到: 导航, 搜索
(快速尝试)
(串口输出)
 
(未显示1个用户的9个中间版本)
第12行: 第12行:
  
  
现有的 SmartConfig 支持微信的 AirKiss 和乐鑫自己的 ESPNOW
+
现有的 SmartConfig 支持微信的 AirKiss 和乐鑫自己的 ESP Touch
  
 
<br><br>
 
<br><br>
第22行: 第22行:
 
<source lang=bash>
 
<source lang=bash>
 
# clone the whole sdk
 
# clone the whole sdk
$ git clone git://github.com/icamgo/noduino-sdk.git noduino-sdk
+
$ git clone --recursive git://github.com/icamgo/noduino-sdk.git noduino-sdk
 
+
$ cd noduino-sdk/toolchain
# fetch the toolchain of esp8266
+
$ cd noduino-sdk
+
$ git submodule init
+
$ git submodule update
+
$ cd toolchain
+
 
$ ./gen.py
 
$ ./gen.py
 
# generate the toolchain (you need Python 2.7)
 
# generate the toolchain (you need Python 2.7)
第57行: 第52行:
 
[[文件:Wechat-airkiss-wificonfig.jpg | 450px]]
 
[[文件:Wechat-airkiss-wificonfig.jpg | 450px]]
  
<br><br>
+
<br>
  
 
== 串口输出 ==
 
== 串口输出 ==
 +
 +
;;WiFi 配置的过程中,开发板的串口输出为:
  
 
<source lang=bash>
 
<source lang=bash>
第68行: 第65行:
 
TYPE: AIRKISS
 
TYPE: AIRKISS
 
T|sniffer on ch:8
 
T|sniffer on ch:8
T|PHONE MAC: 38 48 4c 69 33 75
+
T|PHONE MAC: 38 27 99 69 33 75
T|AP MAC  : e0 46 9a 8b 34 4e
+
T|AP MAC  : e0 46 39 8b 32 4e
 
T|Head Len : 74
 
T|Head Len : 74
  
第80行: 第77行:
 
T|sync:mgc end
 
T|sync:mgc end
 
T|ssid len 11
 
T|ssid len 11
T|SSID: GAGA-comcat
+
T|SSID: Jackslab
 
T|SCAN CRC SSID: 1
 
T|SCAN CRC SSID: 1
 
T|index:2, remain:3
 
T|index:2, remain:3
第88行: 第85行:
 
T|seq:1
 
T|seq:1
 
T|seq:2
 
T|seq:2
T|pswd : 9510189510
+
T|pswd : 87987898
T|ssid : MaiKeLab-K1
+
T|ssid : Jackslab
 
SC_STATUS_LINK
 
SC_STATUS_LINK
 
Store the ssid and password into flash
 
Store the ssid and password into flash
第99行: 第96行:
 
aid 9
 
aid 9
  
connected with MaiKeLab-K1, channel 8
+
connected with Jackslab, channel 8
 
dhcp client start...
 
dhcp client start...
 
cnt  
 
cnt  
第109行: 第106行:
  
 
<br><br>
 
<br><br>
 +
 +
== 微信 AirKiss ==
 +
 +
微信 AirKiss 的原理,参考此文档:http://iot.weixin.qq.com/airkiss_developer_manual.pdf
 +
 +
微信 AirKiss 目前支持的硬件:http://iot.weixin.qq.com/document-0_4.html#rd
 +
 
<br><br>
 
<br><br>
 +
 +
== ESP Touch ==
 +
 +
乐鑫也实现了类似的功能,并做了 IOS 和 Android 平台的 APP,开源在:
 +
 +
* ESP Touch for Android: https://github.com/EspressifApp/EsptouchForAndroid
 +
 +
* ESP Touch for IOS: https://github.com/EspressifApp/EsptouchForIOS
 +
 +
 +
如需尝试 ESP Touch,可将 noduino-sdk/example/smart-config/ 下 的 user_main.c 打开,找到:
 +
 +
<source lang=c>
 +
void user_init(void)
 +
{
 +
    uart_init(BIT_RATE_115200, BIT_RATE_115200);
 +
 +
    os_printf("SDK version:%s\n", system_get_sdk_version());
 +
 +
    //SC_TYPE_ESPTOUCH,SC_TYPE_AIRKISS,SC_TYPE_ESPTOUCH_AIRKISS
 +
    smartconfig_set_type(SC_TYPE_AIRKISS);
 +
 +
    wifi_set_opmode(STATION_MODE);
 +
 +
    smartconfig_start(smartconfig_done);
 +
}
 +
</source>
 +
 +
把 smartconfig_set_type 的参数换为 SC_TYPE_ESPTOUCH 即可
 +
 +
<br><br>
 +
 +
== Notes ==
 +
 +
* 开通公众号硬件 JSAPI
 +
* 硬件 JSAPI: http://iot.weixin.qq.com/document-3_1.html
 +
* 微信JS-SDK说明文档:http://mp.weixin.qq.com/wiki/7/1c97470084b73f8e224fe6d9bab1625b.html
 +
* 公众号设置 ---> 功能设置 ---> JS接口安全域名
 +
 
<br><br>
 
<br><br>
 
<br><br>
 
<br><br>

2016年9月5日 (一) 13:00的最后版本

目录

[编辑] 1 概述

所谓 SmartConfig 就是乐鑫(ESP8266 芯片厂家)为配置 WiFi SSID 和 Password 提供了一种快速配置技术

原有配置 WiFi 步骤:

  • 手机先从无线路由断开,连上设备的 WiFi 热点
  • 在 APP / WeChat 里输入设备需要连接的无线路由的 SSID 和 Password


SmartConfig 将其过程简化为无须断连无线路由,直接在 微信/APP 里输入 Password 即可,步骤大大简化,用户体验提升明显


现有的 SmartConfig 支持微信的 AirKiss 和乐鑫自己的 ESP Touch



[编辑] 2 快速尝试

下载 SDK:

# clone the whole sdk
$ git clone --recursive git://github.com/icamgo/noduino-sdk.git noduino-sdk
$ cd noduino-sdk/toolchain
$ ./gen.py
# generate the toolchain (you need Python 2.7)


插上开发板,编译上传一步完成:

$ cd ../example/smart-config

$ make flash


打开微信,扫一扫如下二维码,关注公众号:

Wechat-qcode-maike.jpg


进入公众号后,点下方菜单: 探索 ---> 添加设备:

Wechat-airkiss-add.jpg


点 ”开始配置“ 后:

Wechat-airkiss-wificonfig.jpg


[编辑] 3 串口输出

WiFi 配置的过程中,开发板的串口输出为:
scandone
f r0, scandone
SC_STATUS_FIND_CHANNEL

TYPE: AIRKISS
T|sniffer on ch:8
T|PHONE MAC: 38 27 99 69 33 75
T|AP MAC   : e0 46 39 8b 32 4e
T|Head Len : 74

SC_STATUS_GETTING_SSID_PSWD
SC_TYPE:SC_TYPE_AIRKISS
T|sync:wait
T|retain data: 2
T|all data: 22

T|sync:mgc end
T|ssid len 11
T|SSID: Jackslab
T|SCAN CRC SSID: 1
T|index:2, remain:3
T|password len: 10
T|sync:pfx end
T|seq:0
T|seq:1
T|seq:2
T|pswd : 87987898
T|ssid : Jackslab
SC_STATUS_LINK
Store the ssid and password into flash
f r0, scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 9

connected with Jackslab, channel 8
dhcp client start...
cnt 
ip:192.168.13.62,mask:255.255.255.0,gw:192.168.13.1
SC_STATUS_LINK_OVER
free heap size:50496
pm open phy_2,type:2 0 0



[编辑] 4 微信 AirKiss

微信 AirKiss 的原理,参考此文档:http://iot.weixin.qq.com/airkiss_developer_manual.pdf

微信 AirKiss 目前支持的硬件:http://iot.weixin.qq.com/document-0_4.html#rd



[编辑] 5 ESP Touch

乐鑫也实现了类似的功能,并做了 IOS 和 Android 平台的 APP,开源在:


如需尝试 ESP Touch,可将 noduino-sdk/example/smart-config/ 下 的 user_main.c 打开,找到:

void user_init(void)
{
    uart_init(BIT_RATE_115200, BIT_RATE_115200);

    os_printf("SDK version:%s\n", system_get_sdk_version());

    //SC_TYPE_ESPTOUCH,SC_TYPE_AIRKISS,SC_TYPE_ESPTOUCH_AIRKISS
    smartconfig_set_type(SC_TYPE_AIRKISS);

    wifi_set_opmode(STATION_MODE);

    smartconfig_start(smartconfig_done);
}

把 smartconfig_set_type 的参数换为 SC_TYPE_ESPTOUCH 即可



[编辑] 6 Notes















个人工具
名字空间

变换
操作
导航
工具箱