WiFi Communication with ESP8266

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Contact:

Re: WiFi Communication with ESP8266

Post by hyperion007 »

Ben, could I trouble you for a change to the component again? :roll:
Add 3 more input variables with configurable buffer length.

User avatar
Benj
Matrix Staff
Posts: 15009
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: WiFi Communication with ESP8266

Post by Benj »

Hello,

This should now have the additional 3 incoming buffers.
WLAN_ESP8266.fcpx
(22.81 KiB) Downloaded 389 times

ajneal4uk
Posts: 22
Joined: Sun Mar 03, 2013 10:30 pm
Contact:

Re: WiFi Communication with ESP8266

Post by ajneal4uk »

Hi;

So I purchased a ESP8266 and thought id give it a try.

I'm testing with one of the programs in this tread but I am unable to compile to chip without errors.
I searched other threads and found someone else with the same problem. I tried the component our valued contributor kersing posted and was able to compile without issue.
I'm using flowcode for dspic.

The prototype "void FCD_08181_WLAN_ESP8266__ServerSendHTML(const MX_CHAR *FCL_DATA, MX_UINT16 FCLsz_DATA);" is defined 4 times.

If anyone can help I would be most grateful.

Andy

---------------------------------------------------------------------------------------------------------------------------------------
void FCD_08181_WLAN_ESP8266__ServerSendHTML(const MX_CHAR *FCL_DATA, MX_UINT16 FCLsz_DATA);

void FCD_08181_WLAN_ESP8266__Send_Embedded_HTML_Page1() {
FCD_08181_WLAN_ESP8266__ServerSendHTML("<html>\r\n", 10);
FCD_08181_WLAN_ESP8266__ServerSendHTML("Main Index Page\r\n", 19);
FCD_08181_WLAN_ESP8266__ServerSendHTML("</html>", 8);
}

void FCD_08181_WLAN_ESP8266__ServerSendHTML(const MX_CHAR *FCL_DATA, MX_UINT16 FCLsz_DATA);

void FCD_08181_WLAN_ESP8266__Send_Embedded_HTML_Page2() {
FCD_08181_WLAN_ESP8266__ServerSendHTML("<html>\r\n", 10);
FCD_08181_WLAN_ESP8266__ServerSendHTML("Page 2\r\n", 10);
FCD_08181_WLAN_ESP8266__ServerSendHTML("</html>", 8);
}

void FCD_08181_WLAN_ESP8266__ServerSendHTML(const MX_CHAR *FCL_DATA, MX_UINT16 FCLsz_DATA);

void FCD_08181_WLAN_ESP8266__Send_Embedded_HTML_Page3() {
FCD_08181_WLAN_ESP8266__ServerSendHTML("<html>\r\n", 10);
FCD_08181_WLAN_ESP8266__ServerSendHTML("Page 3\r\n", 10);
FCD_08181_WLAN_ESP8266__ServerSendHTML("</html>", 8);
}

void FCD_08181_WLAN_ESP8266__ServerSendHTML(const MX_CHAR *FCL_DATA, MX_UINT16 FCLsz_DATA);

void FCD_08181_WLAN_ESP8266__Send_Embedded_HTML_Page4() {
FCD_08181_WLAN_ESP8266__ServerSendHTML("<html>\r\n", 10);
FCD_08181_WLAN_ESP8266__ServerSendHTML("Page 4\r\n", 10);
FCD_08181_WLAN_ESP8266__ServerSendHTML("</html>", 8);
}

cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Contact:

Re: WiFi Communication with ESP8266

Post by cobra1 »

This little module looks quite interesting. I was wondering if i might be able to get a pointer.
I would like to use the modules as slave devices connected to a router which is connected to the internet. The router will be setup for port forwarding allowing me to communicate with the slave devices connected to the router from a remote location.
The part i need a little guidance with it actually communicating with the slaves. Do i have to have a webserver running on each slave or can i simply send a string of data and receive string data back? This would be my preffered method of communication.
If it possible could anyone give and information on how to proceed.
Thanks :)

bicli
Posts: 2
Joined: Tue Jan 20, 2015 9:46 am
Contact:

Re: WiFi Communication with ESP8266

Post by bicli »

cobra1 wrote:This little module looks quite interesting. I was wondering if i might be able to get a pointer.
I would like to use the modules as slave devices connected to a router which is connected to the internet. The router will be setup for port forwarding allowing me to communicate with the slave devices connected to the router from a remote location.
The part i need a little guidance with it actually communicating with the slaves. Do i have to have a webserver running on each slave or can i simply send a string of data and receive string data back? This would be my preffered method of communication.
If it possible could anyone give and information on how to proceed.
Thanks :)
Why not use MQTT?

bicli
Posts: 2
Joined: Tue Jan 20, 2015 9:46 am
Contact:

Re: WiFi Communication with ESP8266

Post by bicli »

Hello guys, I am using this sucker as an MQTT client that sends sensor information to the broker and in order to save power consumption, I tried using system_deep_sleep call but then realized that XPD_DCDC pin needs to be connected to EXT_RSTB. My problem is, I have ESP-01. Is there any possibility to make it happen?
Any help would be great.

Thanks,
Bekir

ajneal4uk
Posts: 22
Joined: Sun Mar 03, 2013 10:30 pm
Contact:

Re: WiFi Communication with ESP8266

Post by ajneal4uk »

Hi all;

I as wondering if anyone else was having issues when compiling the flowcode to chip?

Andy

User avatar
Benj
Matrix Staff
Posts: 15009
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: WiFi Communication with ESP8266

Post by Benj »

Hello Andy,

Please can you post the program that is generating compilation errors.

ajneal4uk
Posts: 22
Joined: Sun Mar 03, 2013 10:30 pm
Contact:

Re: WiFi Communication with ESP8266

Post by ajneal4uk »

Hi Ben;

All I've done is setup a new project dropped the component on the work area and initialised the it.

I've also looked at the source code that you provided but when I export as a component the result is the same.

"void FCD_08181_WLAN_ESP8266__ServerSendHTML(const MX_CHAR *FCL_DATA, MX_UINT16 FCLsz_DATA);" is duplicated and the compiler rejects the code.

Andy
Attachments
Flowcode1.fcfx
(5.5 KiB) Downloaded 305 times

User avatar
LeighM
Matrix Staff
Posts: 2106
Joined: Tue Jan 17, 2012 10:07 am
Contact:

Re: WiFi Communication with ESP8266

Post by LeighM »

Hi Andy,

The attached component should fix the function prototype error.

Regards,
Leigh
Attachments
WLAN_ESP8266.fcpx
(22.83 KiB) Downloaded 278 times

gulik154
Posts: 1
Joined: Wed May 12, 2010 12:04 am
Contact:

Re: WiFi Communication with ESP8266

Post by gulik154 »

Benj wrote:Hello

Yes this is coming soon. I've got a module working and replying correctly and made progress on the Flowcode component this afternoon. So far everything is working well and I hope to finish the component tomorrow.
hi Benj I still make use of Flowcode V4 for PICmicros
question can also use the code
greeting JM

cruzxia
Posts: 88
Joined: Wed Jan 04, 2006 7:34 am
Contact:

Re: WiFi Communication with ESP8266

Post by cruzxia »

I have been setting up an ESP8266.
I have the serial connected and working.
The problem I am having is the GETINVALUE macro failes to provide me the incoming string data.
if I use GETBYTEWITHTIMEOUT and print as Ascii I can see the data on the LDC screen

Using the GETVALUE micro, I am saving it as a string, and then printing the string on the LCD.
I have tried all index 0-2, but there is still no data. (The LCD stays blank)

This is the data I receive on my PIC when I send to the module from my laptop.
{
+IPD,1,289:GET /?but=2 HTTP/1.1
Host: 192.168.4.1
Connection: keep-alive
Accept: */*
Origin: null
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
}

Any help will be appreciated

cruzxia

User avatar
Benj
Matrix Staff
Posts: 15009
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: WiFi Communication with ESP8266

Post by Benj »

Hello,

I think you need to change this line.

Code: Select all

+IPD,1,289:GET /?but=2 HTTP/1.1
to this.

Code: Select all

+IPD,1,289:GET /?0=2 HTTP/1.1
then use index value 0 to collect the value.
I still make use of Flowcode V4 for PICmicros
question can also use the code
You can probably use the RS232 component in Flowcode v4 to talk with the module. If you want the component then upgrading to v6 would give you this functionality.

cruzxia
Posts: 88
Joined: Wed Jan 04, 2006 7:34 am
Contact:

Re: WiFi Communication with ESP8266

Post by cruzxia »

Hi Ben

Thanks for the info on the indexing, it worked once I changed the value.
It does seem a bit erratic when it checks the data. I can see the data coming in (when the led on the ESP8266 goes blue), It sum times displays immediately, and other times it takes a while before it will display or just does not display at all.

In the check for page requests, I am checking the return value for a non zero. If it is non zero I Get the in value, to receive the data.
If I don't test for the non zero value then it just keeps returning the same value, so it is reading the buffer again.
Do I need to clear the buffer manually after each read?

Is the buffer big enough to store all the incoming string data?

This is the incoming data from the ESP8266 (I sent the data "hello")
{

+IPD,2,290:GET /?0=hello HTTP/1.1
Host: 192.168.4.1
Connection: keep-alive
Accept: */*
Origin: null
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.101 Safari/537.36
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
}

Regards
cruzxia

User avatar
Benj
Matrix Staff
Posts: 15009
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: WiFi Communication with ESP8266

Post by Benj »

Hello,

The "In" buffers are cleared when a valid page request is received.

This could be moved so that it happens by default when you call the check for requests function. I've done this mod and the new component is below.
WLAN_ESP8266.fcpx
(22.83 KiB) Downloaded 286 times
The size of each buffer is assigned in the ESP8266 component properties, the default is 20 bytes.

ahmedkhalid
Posts: 28
Joined: Mon May 26, 2014 8:51 pm
Contact:

Re: WiFi Communication with ESP8266

Post by ahmedkhalid »

Hello everyone,

CIPSTART="TCP","www.matrixtsl.com",80

gives :

OK
Linked

now how to send a GET request to this site as mentioned by benj

I am using RealTerm..

Firmware version is:
00170901

User avatar
Benj
Matrix Staff
Posts: 15009
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: WiFi Communication with ESP8266

Post by Benj »

Hello All,

I know this topic has gone quiet but I have been working with this component again today for a new development and found a bug which had the potential to brake TCP servers so thought I would share the fix.
WLAN_ESP8266.fcpx
(23.01 KiB) Downloaded 208 times
Simply place the file into your "Flowcode 6/Components" folder.

I have also been through and tested out core examples and put them on the Wiki. They are now all working well for me so it made sense to have them available.

http://www.matrixtsl.com/wiki/index.php ... 6ada46f7bf

I used an EB091 for the examples but an EB006 or Arduino etc. should work just as well.

Any problems let me know.

User avatar
Benj
Matrix Staff
Posts: 15009
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Contact:

Re: WiFi Communication with ESP8266

Post by Benj »

Found and fixed another bug linked with the Outbound string substitutions. The out variable length was being truncated to 20 bytes due to a fixed length intermediate variable. This variable has now been removed and we use the value directly to save a bit of RAM usage. Note that outbound strings lengths will still be limited to a 8-bit value 0-255 as the Length$() function currently returns an 8-bit value. I'm tempted to make this into a 16-bit value but I will investigate what the knock on effect would be.
WLAN_ESP8266.fcpx
(22.96 KiB) Downloaded 228 times

roussetp
Posts: 2
Joined: Wed Jun 08, 2016 8:10 pm
Contact:

Re: WiFi Communication with ESP8266

Post by roussetp »

Hello,
I try to create a Web server with the ESP8266 component. I loaded your component
WLAN_ESP8266.fcpx and created FLOWCODE attached file . WIFI access point works and I can
Connect to. But when I run a web browser with WIFI address, he replied unauthorized access !
I do not know what to do after many hours of testing. Can you help me please?

Thank you in advance.
cordially
Attachments
Essais WIFI V6.fcfx
test file
(24.61 KiB) Downloaded 262 times

roussetp
Posts: 2
Joined: Wed Jun 08, 2016 8:10 pm
Contact:

Re: WiFi Communication with ESP8266

Post by roussetp »

I found the solution to my problem. I had not entered the correct IP address.

electron67
Posts: 302
Joined: Sat Jan 12, 2008 2:08 am
Contact:

Re: WiFi Communication with ESP8266

Post by electron67 »

Hello,

some days ago download WLAN_ESP8622 examples of help component and also install the component in flowcode6, I'm testing

the flowchart of the examples but when I go to copilar ends in failure -2.

There is a component failure or no longer works in flowcode6? Also note that the examples are not published in the Help page

of the component.

Thanks
Enrique

electron67
Posts: 302
Joined: Sat Jan 12, 2008 2:08 am
Contact:

Re: WiFi Communication with ESP8266

Post by electron67 »

change the PIC16F887 by the 18F4620 and if he could compile

Enrique

Post Reply