Menu Close

How to programming esp8266 module with FTDI

 

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


Parts Required:

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

 

programming esp8266
Wiring the ESP8266-01 only For Programming.

Fix error in Arduino IDE:

Esp8266-01 Error

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.

Wiring
Wiring Table


ARDUINO IDE CONFIGURATION:

Arduino IDE CONFIGURATION

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

 

Arduino test Code:

Arduino Menu up

/*
* 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();

}

Arduino Menu Down

After Uploading:

  1. Remove the Io0 (IO Zero) from Ground
  2. In the Arduino IDE Open the Serial Monitor Window by Pressing (Ctrl+Shift+M)
  3. remove the VCC(3.3V) from the ESP8266 module and reconnect it to get the Server Ip Address

Serial_Monitor

in my case, I got 192.168.0.4 as Esp8266_server_ip

Now connect Io0 and Io2 to LEDs Open this links below in your Explorer (Chrome).

http://Esp8266_server_ip/gpio/0 will set the IO0 low,
http://Esp8266_server_ip/gpio/1 will set the IO0 high,
http://Esp8266_server_ip/gpio1/2 will set the IO2 low,
http://Esp8266_server_ip/gpio1/3 will set the IO2 high,

Download:Esp8266-01




For more Please make sure to subscribe to Officialhrm YouTube channel and like Facebook Page.

Thank you for visiting OfficialhrmPlease don’t forget to share this website with your friends.

Posted in Esp8266

Leave a Reply

Your email address will not be published. Required fields are marked *