I will make some library in the near future that should be pretty much like the WIFI library.
N.B.1 The “!” in the command mean SET, and the “?” mean GET. For some reason, if you don’t respect this “!?” convention, it might or might not work when you try to configure your device.
+++ AT+RSTF +++ AT+E AT+WPRT=!0 AT+ATPT=!100 AT+SSID=!NET_SSID AT+ENCRY=!6 AT+KEY=!1,1,password AT+Z
AT+RSTF Is optional if you got a new module. It’s there to assure that you start from factory setting.
+++ Is to set your module in AT command mode
AT+E Is to get a Echo from the module to see what you are typing and it’s also optional.
AT+WPRT=!0 Is to put the module in Infra network mode, Use !1 to put in ADhoc mode
AT+ATPT=!100 Is the automatically set frame period, set it up according to your network need. For some weird reason this setting is set to 0 by default making the module unable to work correctly.
AT+SSID=!NET_SSID This is were you put your WIFI network name.
AT+ENCRY=!6 Is the encryption type you must set:
0 = OPEN
1 = WEP64
2 = WEP128
3 = WPA-PSK(TKIP)
4 = WPA-PSK(CCMP/AES)
5 = WPA2-PSK(TKIP)
6 = WPA2-PSK(CCMP/AES)
AT+KEY=!1,1,password Is where you set the WIFI password. And it goes like this:
for the format, 0 = HEX, 1 = ASCII… The index is a number from 1 to 4, and finally the Key is your WIFI password
To end this right, you must reset your module. To do this:
If you configured every thing well, your module should be connected to you WIFI
N.B.2 The AT command standard is made in such way that it’s expecting a at the end of each AT command. If the command pass well you should return +OK, or +ERR if it’s not OK. It is very important to wait for the OK other way it might go wrong. How ever, the +++ should not be followed by .
To know the module ip address:
status 0 = not connected 1 = connected
ip is you module ip address
netmask is the network mask
gateway most of the time this is your router address these days
dns is of coarse the dns that your ISP is using.
Now you have your module ip address, it should answer to ping. So
Ping -t your_module_ip
From there, you can use those command:
It should return a list a avalable WIFI network near you this way
bssid of the routers
type is the type of network
channel is the transmission channel of the WIFI routers
b_encry is the encryption use on the network
ssid is the SSID of the WIFI routers
rssi is the signal strength of each router
the AT+WSCAN command will only work in infa network mode, so when AT+WPRT is set to 0
Will create a ADhoc server if AT+WPRT is set to 1 or join the WIFI network setup by the above setting if AT+WPRT is set to 0. It will also return
if the setting do not match.
Finally, if you want to disconnect from a WIFI network
N.B.3 This sequence should also work for the HLK-WIFI-M03 module since it use the same AT command set and procedure. But I would like some feed back from those who has this module to know if it’s true or not…
There are other AT command, but to get your WIFI module connected to your WIFI network those are the one you need.
I will get back to you on how to open a socket very soon.
And as promessed I did. You can see on this screenshot video the full procedure on how to open a TCP socket as server and reply to a HTTP request to send it to a client web browser.
ALthouth I really suggest you read the whole post I think it is very intersting to see the progress from here. : http://youtu.be/82lqKpdIPg4