Create a Webserver Using ESP01 and STM32F401CCUx
Introduction: Create a Webserver Using ESP01 and STM32F401CCUx
ESP-01 WiFi module is developed by encapsulates Tensilica L106 integrates industry Clock speed support 80 MHz, 160 MHz, supports the RTOS, integrated Wi The module supports standard IEEE802.11 add modules to an existing device networking, or building a separate network controller. ESP8266 is high integration wireless SOCs, designed for space and power-constrained mobile platform It provides unsurpassed ability to embed Wi application, with the lowest cost, and minimal space requirement. ESP8266EX offers a complete and self or to offload Wi-Fi networking functions from another application processor When ESP8266EX hosts the application, it boots up directly from an external flash. It has improved the performance of the system in such applications. Alternately, serving as a Wi-Fi adapter, wireless internet access can be added to any microcontroller-based design with simple connectivity (SPI/SDIO or I2C/UART interface). http://www.ai-thinker.com Ai-thinker Team. 977
core processor ESP8266 in smaller sizes of the module industry-leading ultra low power 32-bit MCU micro, with the 16 Wi-Fi MAC/BB/RF/PA/LNA, on b/g/n agreement, complete TCP/IP protocol stack. Users can use the Wi-Fi capabilities within other systems, or to function as a standalone self-contained Wi-Fi networking solution; it can be used to host processor. integrated 3 16-bit short mode, /on-board antenna.
Supplies
1.ESP01 WiFi module
2.STM32F401CCUx(Black Pill)
3.Jumper Wire.
Step 1: Connect ESP01 With STM32F401 According to the Diagram.
NOTE:- I've used STM32F401CCUx(Black Pill) in my case. But in the circuit diagram, I've shown a blue pill. There was no Black Pill available in fritzing. Connections will be the same for both boards.
Refer to below table to connect ESP8266 pins with STM32 pins:
ESP8266 -> STM32
VCC ->3.3V
GND ->G
CH_PD -> 3.3V
TX -> PA3
RX -> PA2
Step 2: Connect STM32 With Pc and Upload the Code.
//Interfacing ESP8266 Wi-Fi with STM32F401CCUx
//NOTE: Serial is serial monitor with baud rate(9600)
//NOTE: Serial2 (TX2, RX2)is connected with ESP8266(RX,TX)respectively with baud rate (9600)
String webpage=""; //String variable to store characters
int i=0,k=0,x=0; //integer variables
String readString; //using readString feature to read characters
boolean No_IP=false; //boolean variables
String IP=""; //String variable to store data
char temp1='0'; //character variable
String name="<p>Manodeep's Server</p><p>Server created using ESP01 and STM32F401CCUx</p>"; //String with html notations
String data="<p>Data Received Successfully.....</p>"; //String with html
void check4IP(int t1) //A function to check ip of ESP8266
{
int t2=millis();
while(t2+t1>millis())
{
while(Serial2.available()>0)
{
if(Serial2.find("WIFI GOT IP"))
{
No_IP=true;
}
}
}
}
void get_ip() //After cheacking ip ,this is a function to get IP address
{
IP="";
char ch=0;
while(1)
{
Serial2.println("AT+CIFSR"); //GET IP AT COMMAND
while(Serial2.available()>0)
{
if(Serial2.find("STAIP,")) //This finds the STAIP that is the STATIC IP ADDRESS of ESP8266
{
delay(1000);
Serial.print("IP Address:");
while(Serial2.available()>0)
{
ch=Serial2. 977