WIFI to Serial module ESP2866 – OPEN HARDWARE / SOFTWARE / MIND
Menú Close

WIFI to Serial module ESP2866

This is a new module, that will help us to communicate with our ARDUINOS or PINGUINOS modules.

Is like a modem, by all the people that use some time ago the well know US-ROBOTIC, know the AT commands, and the easy way to use it.

The module showed is a BASIC model, but the distance that reach is perfect for domotic or smart home.

Unknown-9

 

The PINOUT

esp8266_schematic

The power supply never will be UP of 3,62Volts

After of some days testing I will say that is recommended that you install a resistor from VCC to CH_PD, to make UP this pin. With an 1k resistor will be perfect.

 

 

The next example code only make a GET of a WEBPAGE, if we run a TCPDUMP in the middle of the NETWORKS we will capture the request.

This code will be compatible with any project ARDUINO or PINGUINO

#define SSID «Walii» //your wifi ssid here
#define PASS «ffffffffff» //your wifi wep key here

#define DST_IP «164.138.31.203» //baidu.com
#define HOST «pinguino.walii.es»

char myChar;

void setup()
{
pinMode(9, OUTPUT);
pinMode(13, OUTPUT);

//blink led13 to indicate power up
for(int i = 0; i<15; i++)
{
digitalWrite(13,HIGH);
delay(50);
digitalWrite(13,LOW);
delay(50);
}

// Open serial communications for WiFi module:
Serial.begin(115200);
// Set time to wait for response strings to be found
Serial.setTimeout(5000);
delay(100);

//test if the module is ready
Serial.println(«AT+RST»);
if(Serial.find(«ready»))
{
delay(1000);
//connect to the wifi
boolean connected=false;
for(int i=0;i<5;i++)
{
if(connectWiFi())
{
connected = true;
break;
}
}
if (!connected)
{
//die
while(1);
}

delay(5000);
//set the single connection mode
Serial.println(«AT+CIPMUX=0»);
}
else
{
delay(100);
}
}

void loop()
{
String cmd = «AT+CIPSTART=\»TCP\»,\»»;
cmd += DST_IP;
cmd += «\»,80″;
Serial.println(cmd);
if(Serial.find(«Error»)) return;
cmd = «GET /status HTTP/1.0\r\nHost: «;
cmd += HOST;
cmd += «\r\n\r\n»;

Serial.print(«AT+CIPSEND=»);
Serial.println(cmd.length());
if(Serial.find(«>»))
{
}
else
{
Serial.println(«AT+CIPCLOSE»);
delay(1000);
return;
}

Serial.print(cmd);

delay(500);
//Serial.find(«+IPD»);
while (Serial.available())
{
char c = Serial.read();
delay(50);
}

delay(1000);
}

boolean connectWiFi()
{
Serial.println(«AT+CWMODE=1″);
String cmd=»AT+CWJAP=\»»;
cmd+=SSID;
cmd+=»\»,\»»;
cmd+=PASS;
cmd+=»\»»;
Serial.println(cmd);
delay(2000);
if(Serial.find(«OK»))
{
return true;
}
else
{
return false;
}
}

 

 

TCPDUMP capture.

22:25:46.492679 IP 10.10.10.127.60604 > 164.138.31.203.80: Flags [.], ack 5761, win 638, options [nop,nop,TS val 108106608 ecr 2454109009], length 0
22:25:46.493147 IP 164.138.31.203.80 > 10.10.10.127.60604: Flags [.], seq 5761:7201, ack 73, win 905, options [nop,nop,TS val 2454109009 ecr 108106599], length 1440

 

 

 

 

Specifications and Features

  • Default Baud Rate: 115200
  • 802.11 b / g / n
  • Wi-Fi Direct (P2P), soft-AP
  • Built-in TCP / IP protocol stack
  • Built-in TR switch, balun, LNA, power amplifier and matching network
  • Built-in PLL, voltage regulator and power management components
  • 802.11b mode + 19.5dBm output power
  • Built-in temperature sensor
  • Supports antenna diversity
  • «Off» leakage current is less than 10uA
  • Built-in low-power 32-bit CPU: can double as an application processor
  • SDIO 2.0, SPI, UART
  • STBC, 1×1 MIMO, 2×1 MIMO
  • A-MPDU, A-MSDU aggregation and the 0.4 Within wake
  • 2ms, connect and transfer data packets
  • Standby power consumption of less than 1.0mW (DTIM3)

Related Posts

Deja una respuesta

Tu dirección de correo electrónico no será publicada.

Este sitio usa Akismet para reducir el spam. Aprende cómo se procesan los datos de tus comentarios.