I’m actually having success in connecting the super-cheap WI07C wifi module to my home network, so that an arduino can send data anywhere.
I can now reliably establish a TCP connection and send data back and forth. It works rather well, with some limitations. It helps that I came across some slightly better documentation, sourced from this esp8266.com forum post which lists a few more AT commands and some more illuminating explanations.
AT+CIPMODE=1 or 0 (1 is default) sets the data receiving mode of the socket. If it’s 0, received data is simply sent to the serial port. If it’s 1, data gets “+IPD,c,n,” prepended to it, where c is the channel number and n is the number of bytes received. c is omitted if you are in single-channel mode. If you have multiple connections going in, this mode is logical. If you have only one, it may be simpler to use the transparent mode (AT+CIPMODE=0). But see AT+CIPSEND below, because this is affected by AT+CIPMODE!
The usual documentation about this is a bit pants. Here’s how it works. When you issue an AT+CIPSEND command, you normally tell it the channel you want to send it over (the chip can keep four IP connections going at once) and the number of bytes you want to send (call it n). The module then responds with a “>” character. It will then take the next n bytes you give it and send them over the TCP link. Then it responds with “SEND OK” and returns to normal, waiting for your next command. There are three variants of the AT+CIPSEND command, however:
AT+CIPSEND=channel,length is used if you have multiple connections open (AT+CIPMUX=1)
AT+CIPSEND=length is used for a single channel (if you have previously issued AT+CIPMUX=0 to tell it that you will only use one connection at a time)
AT+CIPSEND can be used without any parameters if you are using a single channel and transparent data mode (AT+CIPMODE=0). Note that there is no channel or length specified in this variant. After you issue the command, it will simply send every byte you throw at it directly to the receiving socket. This includes AT+ commands. Note that I have as yet found no way of exiting this mode other than resetting the module.
Also note that if you are in transparent data mode (AT+CIPMODE=0) and you try to use the variant of AT+CIPSEND which uses a length value, it won’t just fail or ignore it, it will actually reboot the module.
Lesser known AT commands not in other documentation
AT+GMR retrieves the firmware ID of the module. There are at least two versions in the wild.
AT+CIPSTO=60 Sets the socket timeout period to 60 seconds
AT+CIPSTO? gets the current timeout value
You might want to change this value because if the server closes the socket, and your timeout value is too high, there appears to be nothing you can do from the client end other than do a hardware reset. I’m thinking it’s probably going to be necessary to tie the CH_PD line of the module to an output from the arduino, as I’m bound to want to reset from software at some point.
It’s good to make some progress. I’m going to look at the using the module as a server next.
10 Replies to “Wifi success, for a change!”
can you detailed write, how you get on to transparent mode for sending data from UART over WIFI ?
I connect USB TTL for TestCommunication with the modul.
Simple must connect a TCP Server that run at a Win PC.
Link is ok for normal Mode
New send is done by replay this ..
But how i can jump to the transparent Mode if data write that send over wifi to the server ?
but receive only 9 characters
Firmware was tested:
On the modules I have, you enter transparent mode by sending AT+CIPMODE=1. The default, as you have found, is AT+CIPMODE=0. Once you enter transparent mode, every byte sent or received will be passed straight through. This includes AT commands, so I have no idea how to exit transparent mode other than doing a hardware reset of the module.
you can exit by typink: +++
Can you provide a complete wiring diagram. I received 5 of these and I can’t get the first two I have tried to connect to provide AT command feedback
Any help would be appreciated. Just excited to have them and get them to work.
I have tried many combinations. Right now VCC, GND, TX, RX are connected and holding RST high
I’ll post a complete project as soon as I can.
Hi, thank you for publishing your experiencies with ESP8266.
When you use AT+CIPMODE=0 and then AT+CIPSEND you say we can not exit from that data mode. However, in modem world there is an standard escape sequence to return to AT command mode with a +++ sequence. Check this short article for more info: http://modemsite.com/56k/escape.asp
Could you test it with your module?
I’ve worked with modems in the past, so I was aware of the “+++” signal. Sadly, it does not do anything in this case. I think the firmware has probably been written in a bit of a hurry. Perhaps as it is updated, things will improve.
that is a good idea. I am a member of the ESP8266.com github. i will see if we can ask/add +++ (I now remember it well from the hayes command set). They already added Baud rate changes to .922 version. I see this as a good one to auto-select baud rate.
I have tested the +++ escape sequence in ESP8266 and IT WORKS!!!
Here is the video I have recorded:
Very Nice Work. The +++ thing works very well with my setup. THANKS!!!