Fork me on GitHub
WiFiMCU Introduction

WiFiMCU is developed based on  EMW3165. Run the Lua script directly; operate hardware resource; achieve product prototypes. EMW3165 is a low-power embedded WIFI module, which is developed by the Shanghai MXCHIP Technology Co., Ltd. It incorporates a WiFi RF-Chip and a microcontroller based on STM Cortex-M4. The WiFi module includes a "self-hosted" WiFi network library and application components. In addition, It also provides 2M bytes of out-chip flash, 512K bytes of on-chip flash, 128K bytes of RAM and a rich peripheral resources.

Features
Script program, Open source software and hardware,Multi-Interface,Low-Cost

Interaction easily, Lua scripts program,Run directly

Reliability,STM32 MCU,Multi-Interface with sensors/monitor/actuator

Lua interaction,connect with wireless router,Send data to remote server,Provide rich WiFi and net function

Hardware Feature

Cortex-M4 microcotroller
STM32F411CE
100MHz,Cortex-M4 core
2M bytes of SPI flash and 512K bytes of on-chip flash
128K bytes of RAM
Multi-Interface
17 GPIO Pin
3 UARTs
ADC(5)/SPI(1)/I2C(1)/USB(1)
SWD debug interface
11 PWM
Broadcom IEEE 802.11 b/g/n RF Chip
Supports 802.11 b/g/n
WEP,WPA/WPA2,PSK/Enterprise
16.5dBm@11b,14.5dBm@11g,13.5dBm@11n
Receiver sensitivity:-87 dBm
Station,Soft AP and Station+Soft AP
CE,  FCC  suitable
Operation Temperature:-30℃ ~ +85℃
Software Feature

Lua Interpreter,Serial Interation,WiFi and Net Module,File System,Interface Module

tcp/udp debugging tool

serial debugging tool(putty、Tera Term Pro),serial parameters:115200,n,8,1

Startup


Demo

Build AP
>cfg={ssid='Doit_3165',pwd=''}
>wifi.startap(cfg)
WebServer
>cfg={ssid='Doit_3165',pwd=''} wifi.startap(cfg)
>function listen_cb(c,ip,port)
    c:on("disconnect",function(c) end)
    c:on("sent",function(con) end)
    c:on("receive",function(c,pl)
    c:send([[HTTP/1.1 200 OK
Server: WiFiMCU
Content-Type:text/html
Content-Length: 19
Connection: close]]..'\r\n\r\n'..[[
Welcome to WiFiMCU!]]) end)
end
>sk=net.new(net.TCP,net.SERVER) sk:listen(80,listen_cb)
Connect Wireless Router
>print(wifi.sta.getip())
0.0.0.0
>cfg={ssid="Doit",pwd="123456789"} wifi.startsta(cfg)
>print(wifi.sta.getip())
192.168.1.112
Connect Remote Server
>sk2=net.new(net.TCP,net.CLIENT)
>sk2:on("connect",function(c) print("client connected") c:send("From WiFiMCU") end)
>sk2:on("receive",function(c,pl) print("receive data:"..pl) c:send("Hello WiFiMCU")end)
>sk2:connect(6579,"115.29.109.104")
GPIO Operation
>gpio.mode(6,gpio.INPUT)
>print(gpio.read(6))
0
>print(gpio.read(6))
1
>gpio.mode(6,gpio.OUTPUT)
>gpio.write(6,gpio.HIGH)
Timer Operation
> function tmr_cb() print('tmr1 is called') end
> tmr.start(1,1000,tmr_cb)
> tmr1 is called
File Operation
> file.open ("test.lua","w+")
> file.write("this is a test")
> file.close()
> file.open ("test.lua","r")
> data=file.read()
> print(data)
this is a test
> file.close()
>
Self-Start
>file.open ("init.lua","w+")
>file.write("print('Hello world!')")
>file.close()
>mcu.reboot()