ESP8266 + STM32 web server

Good day. I have decided to deal with WIFI modules, my choice fell on to vigorously develop ESP8266.
CAM00784

 

 

I decided to buy quickly instead waiting a month from China. I have viewed local vendors on Aukro and Olx. I met with Mr. Nicholay the city Krivoy Rog I immediately liked his shop very good range, and most importantly humane prices. Now I made it two purchases and I am very satisfied. Seller consults by email instantly sends the purchased goods, pack it in a convenient box parts in bags separated layers syndepon. It is evident that he love his business, so I recommend him here and wrote link to his shop http://olx.ua/list/user/DXUb/  

[adsense type=”banner”]

So ESP8266 device connected to USART1 board STM32DIP40 Reset to PB12 .  Circuit powered from LI-ION battery 3.3V through lowdrop stabilizer.

RGB led to TIM1_CH2, TIM1_CH3, TIM1_CH4.

Log exchanges between the boards. I will not write here in detail what each command means, here links to PDF with AT commands ESP8266 AT

ready
ATE0
ATE0

OK
AT

OK
AT+CWMODE=3

OK
AT+CWLAP
+CWLAP:(4,"YUNASKO",-89,"f8:d1:11:2b:dd:7c",1)
+CWLAP:(0,"Konst",-61,"e8:94:f6:70:bb:54",6)
+CWLAP:(3,"Hotels.com",-82,"d8:50:e6:f4:6f:48",11)
+CWLAP:(0,"ID03",-91,"00:27:22:9a:41:66",13)

OK
AT+CWJAP="Konst",""

OK
AT+CIFSR
+CIFSR:APIP,"192.168.4.1"
+CIFSR:APMAC,"1a:fe:34:98:50:ac"
+CIFSR:STAIP,"192.168.1.103"
+CIFSR:STAMAC,"18:fe:34:98:50:ac"

OK
AT+CIPMUX=1

OK
AT+CIPSTO?
+CIPSTO:180

OK
AT+CIPSERVER=1,80

OK
AT+CIPSTATUS
STATUS:2

OK
AT+CIPSTATUS
STATUS:2

OK
AT+CIPSTATUS
STATUS:2

OK


AT+CIPSTATUS
STATUS:3
+CIPSTATUS:1,"TCP","192.168.1.8",61750,1

OK

When a request comes to the server from a browser ESP8266 gives the following.

+IPD,1,330:GET /favicon.ico HTTP/1.1
Host: 192.168.1.103
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36
Accept: */*
Referer: http://192.168.1.103/
Accept-Encoding: gzip, deflate, sdch
Accept-Language: ru,en-US;q=0.8,en;q=0.6,uk;q=0.4

In response STM32 gives into html page.

AT+CIPSEND=0,528

OK
> HTTP/1.1 200 OK
Content-Type: text/html
Connection: close
Refresh: 1
Content-Length: 432

<html>
<head>
</head>
<body>
<form name="Settings"  method=POST>
<br>
<br>Red:<br><input type="text" name="Red" size="20"value="20"maxlength="50">
<br>
<br>Green:<br><input type="text" name="Green" size="20"value="20"maxlength="50">
<br>
<br>Blue:<br><input type="text" name="Blue" size="20"value="20"maxlength="50">
<br>
<input type="hidden" name="Cut" value=""><br>
<input type="submit"value="Set">
</form>
</html>

SEND OK

Page looks like this
_______________________

Red:
Green:
Blue:

________________________

 

The user enters the desired variables and press SET

The value transferred by POST

The module gives the following

Host: 192.168.1.103
Connection: keep-alive
Content-Length: 27
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Origin: http://192.168.1.103
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Referer: http://192.168.1.103/
Accept-Encoding: gzip, deflate
Accept-Language: ru,en-US;q=0.8,en;q=0.6,uk;q=0.4

Red=200&Green=0&Blue=0&Cut=1,CONNECT

As you can see that with the Invite header also coming variables values. RGB set in the appropriate color.
In response STM32 gives into html pages with adjusted values in fields.

AT+CIPSEND=0,528

OK
> HTTP/1.1 200 OK
Content-Type: text/html
Connection: close
Refresh: 1
Content-Length: 432

<html>
<head>
</head>
<body>
<form name="Settings"  method=POST>
<br>
<br>Red:<br><input type="text" name="Red" size="20"value="200"maxlength="50">
<br>
<br>Green:<br><input type="text" name="Green" size="20"value="0"maxlength="50">
<br>
<br>Blue:<br><input type="text" name="Blue" size="20"value="0"maxlength="50">
<br>
<input type="hidden" name="Cut" value=""><br>
<input type="submit"value="Set">
</form>
</html>

SEND OK

And so the entire algorithm takes place in a circle.

Conclusion: Module for its money doing well. The minuses spontaneous reboot, and high consumption of> 500mA.

Leave a Reply