企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
Label: nodemcu open-source wifi socket --- # Introduction [https://github.com/lewei50/lua-on-nodemcu/tree/master/demo/ESP8266-ACMETER-SWITCH][1] Provide nodmecu source codes & Schematic diagram PDF. Features: Secondary development could be done based on nodemcu. It can be used on DeviceBit(with current codes) or other platform(modify codes by yourself). Disadvantages: there are minor whistles with the current version. Video: [Open-source WiFi Socket for DeviceBit](http://v.youku.com/v_show/id_XMTc3NzgyNjY0MA==.html?spm=a2h0k.8191407.0.0&from=s1.8-1-1.2&qq-pf-to=pcqq.c2c) # Procedures The procedures for this socket are devided into two steps: 1 Flash firmware 2 Web configuration Please see the following detais: ## Flash Firmware 1 Download Firmware Download Address [bin](https://github.com/lewei50/lua-on-nodemcu/tree/master/demo/ESP8266-ACMETER-SWITCH/firmware) Source code on github: [https://github.com/lewei50/lua-on-nodemcu/tree/master/demo/ESP8266-ACMETER-SWITCH/software](https://github.com/lewei50/lua-on-nodemcu/tree/master/demo/ESP8266-ACMETER-SWITCH/software) ![1](http://upload-images.jianshu.io/upload_images/5862021-0b036e351779010b.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 2 Download flash tool The flash tool used this time is esptoolpy esptool.py download [https://nodemcu.readthedocs.io/en/dev/en/flash/](https://nodemcu.readthedocs.io/en/dev/en/flash/) 3 Steps When you install the python script, use the USB line to power the socket, and then run the following command: esptool.py --baud <baud rate> --port<serial-port> write_flash -fm dio -fs 32m 0x00000 <NodeMCU firmware> For example: esptool.py --baud 230400 --port COM7 write_flash -fm dio -fs 32m 0x00000 "D:\SVN\BIN\ESP8266_ACMETER_CONTROL.bin" pause ![2](http://upload-images.jianshu.io/upload_images/5862021-b14be1cbb31d522b.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) As shown in the picture above, when you see the "Leaving" in the window, press any key to continue, then this procedure is complete. ## Web Configuration 1 Sign up one account: [http://www.devicebit.com ](http://www.devicebit.com/) ![3](http://upload-images.jianshu.io/upload_images/5862021-33656352d1494dbb.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 2 Login to the system, add the device and sensor (Please refer to the above chapter) Please make the following things ready: Add 3 sensors on DeviceBit, the IDs are "AI0", "AI1", "AI2", all under device 01. Steps: Add the device, as the picture shown below: ID: 01(This ID is very important, for it will be used later). Name: Testing Socket, Cotrollable: tick Yes, click on "Use API address" then API address and Internet IP will appear automatically. ![4](http://upload-images.jianshu.io/upload_images/5862021-2f51bd4c8a2158d7.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) Add sensors: Volt, Power, and Energy ![5](http://upload-images.jianshu.io/upload_images/5862021-47e6d0b2a4cdb707.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ![6](http://upload-images.jianshu.io/upload_images/5875248-676861a748a4b3c2.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ![7](http://upload-images.jianshu.io/upload_images/5875248-35f503696499a0e7.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) Add 1 controller, ID: "DO", name: "Socket" ![8](http://upload-images.jianshu.io/upload_images/5862021-b859b2c96df34d9d.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) Then you can go to "My Devices"-"Devices"-"Sensors&Controllers" to check the above 3 sensors and 1 controller. ![9](http://upload-images.jianshu.io/upload_images/5875248-46600e4714eb6a79.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) ![10](http://upload-images.jianshu.io/upload_images/5862021-64157581884f503e.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) 3 WiFi Configuration Long press the button on the socket above the indicator light, flash button: more than 3 seconds until the green light turns red. Search WiFi signal on your PC, if you find the SSID which begins with ESP8266_#####, click on it and connect. ![11](http://upload-images.jianshu.io/upload_images/5862021-78882b707dce2fd5.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) Password: 12345678 ![12](http://upload-images.jianshu.io/upload_images/5862021-a1d040aa5a319cc3.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) Enter 192.168.4.1 in your browser, then the following picture will appear: ![13](http://upload-images.jianshu.io/upload_images/5862021-f53abce7bc78baaa.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) Enter the ID 01 of your device just added for "gateway", then find your Userkey in the user center "My account"-"Account Setting". Fill in the SSID and the correct password you can access. ![14](http://upload-images.jianshu.io/upload_images/5862021-5cd9bf3dc9ae2567.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) After saving, if all of these are correct, the ESP8266_XXXXX of this SSID will automatically disappear. It will appear again when there is no Internet connection. That is to say, if you want to change a WIFI connection, then turn off the WIFI that it is connecting and reconfigure it. ![15](http://upload-images.jianshu.io/upload_images/5862021-1f279aa5837154ed.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) About two minutes later, you will find real-time data of voltage, power and power consumption on DeviceBit. ![16](http://upload-images.jianshu.io/upload_images/5875248-16a16d22c941e5a3.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) Go to "My Devices" - "Centralized Monitoring", you can click on the switch button on the page to control socket and electrical appliance on it remotely! ![17](http://upload-images.jianshu.io/upload_images/5862021-2e945b69a50f3af8.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240) [1]: https://github.com/lewei50/lua-on-nodemcu/tree/master/demo/ESP8266-ACMETER-SWITCH