WiFi Communication with ESP8266
Moderator: Benj
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: WiFi Communication with ESP8266
I tried the new UART file with my PIC18F26K80 and a 20Mhz crystal. It didn't work. I changed the baud rate to 38400 which with the new calculation would give a result of 32.05208
But maybe It has to be 115200 baud rate?
I'll try again tomorrow when I get my new 18.432Mhz crystals
But maybe It has to be 115200 baud rate?
I'll try again tomorrow when I get my new 18.432Mhz crystals
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: WiFi Communication with ESP8266
I used the wi07c modules from ElectroDragon but there are a few variants out there.
The current firmware has a fixed baud of 115200 bps but the older firmware required a fixed baud of 57600.
As far as I know no other rates will currently work.
The firmware is obviously in a state of change at the moment to sort out bugs and add functionality. Hopefully it won't break the component as it evolves but lets see.
The 20MHz crystal should have worked so this is strange, maybe it's just out of tolerance. I can certainly try this on my rig for you tomorrow. Do you have anything which you can use to check the baud rate the device is outputting? Maybe the K80 devices have a different calculation required?
The current firmware has a fixed baud of 115200 bps but the older firmware required a fixed baud of 57600.
As far as I know no other rates will currently work.
The firmware is obviously in a state of change at the moment to sort out bugs and add functionality. Hopefully it won't break the component as it evolves but lets see.
The 20MHz crystal should have worked so this is strange, maybe it's just out of tolerance. I can certainly try this on my rig for you tomorrow. Do you have anything which you can use to check the baud rate the device is outputting? Maybe the K80 devices have a different calculation required?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: WiFi Communication with ESP8266
I see. I'll check with my scope tomorrow. I have the same ones from electro dragon so I guess I will have to use 115200.
This is all rather new to me, the baud calculations. Haven't had to mess with it before so I have no idea if the K80 devices have different calculation requirements
This is all rather new to me, the baud calculations. Haven't had to mess with it before so I have no idea if the K80 devices have different calculation requirements
Re: WiFi Communication with ESP8266
Hi BenjBenj wrote:The firmware is obviously in a state of change at the moment to sort out bugs and add functionality. Hopefully it won't break the component as it evolves but lets see.
the new Firmware 0018000902 with Cloud update Function have a little change ;-/
The old Firmware fire with \r
The new Firmware fire with \r\n
so old commands like
AT+GMR\r
do not fire right
AT+GMR\r\n
do fire
why allways guy's change runing systems
rudi
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: WiFi Communication with ESP8266
Cheers for the heads up I can add this as a property.The old Firmware fire with \r
The new Firmware fire with \r\n
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: WiFi Communication with ESP8266
Ok I got it up and running now
But just a quick question/request. How can I make it send a request like this:
http://www.domain.com/in.php?temperature01=10
Do I first have to connect to www.domain.com on port 80?
any example would be great, maybe an example of using POST instead of GET as well.
Thanks
But just a quick question/request. How can I make it send a request like this:
http://www.domain.com/in.php?temperature01=10
Do I first have to connect to www.domain.com on port 80?
any example would be great, maybe an example of using POST instead of GET as well.
Thanks
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: WiFi Communication with ESP8266
I thought I would just add that: yes it is connected to my home wifi and is able to access the internet. I just don't know how to get it to send data to my mySQL server.
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: WiFi Communication with ESP8266
Also, is there a function to read signal strength from the module? If so that would be nice to have a macro for
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: WiFi Communication with ESP8266
All I have found on signal strength is this:
AT + CWLAP
Response
Successful return AP list
+ CWLAP: <ecn>, <ssid>, <rssi> [, <mode>]
OK Or Fails, the return ERROR
Description
Response parameters:
<Ecn> 0 OPEN
1 WEP
2 WPA_PSK
3 WPA2_PSK
4 WPA_WPA2_PSK
<Ssid> string parameter, the access point name
<Rssi> signal strength
<Mode> 0 manually connect
1 automatic connection
But maybe there is a way to sort out the Rssi response for the AP it is connected to and reply only that value? It surely must be a way to get this information without too much work so that it can be printed on a display as a bar graph or similar just as any and all mobile phones etc
AT + CWLAP
Response
Successful return AP list
+ CWLAP: <ecn>, <ssid>, <rssi> [, <mode>]
OK Or Fails, the return ERROR
Description
Response parameters:
<Ecn> 0 OPEN
1 WEP
2 WPA_PSK
3 WPA2_PSK
4 WPA_WPA2_PSK
<Ssid> string parameter, the access point name
<Rssi> signal strength
<Mode> 0 manually connect
1 automatic connection
But maybe there is a way to sort out the Rssi response for the AP it is connected to and reply only that value? It surely must be a way to get this information without too much work so that it can be printed on a display as a bar graph or similar just as any and all mobile phones etc
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: WiFi Communication with ESP8266
Hello,
Note the ClientConnect component macro and the ClientSendRequest component macro, this could easily be changed to a Post rather than a Get.
I could potentially add a function to make this easier but for now I would like to maybe wait for the firmware to become a bit more stable before doing any more work. I also don't want to add too much bloat for the component. e.g. buffers to hold the current SSID and then comparisons inside the component to collect the right signal strength.
Great, glad it's working for you now. Do you remember what you did to get it working just in case someone else runs into a similar issue.Ok I got it up and running now
If you refer to the TCPclient example I posted then this shows me collecting a text file from the matrix server. It should be possible to change the program to instead look at your domain and add in the temperature parameter.But just a quick question/request. How can I make it send a request like this:
http://www.domain.com/in.php?temperature01=10
Note the ClientConnect component macro and the ClientSendRequest component macro, this could easily be changed to a Post rather than a Get.
The WifiScan example shows the AT+CWLAP function in action. You would have to replicate the code to do the scan, then cycle through the returned SSID strings comparing with your current SSID connection until you come across a match. Then simply collect the signal strength. You will need a fairly large scan buffer to allow this to work reliably when there are lots of access points nearby.Also, is there a function to read signal strength from the module? If so that would be nice to have a macro for
I could potentially add a function to make this easier but for now I would like to maybe wait for the firmware to become a bit more stable before doing any more work. I also don't want to add too much bloat for the component. e.g. buffers to hold the current SSID and then comparisons inside the component to collect the right signal strength.
This property and functionality has now been added to the component.The old Firmware fire with \r
The new Firmware fire with \r\n
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: WiFi Communication with ESP8266
I did try to do it as you did in you TCPclient example but had no luck. Putting that URL in a browser on my computer it works fine and the value 10 is added to the database. Tried using the DNS name and also tried the IP. I'm able to do it using AT commands and the SIM900 GPRS module. not sure about the /r/n and HTTP 1.0 stuff, if it is even needed for sending the data: "http://www.domain.com/in.php?temperature01=10"
Tried so many different ways. I'll have a look at the component source you provided and see if I can figure it out.
Tried so many different ways. I'll have a look at the component source you provided and see if I can figure it out.
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: WiFi Communication with ESP8266
Hello,
What URL are you trying to reach.
I used my own personal domain and it didn't work as my domain uses a virtual server and shares an IP address with a lot of other domains.
The MatrixTSL website is a fixed IP and dedicated server machine which is why this is working well. Even so we had TSL vs Multimedia issues to contend with.
Google and some other websites seem to have completely blocked IP based requests and attempting to connect to the Google server as a client caused my module to lock up.
I believe that the latest module firmware has working DNS so you pass the URL rather than the IP address and this should then be much more likely to work on domains sharing IP addresses. However I have not messed with the firmware in my modules so haven't tested this in practise. Again I think it might be a case of waiting for the waters to settle before wading in.
I think the best thing for now might be to use two modules, one as a server and one as a client and this way you can get everything up and running. Might not be ideal but its a starting point and a sanity check to ensure the code is right.
What URL are you trying to reach.
I used my own personal domain and it didn't work as my domain uses a virtual server and shares an IP address with a lot of other domains.
The MatrixTSL website is a fixed IP and dedicated server machine which is why this is working well. Even so we had TSL vs Multimedia issues to contend with.
Google and some other websites seem to have completely blocked IP based requests and attempting to connect to the Google server as a client caused my module to lock up.
I believe that the latest module firmware has working DNS so you pass the URL rather than the IP address and this should then be much more likely to work on domains sharing IP addresses. However I have not messed with the firmware in my modules so haven't tested this in practise. Again I think it might be a case of waiting for the waters to settle before wading in.
I think the best thing for now might be to use two modules, one as a server and one as a client and this way you can get everything up and running. Might not be ideal but its a starting point and a sanity check to ensure the code is right.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: WiFi Communication with ESP8266
Yeah you are probably correct. didn't think of that.
I will have to try to update the firmware then because my website is hosted and don't have a static IP which I thought it did. oh well.
I will have to try to update the firmware then because my website is hosted and don't have a static IP which I thought it did. oh well.
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: WiFi Communication with ESP8266
Oh and yes I remember what I did to get it working
After I had tried a million things without success I had changed the RX/TX lines around to see if I got it wrong. I then gave up, forgetting to change back So I had to get out of bed last night when I realized my mistake and bingo was his name-o
After I had tried a million things without success I had changed the RX/TX lines around to see if I got it wrong. I then gave up, forgetting to change back So I had to get out of bed last night when I realized my mistake and bingo was his name-o
Re: WiFi Communication with ESP8266
Hi Benj, hi guys
ED has now ESP-04
http://blog.electrodragon.com/cloud-upd ... p8266-now/
but be noted: China has Holiday 01. - 04. Oktober
@benj
you will add some GPIO*s more now too
...and Baudrate select
(FC6 ok? )
AT+FC6SETBAUD=9600
AT+FC6SETBAUD=19200
..
AT+FC6SETBAUD=921600
Code: Select all
9600, 19200,31250(MIDI will come asap),38400,57600,74.880, 115.200, 230400, 460800, 921600
best wishes!
rudi
btw
gcc is now ready to go.
http://www.mikrocontroller.net/topic/34 ... 15#3824515
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: WiFi Communication with ESP8266
So I updated the firmware on one of the modules and using RealTerm I managed to connect to my domain without the IP address:
+CIPSTART="TCP","www.level6.se",80
OK
Linked
OK
I might be wrong here but looking at the component macro, isn't it sending the port like "80" and not just 80 without " "?
Anyway, I can't get it to work in FC. I have tried everything I can think of.
+CIPSTART="TCP","www.level6.se",80
OK
Linked
OK
I might be wrong here but looking at the component macro, isn't it sending the port like "80" and not just 80 without " "?
Anyway, I can't get it to work in FC. I have tried everything I can think of.
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: WiFi Communication with ESP8266
Just want to point out that the firmware update was quite easy, except the last step which is the cloud update. It looks fine,
AT+CIUPDATE
CIUPDATE:1
CIUPDATE:2
CIUPDATE:3
CIUPDATE:4
then it takes a long time (30 seconds maybe)
Then:
ERROR
So I am running 00170901
AT+CIUPDATE
CIUPDATE:1
CIUPDATE:2
CIUPDATE:3
CIUPDATE:4
then it takes a long time (30 seconds maybe)
Then:
ERROR
So I am running 00170901
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: WiFi Communication with ESP8266
Hello,
+CIPSTART="TCP","www.level6.se",80
Is the module responding to any commands from the micro? E.g. if you use the FirmwareTest example then does it show the firmware version on the LCD?
Can you upgrade the firmware simply by connecting the module to an access point and then calling the AT+CIUPDATE command? If so that's brilliant! Not looked into this side of things at all really.
Hmm, looking at the code the ClientConnect macro should be sending the port without the " quotes so I'm surprised this isn't working for you.I might be wrong here but looking at the component macro, isn't it sending the port like "80" and not just 80 without " "?
+CIPSTART="TCP","www.level6.se",80
Is the module responding to any commands from the micro? E.g. if you use the FirmwareTest example then does it show the firmware version on the LCD?
Can you upgrade the firmware simply by connecting the module to an access point and then calling the AT+CIUPDATE command? If so that's brilliant! Not looked into this side of things at all really.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: WiFi Communication with ESP8266
The module responds when hooked up to the PIC, reports IP etc as expected. The firmware update had to be done with it hooked up to a computer to get it to this first firmware that I now run. It should support cloud update which I didn't get to work but basically yes you should be able to do AT+CIUPDATE once it is connected to the internet via an AP. I have no idea why it didn't work. Maybe it just timed out because a lot of people are trying to update at once but it just reports ERROR so how would one know...
The link Rudi provided yesterday outlines the procedure: http://blog.electrodragon.com/cloud-upd ... p8266-now/
My remark about the port number being in quotation marks in the component macro was just what it looked like to me. I am able to get it "linked" using AT+CIPSTART.... but I cannot get the AT+CIPSEND command to do what I want it to do. Not even from RealTerm. I thought it would be easier to use RealTerm first to get it to work there and then try the same in FC.
I had no luck at all with the GET/POST stuff on the SIM900 GSM module (well, GET worked sometimes but not reliably) But I was able to use AT+HTTPPARA and instead of GET or POST I used a type called URL and it worked. now this ESP8266 seem to have a very limited functionality.
Oh and since there is a command for checking what AP the module is connected to, and the AP scan works while connected to an AP, could it be possible for you to create/modify a macro so that it only reports the dB of the AP it is connected to? If it is one of the ten AP's that are returned when doing a AP scan of course.
The link Rudi provided yesterday outlines the procedure: http://blog.electrodragon.com/cloud-upd ... p8266-now/
My remark about the port number being in quotation marks in the component macro was just what it looked like to me. I am able to get it "linked" using AT+CIPSTART.... but I cannot get the AT+CIPSEND command to do what I want it to do. Not even from RealTerm. I thought it would be easier to use RealTerm first to get it to work there and then try the same in FC.
I had no luck at all with the GET/POST stuff on the SIM900 GSM module (well, GET worked sometimes but not reliably) But I was able to use AT+HTTPPARA and instead of GET or POST I used a type called URL and it worked. now this ESP8266 seem to have a very limited functionality.
Oh and since there is a command for checking what AP the module is connected to, and the AP scan works while connected to an AP, could it be possible for you to create/modify a macro so that it only reports the dB of the AP it is connected to? If it is one of the ten AP's that are returned when doing a AP scan of course.
Re: WiFi Communication with ESP8266
Hi guys,
yes - the cloud is sometimes offline - i suggest you test it if you can by terminal and usb ttl, the procedure must go on
AT+CIUPDATE
CIUPDATE:1 found server
CIUPDATE:2 connect server
CIUPDATE:3 got edition
CIUPDATE:4 start update
hope this helps
best wishes
rudi
yes - the cloud is sometimes offline - i suggest you test it if you can by terminal and usb ttl, the procedure must go on
AT+CIUPDATE
CIUPDATE:1 found server
CIUPDATE:2 connect server
CIUPDATE:3 got edition
CIUPDATE:4 start update
hope this helps
best wishes
rudi
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: WiFi Communication with ESP8266
That is what I said I have been doing. I guess I have to try several times. It would help if they informed us about what the server address is so we could check if it's online before attempting to do the update.
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: WiFi Communication with ESP8266
But then again, why do I get an error if I do see this:
AT+CIUPDATE
CIUPDATE:1
CIUPDATE:2
CIUPDATE:3
CIUPDATE:4
ERROR
???
AT+CIUPDATE
CIUPDATE:1
CIUPDATE:2
CIUPDATE:3
CIUPDATE:4
ERROR
???
Re: WiFi Communication with ESP8266
Hi guys
dynamic baudrate, have a try
FW v0.9.2.2
http://www.electrodragon.com/w/File:V0. ... re.bin.zip
runs at 9600 as default,
can change ( Init_baudrate.. ) by AT Command
http://www.electrodragon.com/w/Wi07c#V0.922
until 921.6kb
Support watchdog,
auto restart when program have errors occurred,
AT command:
turn on watchdog AT+CSYSWDTENABLE;
turn off watchgod: AT+CSYSWDTDISABLE
best wishes
rudi
dynamic baudrate, have a try
FW v0.9.2.2
http://www.electrodragon.com/w/File:V0. ... re.bin.zip
runs at 9600 as default,
can change ( Init_baudrate.. ) by AT Command
http://www.electrodragon.com/w/Wi07c#V0.922
until 921.6kb
Code: Select all
inquiry range: AT+CIOBAUD=?
check current baudrate AT+CIOBAUD?
set: :AT+CIOBAUD=9600, supported 9600, 19200, 38400, 57600, 74880, 115200, 230400,460800, 921600
auto restart when program have errors occurred,
AT command:
turn on watchdog AT+CSYSWDTENABLE;
turn off watchgod: AT+CSYSWDTDISABLE
best wishes
rudi
-
- Posts: 528
- Joined: Sat Dec 01, 2012 1:23 pm
- Location: Sweden
- Has thanked: 49 times
- Been thanked: 101 times
- Contact:
Re: WiFi Communication with ESP8266
I did update to 0018000902 firmware and I still can't get it to work with sending any data to my mySQL database.
I tried the GET /demo/test.txt using realterm and I at least got a response!
+IPD,166:<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx</center>
</body>
</html>
But nothing using my parameters.
I tried the GET /demo/test.txt using realterm and I at least got a response!
+IPD,166:<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx</center>
</body>
</html>
But nothing using my parameters.
Re: WiFi Communication with ESP8266
Hihyperion007 wrote:I did update to 0018000902 firmware and I still can't get it to work with sending any data to my mySQL database.
I tried the GET /demo/test.txt using realterm and I at least got a response!
+IPD,166:<html>
<head><title>400 Bad Request</title></head>
<body bgcolor="white">
<center><h1>400 Bad Request</h1></center>
<hr><center>nginx</center>
</body>
</html>
But nothing using my parameters.
but you have a response from your webserver, right?
so - a little change was done, reminder you, the fire was first \r now is \r\n
do you check this too?
Ok - have a try - test yours not to your Webserver -
take a Server Program and listen in this same Webport like 80.
This with a simple tcp server programm run at this at the connected web port and you will see what ESP8266 send as SQL querry.
Check this Querry - and you will see what is change or wrong.
hope this helps.
Cheers
Rudi