Esp8266 module using AT comands | ESP Wi-Fi | Forum

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

sp_Feed sp_TopicIcon
Esp8266 module using AT comands
No permission to create posts
June 14, 2015
2:36 pm
Avatar
R_Alberto

Silver
Members
Forum Posts: 7
Member Since:
June 14, 2015
sp_UserOfflineSmall Offline

I am trying to send value to a channel I have open but without any luck!

I Use the following command to connect:

AT +CIPSTART=4,"TCP","184.106.153.149"

Esp links

Then I send the following string:

"GET /update?key=apiwritekey&field=15"

Esp reports SEND OK
+IPD,4,1:0
OK
I close the link with AT+CIPCLOSE=4

Resulta: nothing appears in the ThingSpeak channel and esp will not link to the server any more. To link I need to reset the esp and do all the setup to join my router.
I suspect the the string I am sending has something wrong in it but what?
Any suggestion?
Thank you in advance
Cheers
Alberto

June 14, 2015
3:30 pm
Avatar
Michel_J

Silver
Members
Forum Posts: 13
Member Since:
February 8, 2015
sp_UserOfflineSmall Offline

Fields must be enumerated (field1, field2, field3...):

"GET /update?key=apiwritekey&field1=15"

This is how I do it:

GET /update?key=apiwritekey&field1=9.99&field2=123&headers=false HTTP/1.1{CrLf}Host: api.thingspeak.com{CrLf}Connection: close{CrLf}Accept: */*{CrLf}{CrLf}

Replace {CrLf} by CrLf ( 13, 10 )

The keyword "headers=false" will remove extra headers from response.
The keyword "Connection: close" will close the connection automatically.

HTH

June 14, 2015
4:37 pm
Avatar
R_Alberto

Silver
Members
Forum Posts: 7
Member Since:
June 14, 2015
sp_UserOfflineSmall Offline

Thank you HTH for the quick answer. The missing index number is a typo, in the code field is correctly written with the proper index (field1), so the problem is not there since your string is similar to mine (you just use more fields than me)

Question : I am sending data using TCP protocol, can I use your string example along with the HTTP/........ Part?

Cheers

Alberto

June 14, 2015
7:02 pm
Avatar
Michel_J

Silver
Members
Forum Posts: 13
Member Since:
February 8, 2015
sp_UserOfflineSmall Offline

I'm new to TCP communications so I can't explain the HTTP part but this is what I do just after calling AT+CIPSTART.

I do not specify an ID on AT+CIPSTART because is use AT+CIPMUX=0

Your command should look like this:

AT+CIPMUX=0 //call just one time at initialization

AT+CIPSTART="TCP","184.106.153.149", 80

AT+CIPSEND=xx //xx= length of string to send

GET /update?key=apiwritekey&field1=9.99&headers=false HTTP/1.1{CrLf}Host: api.thingspeak.com{CrLf}Connection: close{CrLf}Accept: */*{CrLf}{CrLf}

HTH = hope this helps

Michel

June 15, 2015
5:17 am
Avatar
R_Alberto

Silver
Members
Forum Posts: 7
Member Since:
June 14, 2015
sp_UserOfflineSmall Offline

Michel, thank you for explaining that HTH are not your initials but just an abbreviation (I am not very clever with abbreviations)
I have the esp8266 module connected to a microcontroller pic18F2620 clocked @ 32 MHz, so the long string must be coded byte per byte. I will try to send your string and report here the result.
Up to now I succeded in uploading one value, but if I want to upload a second value I need to reset the esp module. It seems that after the first connection, the esp module doesn't link anymore.
Let see if your string solve the problem!

My firmware is 0018000902, can you please let me know your firmware number?

Cheers

Alberto

June 15, 2015
7:32 am
Avatar
oddspin
New Member
Members
Forum Posts: 3
Member Since:
June 15, 2015
sp_UserOfflineSmall Offline
June 15, 2015
3:28 pm
Avatar
R_Alberto

Silver
Members
Forum Posts: 7
Member Since:
June 14, 2015
sp_UserOfflineSmall Offline

Thank you oddspin for the get string. I tried it but got an error (400 bad request)
.......?api key=...... Between "api" and "key" you have a space, can you please confirm it?

"YOUR_CHANNEL_API_KEY" is ment the 16 digits api key?

Cheers

Alberto

June 15, 2015
9:53 pm
Avatar
Michel_J

Silver
Members
Forum Posts: 13
Member Since:
February 8, 2015
sp_UserOfflineSmall Offline

R_Alberto said
My firmware is 0018000902, can you please let me know your firmware number?

My firmware is

AT version:0.22.0.0(Mar 20 2015 10:04:26)
SDK version:1.0.0
compile time:Mar 20 2015 11:00:32

I think you need to flash your ESP with the latest firware if you have one with 1024kB flash. If you have the one with only 512kB then the last firmware you can use is the one with AT_v0.22: http://bbs.espressif.com/viewtopic.php?f=5&t=286

The files you need are in the folders BIN and BIN\AT

Flash download tool: http://bbs.espressif.com/viewtopic.php?f=7&t=25

Files and addresses:
boot_v1.2+.bin @ 0x00000
user1.512.new.bin @ 0x01000
blank.bin @ 0x3e000
blank.bin @ 0x7e000

How to connect your ESP to flash it: http://www.xess.com/blog/esp8266-reflash/

Good luck!

June 16, 2015
7:26 am
Avatar
R_Alberto

Silver
Members
Forum Posts: 7
Member Since:
June 14, 2015
sp_UserOfflineSmall Offline

Thank you Michel for the links and the tips. I have downloaded and updated my module succesfully.
Reading the AT commands document (pdf) it seems that I cannot act as a client if the module is set as a server! (AT+CIPMUX=1)
This is a severe limitation (unless some workaround can be found)

So far I collect the data from ESP8266 using my Smart phone (Android) acting as a client and once the data in the phone, I route it to ThingSpeak.com using the same phone and it works. I had in mind to send the data directly but it is more important that ESP module act as server for the kind of automation I have in mind..

You can see the graph at this link: https://thingspeak.com/channels/42377

By the way, now the module firmware is:
AT version: 0.22.0.0
SDK version: 1.0.0

How do I know if my module flash is 1024 Kb or 512 Kb ?

Cheers
Alberto

June 16, 2015
3:45 pm
Avatar
tytower
New Member
Members
Forum Posts: 4
Member Since:
June 8, 2015
sp_UserOfflineSmall Offline

You are reading 12 bit ADC count. Can you tell me how this is done in your program?
In Arduino here are some of the useful functions
//Serial.println(ESP.getChipId());
//Serial.println(ESP.getFlashChipId());
//Serial.println(ESP.getFlashChipSpeed());
//Serial.println(ESP.getFlashChipSize());
I think in LUA you have similar
Also I think the esp8266 can act as server and client at the same time.

June 16, 2015
4:27 pm
Avatar
R_Alberto

Silver
Members
Forum Posts: 7
Member Since:
June 14, 2015
sp_UserOfflineSmall Offline

I am using the ADC on board of my pic18F2620. I have five 10 bits ADC available plus planty of digital I/O. I use the oversampling technique to obtain 12 bits out of a 10 bits ADC.

I don't know much about the "arduino" world since I have always used Microchip MCU.

"Also I think the esp8266 can act as server and client at the same time."

Yes I can confirm it. I did try with two esp modules connected to my Router (so that was a LAN connection) and it did work fine. When I try to connect with ThingSpeak.com I get an error "DNS Fail" while if I use the IP address I get just "Error" and it does not connect.
It is a little frustrating, and as I said in a previous post I am sending data to ThingSpeak via my Smart phone. This is a temporary solution, I will succed in sending data via esp8266 directly.
I will post the solution found!

Edited: Since this new firmware has a PING command, I have use it to Ping 184.106.153.149
Well it pings the IP for 5/6 times than it gives always timeout. To re-Ping I must reset the module and re-connect to the web. The pinging with Windows is always positive!
Things are becoming darker!

Cheers
Alberto

June 16, 2015
10:48 pm
Avatar
Michel_J

Silver
Members
Forum Posts: 13
Member Since:
February 8, 2015
sp_UserOfflineSmall Offline

FYI, just after calling AT+CIPSTART I call AT+CIPSTATUS to make sure I'm connected. I had a few connection problems with ThingSpeak. I do a couple of retry when CIPSTART fails.

About the flash only a few newer ones have 1024kB like this one: http://www.banggood.com/Upgraded-Version-1M-Flash-ESP8266-ESP-01-WIFI-Transceiver-Wireless-Module-p-979509.html

They are sold as "1M" or sometimes "4M". Just Google the flash's part number to get some infos.

Forum Timezone: America/New_York

Most Users Ever Online: 166

Currently Online:
18 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 272

Vinod: 240

piajola: 95

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 8665

Moderators: 1

Admins: 2

Forum Stats:

Groups: 3

Forums: 14

Topics: 1600

Posts: 5760

Newest Members:

Hema, askask, Rakwireless, budiardi basuki, oliver009, shelby1234

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457