This is the procedure AT to get the TLG10UA03 on the WIFI Then on the Net

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.

Code:

+++
AT+RSTF
+++
AT+E
AT+WPRT=!0
AT+ATPT=!100
AT+SSID=!NET_SSID
AT+ENCRY=!6
AT+KEY=!1,1,password
AT+Z

the line:

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:

AT+KEY=!format,index,key

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:

AT+Z

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:

+++
AT+LKSTT

AT+LKSTT Return:

**+OK=**status,ip,netmask,gateway,dns

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:

AT+WSCAN

It should return a list a avalable WIFI network near you this way

**+OK=**bssid,type,channel,b_encry,ssid,rssi

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

AT+WJOIN

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

**+OK=**bssid,type,channel,b_encry,ssid,rssi

Or

+ERR=-10

if the setting do not match.

Finally, if you want to disconnect from a WIFI network

AT+WLEAV

Return

+OK

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. :wink: 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. : presentation on how to start a manual "HTTP" "server" on a TLG10ua03 WIFI unit - YouTube

Thanks, that is really useful information.

I'm starting the open socket, send/receive data today. I should get some answer on you emailing problem soon. :slight_smile:

Hi Frédéric

I've just bought one of these boards,

Thanks for posting the commands to join a network.

I'm very interested in your work. Have you made much progress with your library?

Thanks

Roger Clark

I'm getting there, but life has twist in a way that I don't have as much time as I would want to put in the library, but it's almost there.

Here is what is done:

The basic configuration of the module
The Scan for WIFI network procedure
The connection to an access point mode(sta)
The access point server mode(ap)
The gestion of the GPIO, read/write, including a trigger call when it detect a state change.

What is left to do:

Open a socket as Client
Open a socket as Server
And the cyclic command buffer to avoid congestion, but this can wait for a version B.

For obvious reasons, I'm not gonna touch the auto-mode section, at least for now, since it's pretty straight forward, so I'm only gonna deal the command mode.

And I also have to find a repository to put this stuff online. Almost done, but still lot of work to do. Should be ready very soon.

Thanks Frédéric

I have been experimenting with the module, but using Python on my pc, to retrieve all the parameters, and also to put connect he module as a client, using the commands you posted.

I'm also working on a basic web server, and also how to Post data to a server and also if it possible to send an email.

Re hosting for your files

GitHub is free for publically available projects
I also use Bitbucket.org as it currently allows unlimited private repositories.

I'm not sure if you've used git before, but I would recommend it.
Download the GitHub pc or mac etc client software, as the command line shell that is installed, works with most git servers, not just
GitHub

I have a GitHub account for public stuff

Cheers

Roger

Thank you for the advice Roger, i was considering github, but for what i can see so far, it's not as easy as uploading a zip file. I'm gonna do some reading about the way it work, cause in fact that is the place I want to use.

In case this is any use to anyone else experimenting with these modules ...

I've noticed that its possible to completely lock the command input both on RS232 and also on telnet (to port 23)
This seems to happen when commands to create sockets etc are incorrect etc

When this happens, you can send +++ and get +OK, but if you send anything else doesn't get processed (and you don't get any responses). Also on telnet (23) you can login, but commands don't get processed and you don't get any response.

However the web interface still seems to work.

One way to unlock the command buffer seems to be to access the other web server port address e.g. http://192.168.1.100:50000 (not the admin web server on port 80)
This seems to push data through the module and unblocks whatever was wrong with the command processing, so that if you then send +++ on RS232, you get +OK and are then able to send AT+ and get +OK back as normal

BTW. I've also found an undocumented command of AT+&UPDM (you get the response +OK=0) however I've no idea what it does :wink:
There are some other undocumented commands that may work on other similar modules including AT+&UPDD AT+PPPPASS and AT+PPPUSER
But these last 3 don't work on my module (but the UART Config.exe tries to send them)

Wow! Lot of work done here friend :wink:

On my side, I have finally found how to open a http port, and request data, only using AT command, close it and then do it again. Google.ca must of think I was anoying yesterday, but it done.

Like most of you, I was only using the module in auto-mode until now, with all the limitation that come with it. But those days are over now, for me, and for you to soon. :wink: So my Simple HTTP client will be ready soon, then I make the simple HTTP server, chat client, chat server. Ny way I have about 3 commands left to do in the library.

Wouah that was lot of work to.

Hi Frédéric

I made a simple web server, just one page using auto work mode ie transparent mode, by just waiting for e http get command, and then waiting for the new lines at the end of he get
Then just write the web page header and content length and the actual web page data HTML text

I have also tried opening a socket in client command mode I,e +++ then at+skct which returns the socket number, then I've tried to use SKRCV to receive the connection message on an email server
But that's as far as I've got

Did you write code to do the same thing but do a http post or get .?

Thanks

Roger

I'm still on the client sketch, but it's all happening in AT command mode. I'm at the point where i send the http GET thing and I get the whole web page in the module buffer. Now, after i'm done watchin Grim, i will finish the client.

Of coarse i'm not gonna do an html parser, I will leave that to some one else, but the whole htlm code will be displayed. Then i'm starting the http server.

Hi Frédéric

I wrote some HTML scraping code eg to read weather data, but for an spi Ethernet module.

It's not practical on small arduinos to parse HTML as most pages are much bigger than the ram inside the Arduino, so the only option is to search for strings on the fly to find the parts of the web page that are need

My code was very basic, but it worked for me.

I will need to try my code with the wifi module

Hi all

I have built a library that does some basic functions, that should allow anyone to create client or server based applications using some low level call.

My library can

Reset the module and wait for it to be ready to receive commands
Enter command mode
Check network connection state, and wait for network to be connected (in STA mode I,e wifi is a client which connects to a normal access point)
Create a network socket, to a IP address or URL on a specific port
Send data on a network socket
Receive data on a network socket
Close a network socket

With these commands I've written a function to send an email using SMTP

I'm going to put my library on GitHub, but one problem I have, is what to call the library.

I was going to call it UARTWifi, but I think there are lots of different types of wifi modules which interface via RS232, so perhaps I should call it TLD13UA-wifi. Or something like that.
However I think that there are various model numbers that should work.
The board I have is this one.
http://www.aliexpress.com/item/2-4G-Wireless-Module-Embedded-Uart-Wifi-Module-UART-WiFi-Network-Server-Client-IEEE802-11b-with/1752040109.html

Does anyone in the Arduino community have an suggestions about naming this library so that its name is self explanatory but doesn't clash with other wifi modules that operate over rs232 but use different command protocols

Cheers

Roger

Hi Guys,

I just thought I'd post my experiences with my "UART Wifi" module bought from AliExpress.
http://www.aliexpress.com/item/2-4G-Wireless-Module-Embedded-Uart-Wifi-Module-UART-WiFi-Network-Server-Client-IEEE802-11b-with/1752040109.html
The module number of the module was not specified in the listing on AliExpress, but it can be just about seen on the bottom right of the PCB in the photo, as TLN13UA06
This seems to be a more recent version of the TLG10UA03.
See this link to what appears to be the manufacturer of this device
http://winnermicro.com/eproduct.asp?id=19
Or possibly
http://www.hed.com.cn

I’ve also noticed that the same device also seems to be re-branded as "M03 - LVTTL UART"
See http://www.thaieasyelec.com/products/wireless-modules/wifi-modules/m03-lvttl-uart-to-wi-fi-with-at-command-ieee802-11b-g-detail.html
And also under several other guises.

However I have some concerns about the firmware that is supplied on these devices, which means they may not operate as advertised.
Specifically. When I received my module, and powered it up (using 3.3V from a bench power supply), the device appeared as a wireless Access Point (aka router) with the SSID of “UART Wifi”.
However after I did a factory reset on the module, because I’d messed up some of the settings, the module SSID changed to “Wifi Socket”
Which leads me to think that my modules are possibly rebranded parts destined for this product
http://www.wifiplug.co.uk/updates.html

But it’s hard to know for sure.

I can’t find any documentation that is definitely for this module, however the best documentation I have found is this http://www.elechouse.com/elechouse/images/product/UART%20WiFi%20Transparent%20Module/User%20Manual-03_ENGLISH.pdf
Which appears to have been machine translated from Chinese into English and is probably the manufacturers’ original documentation plus additions by elechouse.com http://www.elechouse.com/elechouse/index.php?main_page=product_info&cPath=90_186&products_id=1007

Power supply requirements

These modules operate only on .3V, but consume on around 50mA. I have seen reports on the web that these devices can consume up to 300mA, however I've not found that to be the case, even with repeatedly sending data to the module it only consumed 50mA. The spec for the TLN13UA06 is for a power requirement of 420mW, which would require around 125mA at 3.3V
Either way, the 3.3V output from an Arduino is not going to be adequate to power this module. The best option is to use a voltage regulator to produce the 3.3V from the 5V on the Arduino

Interfacing data lines with a normal 5V Arduino
Best practice is to do signal level translation for signals from the Arduino to this module (However it appears to be 5V tolerant on signal lines, i.e I applied 5V signals to the RX input from a USB to Serial adapter and it didn't seem to harm the module.)
Resistor dividers seem to work fine for this, and even using a single resistor in series with the data lines e.g 2K seems to function OK.
Fo my RX data I used a divider made from 1K and 2K as I happened to have these values handy.
Inputs to the Arduino don't need any signal conditioning.

Connections to the Arduino

The device communicates via RS232 on its TX and RX pins. These need to be connected to the RX and TX lines on the Arduino, however on ATMega328 Arduino's these lines are already used for host comms with the PC / Mac etc.
So Software Serial can be used on any Arduino's that don't have unused RS232 lines.
Or on the Mega2560 or Leonardo etc, that have more than one set of serial lines or don't use the lines for host comms.

Note. If using Software Serial, the maximum baud rate that worked for me was 57600.
Using Hardware Serial functions up to the maximum speed that the module supports, which is 115200.

The other 2 signal lines that can be useful are the Reset line and RTS.
Reset can be driven LOW to reset the module.
RTS can in some circumstances be used to determine when the module is has finished booting up (more on this later or in a future posting).
I connected Reset to a data pin via a 2k resistor, driving Reset low for even a very short time e.g. 1ms seemed to reset the module.

The other lines on the module are CTS, and LINK.

In the documentation for some of the module variants, the CTS line is designated as an input and could be used to enter command mode if CTS is taken LOW during Reset LOW and held low for at least 300mS after Reset has been made to go HIGH.
However in my testing, holding CTS LOW made no difference to the operation of the module. But I could be miss-interpreting the documentation as it appears to have been machine translated from Chinese into English any many things are not entirely clear.
The CTS line is also known as GPIO and can be controlled as either an input or output pin, however I’ve not experimented with this, as it seems fairly pointless when the module is being connected to an Arduino which probably has at least 10 spare IO lines available.

On my module the LINK line appears to drive the on board green LED which flashes when the board is functional.
I have not looked into detail on the use of the LINK line. It could easily be connected as an input to the Arduino, and the Link state determined by monitoring the duration of the flashes, however as Link State is available via an RS232 command this seems fairly pointless.

Default configuration

Most documentation seems to suggest that the default data rate for the module is 115200. However this was not the case for my module.
When I received it, the data rate was set to 9600N81 i.e 9600 baud.
The default Wifi mode for my module was AP (Access Point) i.e it appears on your Wifi network if it’s a router or other device that PC's / Macs / Tablets etc can connect to.

The Wifi security on my device was set to Open, ie no password etc require to connect.

The default IP address of the module in this mode seems dependent on who supplied it, as suppliers seem to configure different settings and save them to the internal non volatile storage in the device.
The best way to figure out what IP address the module is on, is to connect via a PC and then in at the command prompt, (CMD)
Type ipconfig to list the connections and look for the Default Gateway address e. 192.168.1.1

To test the connection use this address in your browser and you should see the web admin page
e.g. http:// 192.168.1.1 and login using the default
username: admin
password: 000000

It’s also possible to communicate with the module via Telnet on port 23 and logging in using the password 000000 (Thanks Frederic for this information)

Part 1 of 2 ....

continued from previous post....

Basic configuration

Probably the best way to initially configure the module and change the RS232 data rate to something higher than 9600 is to use the web admin.
Just login, make the changes and Save. It’s also necessary to sometimes restart the module from within the web admin to action some of the settings.

Federic has previously posted who to configure the module using AT commands to put it into STA mode, so that it connects to an existing wifi hub, these commands can be sent by using Telnet to port 23 and the same thing can be achieved using the web admin.

What works and what I can’t get to work

First the good news.
It’s fairly easy to get the device to work as a “transparent” web server, where the http requests from browsers appear as incoming characters on the serial port of the Arduino and responses are sent back to the web browser just by writing (printing) to the serial port
However, there is a complication to this if you want to serve normal HTTP pages (and I suspect very much else).
The module doesn’t have a function to disconnect at the end of sending data (well not one that I’m aware of), which means that HTTP 1.0 responses can’t be used, because they rely on this to tell the client (browser) that the web page has been sent.
So HTTP 1.1 responses have to be used, and these have a “Content-length: “ in the HTTP header, which needs to contain the total number of characters in the actual HTTP page. Which means that the http page needs to be generated and its length counted before the header and then the page can be sent.
I suspect that rather than serving complete pages, the Arduino would be more suited to creating some sort of web service e.g. REST that uses HTTP GET and from an AJAX request on a remotely hosted web page.

It’s also not too difficult to use the AT commands to open a “socket” to a remote computer i.e a server and do tasks like send an email or do a HTTP POST or a HTTP GET to transmit data to a remote server.

Now the bad news...
The web server can’t run on port 80 i.e the port for normal web pages, so you need to specify the port address as well as the IP address for the web page
e.g. http://192.168.1.1:50000 (where the web server is on port 50000)
This is because the web admin operates on port 80, and there doesn’t seem to be a way to move this or stop it operating e.g. via AT commands.
Also...
I've been unable to create any other incoming sockets / ports on the module.
The module has a built in server port for use by the host, e.g. on 50000
Theoretically the AT commands can open additional "Server" sockets on different, however on my module, if I attempted to create a “Server” socket e.g. on port 8080, I was unable to connect via telnet or the browser, and creating a new Server socket sometimes seemed to disable the normal web server e.g on 50000
Using the AT commands, its possible (though undocumented) to stop the default web server, as it operates on Socket number 1, which is created shortly after the module boots up.
I can’t see a use for stopping it, but I suppose it’s good to know that you can.

Usefull information
How to rest the module. I recommend connecting the Reset pin to a output on the Arduino via a 2k or more resistor.
Then in the code, drive the output low for a short period of time 50mS is plenty, I think less than 1mS all it needs.
The module then needs around 5 seconds to boot up, and more time to connect to a network (if configured to do so).
I have found that monitoring the RTS line as an input into the Arduino is a fairly good way to determine if the module is ready to receive commands.
When Reset is taken low, the RTS line goes low for a short period, it then goes high for a few seconds, before going low again, which indicates the module is ready. (but not necessarily connected to a wifi access pount)
The code I use to reset is

void UARTWifi::debounce(int pin,boolean desiredValue,int delayMS)
{
boolean sample1;
boolean	sample2 = digitalRead(pin);

	do
	{
		sample1=sample2;
		delay(delayMS);
		sample2=digitalRead(pin);
	} while (sample1!=desiredValue && sample2!=desiredValue);
}
/*
 * resetModule() 
 *
 * Method to reset the module and wait until module is ready
 *
 * Note. This method uses the rst pin on the module to determine when its ready to receive RS232 traffic.
 * However there can be some noise problems on the rst pin which cause false inputs into the Arduino.
 * One method to overcome this is pulling the rts line to GND via a 10k resistor, or putting a small capacitor 
 * e.g. 100nF between rts and GND.
 * Sometimes, increasing the debounce delay can overcome the noice problems.
 *
 *
 */
void UARTWifi::resetModuleUsingRTS() 
{
	delay(100);// Wait 100ms for Arduino to settle etc.
	pinMode(_rtsPin, INPUT); // read the value of the RTS pin
	pinMode(_resetPin, OUTPUT); // control the Reset pin. Note this needs to be connected via a resistor divider network of 1k / 2k as the module is 3.3V

	//  Wait for the RTS pin to be low. If its not low, the module is not in an operational state.
	//	i.e it may have a glitch caused by the upload or power-up etc
	debounce(_rtsPin,0,1);
	
	digitalWrite(_resetPin,LOW);// Put module into reset
	
	// RTS will go low when module is in reset. So wait for it to go low.
	debounce(_rtsPin,0,1);
	
	digitalWrite(_resetPin,HIGH);  // Take module out of reset

	// RTS stays low some time after reset. Low normally means that device is ready, 
	// but this is a false report just after a reset, so wait for it to go high
	debounce(_rtsPin,1,1);

	// Wait for RTS to go low again, which will indicate the the module is finally ready. 
	// Note this may take some time as it depends on not only booting up, but also connection to access points if in STA mode.
	debounce(_rtsPin,0,1);
}

I use Feederic’s commands to put my module it STA mode so it connected to my Wifi router, but I think you can do the same thing using the web admin screen. (Except possibly the WJOIN bit)

Thats about all I can think of at the moment, but if I’ve missed something I’ll post again with an update.
Thanks again to Frederic for his help via PM etc.
Cheers

Roger

Great work, the gpio is pointless if you use the module along with Arduino. How ever, if you make an RFID control lock, for example, since you can hook the RFID device on a serial port of the wifi module, and a relay that control a door lock buzzer on the gpio, then control the gpio from the telnet port 23 from a host computer.

There are lot of home device project that can use these kind of module. Like jukebox mp3 in this case, the wifi module serial port control wich song is playing and the gpio is controling the funky light tha come with it.

Another use i've made lately was to hook a serial jpeg camera, OV528, to the wifi module, and I fire a flash from gpio.

Any way, this module is great for Arduino, but it is also great for all kind of use.

Thanks Federic

I had not considered how at commands sent via telnet in port 23 could be used to control the module,
rather than the device being used with an Arduino.

It's a shame I can't find any original documentation from the manufacturer. All I can find is reworked documents form companies who sell variants of the module.

I think I may try sending an email to the Chinese company who seem to be the prime source of these, to see if they can send me links to any other documents, even if they are in Chinese.

I'd be really interested to hear from anyone else using these modules, to see if the firmware is different, specifically if my module has firmware specific to it being used to control a mains socket, or if wifi-socket is the default SSID for these

Even better, I'd love to get hold of the firmware source code so that I could make the module work better, e.g incorporate a hardware way to reset back to factory settings etc.
But I guess that its very unlikely that access to the firmware would be given unless I was buying thousands of these devices

Cheers

Roger

It would be good if every one shared what come out of the

AT+QVER

command, so we could know who has what version and that version does what.

Mine is

+OK=H1.00.00.0000,F6.20.62@ 17:39:26 Mar  6 2014

And

+OK=H1.00.00.0000,F6.10.12@ 17:07:40 Jul  2 2013

Yep I got 2 different firmware. lol

Did you try to turn off the configuration webserver to see if it free port 80?

Yep

AT+WEBS=!0

Free port 80

Then I open a socket`:

AT+SKCT=0,1,0,80

I send some stuff, then I come back to my socket to see what is in, this way:

AT+SKSTT=1

And the reply is kinda surprising:

+OK=1,1,"255.255.255.255",80,0
                                                
2,2,"192.168.2.14",1540,65

It has open a second socket to host my connection to keep port 80 free. that is probably why you could not connect on you host.

And has we can see Socket 2 is connected on port 1540 and has 65bytes waiting in the buffer. So I

At+SKRCV=2,65

And it return

+OK=65
                                                                        
        
                                                                      
dfhadfhadfh
                                                                   
dfhadfhadfh
                                                                   
dfhadfhadfh
                                                                   
dfhadfhadfh
                                                                   
dfhadfhadfh

wich is exactly what I have send