﻿﻿﻿

How to programming esp8266 module with FTDI this is a Basic Project with the ESP8266-01 Module.



Parts Required:

ESP8266-01 FT232RL FT232 USB ZU TTL 5 V 3,3 V LEDs(2) Wire to connect it all together

Fix error in Arduino IDE:

warning:espcomm_sync failed

error: espcomm_open failed

error: espcomm_upload_mem failed

error: espcomm_upload_mem failed

To fix error put a jumper wire between Ground and Io0 (IO Zero) to put the Esp8266-01 in the Programming mode



ARDUINO IDE CONFIGURATION:

select the port shown on your side, in my case I got Com6.

Arduino test Code:

/*

* Hisham Marzouk

* https:// www.Officialhrm.com

* The server will set a GPIO pin depending on the request

* http://Esp8266_server_ip/gpio/0 will set the Blue LED low,

* http://Esp8266_server_ip/gpio/1 will set the Blue LED high,

* http://Esp8266_server_ip/gpio1/2 will set the Green LED low,

* http://Esp8266_server_ip/gpio1/3 will set the Green LED high,

* server_ip is the IP address of the ESP8266 module, will be

* printed to Serial when the module is connected.

*/

#include <ESP8266WiFi.h>

const char* ssid = “officialhrm”; // write your SSID

const char* password = “123456789”; // write your Password

// Create an instance of the server

// specify the port to listen on as an argument

WiFiServer server(80);

void setup() {

Serial.begin(115200);

delay(10);

// prepare GPIO2

pinMode(2, OUTPUT);

digitalWrite(2, 0);

// prepare GPIO0

pinMode(0, OUTPUT);

digitalWrite(0, 0);

// Connect to WiFi network

Serial.println();

Serial.println();

Serial.print(“Connecting to “);

Serial.println(ssid);

WiFi.mode(WIFI_STA);

WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {

delay(500);

Serial.print(“.”);

}

Serial.println(“”);

Serial.println(“WiFi connected”);

// Start the server

server.begin();

Serial.println(“Server started”);

// Print the IP address

Serial.println(WiFi.localIP());

}

void loop() {

// Check if a client has connected

WiFiClient client = server.available();

if (!client) {

return;

}

// Wait until the client sends some data

Serial.println(“new client”);

while(!client.available()){

delay(2);

}

// Read the first line of the request

String req = client.readStringUntil(‘\r’);

Serial.println(req);

client.flush();

// Match the request

int val;

int val1;

if (req.indexOf(“/gpio/0”) != –1){

val = 0;

digitalWrite(2, val);}

else if (req.indexOf(“/gpio/1”) != –1){

val = 1;

digitalWrite(2, val);}

else if (req.indexOf(“/gpio1/2”) != –1){

val1 = 0;

digitalWrite(0, val1);}

else if (req.indexOf(“/gpio1/3”) != –1){

val1 = 1;

digitalWrite(0, val1);}

else {

Serial.println(“invalid request”);

client.stop();

return;

}

client.flush();

}