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
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: WiFi Communication with ESP8266

Post by hyperion007 »

Ok so I did, it looks fine to me but it will not work "for real"...
Realterm01.jpg
(209.45 KiB) Downloaded 6909 times
TCP connection.jpg
TCP connection.jpg (50.9 KiB) Viewed 19833 times

hyperion007
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

Post by hyperion007 »

Got it working.

Updating my database with the temperature from a DS18B20 one wire temperature sensor over WiFi-router-internet-server :)

http://level6.se/wifi_temperature.html

Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 493 times
Been thanked: 187 times

Re: WiFi Communication with ESP8266

Post by Rudi »

Hi
what you have change? the double \r\n \r\n in one time \r\n ?
best wishes
rudi
looks nice your webside

hyperion007
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

Post by hyperion007 »

I changed to this:

Data_String = "GET in.php?variable1="
Data_String = Data_String + DS18B20_String
Data_String = Data_String + " HTTP/1.1\r\nHost: www.level6.se\r\n\r\n"

Then send Data_String

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: WiFi Communication with ESP8266

Post by kersing »

hyperion007 wrote:I changed to this:

Data_String = "GET in.php?variable1="
Data_String = Data_String + DS18B20_String
Data_String = Data_String + " HTTP/1.1\r\nHost: http://www.level6.se\r\n\r\n"

Then send Data_String
Obvious now you've found it. Your web page is running on a shared host. By adding the protocol version ('HTTP/1.1') and the 'Host:...' you are telling the server which of the websites you are trying to reach, without the additional information it does not know which site to choose.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

hyperion007
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

Post by hyperion007 »

Well since I first make a TCP connection to the same host on port 80, and then send the data "in.php?variable....." I thought that would be enough. But now I know :)

ahmedkhalid
Posts: 28
Joined: Mon May 26, 2014 8:51 pm
Has thanked: 4 times
Contact:

Re: WiFi Communication with ESP8266

Post by ahmedkhalid »

Hello Everyone!!

After reading all the conversation I am a bit confuse now regarding the pin connections of ESP8266 module. Kindly tell me the correct pin connection whether to connect RST to ground or to connect it with VCC? What to do with CH-PD pin? Please briefly tell the connection which work in physical hardware.

ahmedkhalid
Posts: 28
Joined: Mon May 26, 2014 8:51 pm
Has thanked: 4 times
Contact:

Re: WiFi Communication with ESP8266

Post by ahmedkhalid »

Plus one thing more!

I have to send a text file to my laptop using ESP8266. The file will be in SD card. I know how to handle files in SD card but don't know how to transmit it using ESP8266?

hyperion007
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

Post by hyperion007 »

Benj wrote:
I have made to following connections to the module.

GND -> GND
VCC -> 3V3 with at least 300mA spare current
TXD -> RX on Microcontroller
RXD -> TX on Microcontroller
RST -> VCC
CH_PD -> VCC
This is from the first page of this thread (which is only three pages long) so why the confusion?

There is no component macro for sending a file. If you read data from a file into a variable you can then send it to your computer and have the computer append the data to a file of your choosing.

ahmedkhalid
Posts: 28
Joined: Mon May 26, 2014 8:51 pm
Has thanked: 4 times
Contact:

Re: WiFi Communication with ESP8266

Post by ahmedkhalid »

Rudi wrote;
choices:
--------
RST
if you want to Reset by Mikrocontroller, you can connect it to a pin and switch ~20ms to gnd

GPIO0
if you want to Firmware update over Mikrocontroller then you must connect to a pin and make this procedure

RST + GPIO0 goes GND ( LOW ) ~20ms
this will reset the ESP8266
then free RST
wait ~20ms
then free GPIO0
then the ESP8266 is in Firmware upload Mode
Rudi gave me a choice, and none of the choices is to connect RST to VCC...
Last edited by ahmedkhalid on Sat Oct 11, 2014 4:05 pm, edited 1 time in total.

hyperion007
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

Post by hyperion007 »

Start with what Ben wrote and then when you get it to work and want to change it then you'll know what to do.

ahmedkhalid
Posts: 28
Joined: Mon May 26, 2014 8:51 pm
Has thanked: 4 times
Contact:

Re: WiFi Communication with ESP8266

Post by ahmedkhalid »

If you read data from a file into a variable you can then send it to your computer and have the computer append the data to a file of your choosing.
How to do this?

Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 493 times
Been thanked: 187 times

Re: WiFi Communication with ESP8266

Post by Rudi »

ahmedkhalid wrote:
If you read data from a file into a variable you can then send it to your computer and have the computer append the data to a file of your choosing.
How to do this?
Hi
example your text is in the textfile "my.txt" and the content is "Hello World"
so the File content you must insert in a variable or circular buffer.
By doing this with SD Card you can connect to your mikrokontroller a sd card reader and use the icon SD Card in flowcode.
you can then read with the icon your wanted sending data.
For using SD Icon you wrote "I know how to handle files in SD ".
so simple read in your transmitting data and send it with the ESP8266 icon right function

i am honest, i have not tested the esp8266 icon by my self just in time, i will this do sunday/monday i work just in time at othe place,
please have a look to the function in it, and make the right choice ;-)
for understand

the ESP8266 simply send by
pseudo single mux ( AT+CIPMUX=0 )
AT+CIPSEND=Length(yourVariable)
> yourVariable
ok

pseudo moreline ( AT+CIPMUX=1 )
AT+CIPSEND=[YOURLINENR], [Length(yourVariable)]
> yourVariable
ok

if your Data verry long you can make parts
example all 256 bytes will fine or 512
you can try first time small data packets.

hope this helps for first time and making next steps
best wishes!
rudi ;-)

waleedabbasi12
Posts: 9
Joined: Mon Sep 08, 2014 6:06 pm
Has thanked: 4 times
Contact:

Re: WiFi Communication with ESP8266

Post by waleedabbasi12 »

@Benj can u upload an example in which we can send a string to a webpage? Unlike TCP Client example in which the data was being read.

Thanks!

hyperion007
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

Post by hyperion007 »

Rudi, did you get any ESP-03 with on board ceramic antenna?

How do you wire them up? There is no reset pin from what I have read
esp03-boardtop.jpg
esp03-boardtop.jpg (77.82 KiB) Viewed 19735 times
I got 5 in the mail the other day and want to try them out.

Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 493 times
Been thanked: 187 times

Re: WiFi Communication with ESP8266

Post by Rudi »

Hi
sorry for delay..
ESP-04 without ceramic, GPIO15 must connect to GND
I will try asap connect ESP-03 ,
I have here too
ESP-01
ESP-03
ESP-04
ESP-05
ESP-06
ESP-07
ESP-08
ESP-09

i play just in time with ESP-04 and the GPIO4, GPIO5 and ADC ( TOUT PIN6 ).

ESP-04
--------
VCC
GND
CH_PD -> VCC like the ESP-01
GPIO15 -> GND
URxD
UTxD

best wishes
rudi;-)

http://www.esp8266.club/technic/reference.txt

http://www.esp8266.club/technic/ESP8266 ... _01-11.pdf

hyperion007
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

Post by hyperion007 »

Thanks Rudi.

Let me know when you have tried the ESP-03 and what pins go where.

Thanks.

Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 493 times
Been thanked: 187 times

Re: WiFi Communication with ESP8266

Post by Rudi »

Hi,

ESP-04 done:

i will make same with ESP-03 now..

:


RST
----
push GPIO16 short to GND and release it again.

Flashmode
-----------
If you want in Flashmode,
so push GPIO0 to GND
and push GPIO16 to GND, release it
now you are in Flashmode, you can release GPIO0 now too

Boot normal Mode
---------------------
If Flash ok, the ESP will boot byitself,
if you take other Flashprog perhabs esptool from mamalala
this support pin switching by software in newer version.

At XTools can be: you must push GPIO16 to Gnd short ( RST ) and release for reboot.

Let me know how you get on ;-)

i added the finnish in ESP-04, same i will do with the ESP-03
I will add a pigtail to the ESP-04 and extern Ant

I have connect CH_PD by a jumper to Vcc+
the GPIO15 i have connect by a jumper too but to GND
The Flash Button simple parallel at GPIO0 and GND, it is a "closer pusher"
The RST Button simple parallel at GPIO16 and GND, it is a "closer pusher" too.

Best wishes
rudi ;-)


btw ;-)
http://s.zeptobars.ru/ESP8266-HD.jpg
;-)

hyperion007
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

Post by hyperion007 »

How I get on? That info was still for the ESP-04 right?

Rudi
Posts: 666
Joined: Mon Feb 10, 2014 4:59 am
Has thanked: 493 times
Been thanked: 187 times

Re: WiFi Communication with ESP8266

Post by Rudi »

Hi

this will be the same for the ESP.03
because:

gpio15 is mtdo and must actually when not in SPI slave mode, low be at boot.
It has a Waek pullup, but on the basis of the mtdo function (because the boot is on input)
every now and then to weak is, so it may be that the esp8266ex but from spi flash in standalone
fashion Botet although no external pulldown depends on mtdo.

hope this helps

the one thing with EXT_RST PIN32.../ GPIO16 Pin 8 and Deep-Sleep Wakeup ( XPD_DCDC )
usually pin 32 ist the RST hardware pin..
but at ESP-03, ESP-04 and other.. GPIO16 is descripted as a HW RST ( WakeUp..)

I am not sure if the GPIO16 pin is the RST pin, because Chip picture shows Pin 32 as a EXT RST
but documents said it is a hardware RST pin, you can try it.
china description is not light but will give a hint - deep-sleep wakeup..
..try it! you will get the result like you want.

at my pic it is functionally like i posted
hope this helps

best wishes
rudi ;-)

btw:
i will start work at esp-03 at evenning - will same procedure like i made in esp04

hyperion007
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

Post by hyperion007 »

Do you have an example of how to send a string variable from a browser to flowcode using the ESP8266 TCPServer?

hyperion007
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

Post by hyperion007 »

Ben, if you could help out by explaining exactly what the macros below actually do and how to use them, that would be VERY helpful :)

GetInValue ("returns a string value of a request parameter" but what is a request parameter and how do I send one?)
SetOutValue (outboud substitution string, what is this? How and when would you use this?)

I want to be able to use either POST or GET method in a form to input string values on a webpage with a submit button and receive these string values and write them to variables in the PIC program.

It looks like LeighM did this here: http://www.matrixtsl.com/mmforums/viewt ... 40&t=11679


<html>
<form action="index.htm" method="get">
Enter String value01: <input type="text" name="String_Var01"><br>
Enter String value02: <input type="text" name="String_Var02"><br>
<input type="submit" value="and Click Me">
</form>
</html>

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: WiFi Communication with ESP8266

Post by kersing »

hyperion007 wrote:GetInValue ("returns a string value of a request parameter" but what is a request parameter and how do I send one?)
If you take the HTML example code, this call will return the value of "String_Var01" or "Sting_Var02" depending on the number you supply to the macro (starting at zero)
hyperion007 wrote:SetOutValue (outboud substitution string, what is this? How and when would you use this?)
This replaces the <number> marker (%<number>) with the value supplied.

Have you checked the documentation of the WLAN (EB069, WIZ610wi) component? This component is based on it. The wiki page for that component has an example flowchart that does exactly what you are after.
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

hyperion007
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

Post by hyperion007 »

Thanks, that helped, but I still can't get it to work :(

I see the website just fine so the web server works.
flowcode.JPG
flowcode.JPG (37.37 KiB) Viewed 19654 times
I have tried the following variations of HTML code:

Code: Select all

<html>
<form action="index.htm" method="post">
Enter String value01: <input type="text" name="String_Temp"><br>
<input type="submit" value="Submit">
</form> 
</html>

Code: Select all

<html>
<form action="index.htm" method="get">
Enter String value01: <input type="text" name="String_Temp"><br>
<input type="submit" value="Submit">
</form> 
</html>

Code: Select all

<!doctype html>
<html>
<head>
</head>
<body>
<form name="input" ><input type="submit" value="Save this text ..."> <input type="text" name="0"></form>
</body>
</html>

Code: Select all

<html>
<head>
</head>
<body>
<form name="input" ><input type="submit" value="Save this text ..."> <input type="text" name="0"></form>
</body>
</html>

Code: Select all

<html>
<form action="index.htm" method="post">
Enter String value01: <input type="text" name="0"><br>
<input type="submit" value="Submit">
</form> 
</html>

Code: Select all

<html>
<form action="index.htm" method="get">
Enter String value01: <input type="text" name="0"><br>
<input type="submit" value="Submit">
</form> 
</html>
Nothing is displayed on the display. I can see that the blue activity LED on the ESP8266 blinks a bit when I press the "Submit" button to send the variable, and the URL changes to 192.168.4.1/index.htm?String_temp=hello or whatever I write in the form.

kersing
Valued Contributor
Valued Contributor
Posts: 2045
Joined: Wed Aug 27, 2008 10:31 pm
Location: Netherlands
Has thanked: 553 times
Been thanked: 1081 times
Contact:

Re: WiFi Communication with ESP8266

Post by kersing »

Could you try using the attached version of the component?

[Non working component removed]
“Integrity is doing the right thing, even when no one is watching.”

― C.S. Lewis

Post Reply