The ESP8266 arduino compatible module is a low-cost Wi-Fi chip with full TCP/IP capability, and the amazing thing is that this little board has a MCU (Micro Controller Unit) integrated which gives the possibility to control input/output digital pins via simple code . This device is produced by Shanghai-based Chinese manufacturer, Espressif Systems.
ESP8266-01Technical specifications
ESP8266-01Technical specifications
- 32-bit RISC CPU: Tensilica Xtensa LX106 running at 80 MHz **
- 64 KiB of instruction RAM, 96 KiB of data RAM
- External QSPI flash – 512 KiB to 4 MiB* (up to 16 MiB is supported)
- IEEE 802.11 b/g/n Wi-Fi
- Integrated TR switch, balun, LNA, power amplifier and matching network
- WEP or WPA/WPA2 authentication, or open networks
- 16 GPIO pins **
- SPI, I²C,
- I²S interfaces with DMA (sharing pins with GPIO)
- UART on dedicated pins, plus a transmit-only UART can be enabled on GPIO2
- 1 10-bit ADC
Module pin description (pinout)
Pins are arranged in two rows, having 4 on each row. Some models have pin description on the PCB, which make it simple. On the top row you can find following
Pins from First Row
GND (Ground from power supply)
GPIO2 (Digital I/O programmable)
GPIO0 (Digital I/O programmable, also used for BOOT modes)
RX UART Receiving channel
Pins from Second Row
TX UART Transmitting channel
CH_PD enable/power down, must be pulled to 3.3v directly or via resistor
REST reset, must be pulled to 3.3v
VCC 3.3v power supply
Communicating with ESP8266
Program
Program to create a WiFi client and connect to diffrent hotspots with arduino
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
char n;
void setup()
{
Serial.begin(9600);
mySerial.begin(9600);
Serial.println("Esp8266 test ......");
Serial.println("a Test ESP8266");
Serial.println("b Connect to samsung");
Serial.println("c connect to Redmi Note-4");
Serial.println("d Listing wifi routers");
Serial.println("e Listing current wifi router");
Serial.println("");
Serial.println("");
}
void loop()
{
if (mySerial.available())
{
Serial.write(mySerial.read());
}
if (Serial.available())
{
n=Serial.read();
if(n=='a')
{
Serial.println("ESP8266 Testing............");
mySerial.println(F("AT"));
}
else if(n=='b')
{
Serial.println("Samsung connecting ............");
mySerial.println(F("AT+CWJAP=\"SSID-1\",\"Password\""));
}
else if(n=='c')
{
Serial.println("Redmi Note-4 connecting ............");
mySerial.println(F("AT+CWJAP=\"SSID-2\",\"password\""));
}
else if(n=='d')
{
Serial.println("Listing wifi routers");
mySerial.println(F("AT+CWLAP"));
}
else if(n=='e')
{
Serial.println("Listing current wifi router");
mySerial.println(F("AT+CWJAP?"));
}
}
}
Download code from here
Program to create a WiFi client and connect to diffrent hotspots with arduino
#include <SoftwareSerial.h>
SoftwareSerial mySerial(10, 11); // RX, TX
char n;
void setup()
{
Serial.begin(9600);
mySerial.begin(9600);
Serial.println("Esp8266 test ......");
Serial.println("a Test ESP8266");
Serial.println("b Connect to samsung");
Serial.println("c connect to Redmi Note-4");
Serial.println("d Listing wifi routers");
Serial.println("e Listing current wifi router");
Serial.println("");
Serial.println("");
}
void loop()
{
if (mySerial.available())
{
Serial.write(mySerial.read());
}
if (Serial.available())
{
n=Serial.read();
if(n=='a')
{
Serial.println("ESP8266 Testing............");
mySerial.println(F("AT"));
}
else if(n=='b')
{
Serial.println("Samsung connecting ............");
mySerial.println(F("AT+CWJAP=\"SSID-1\",\"Password\""));
}
else if(n=='c')
{
Serial.println("Redmi Note-4 connecting ............");
mySerial.println(F("AT+CWJAP=\"SSID-2\",\"password\""));
}
else if(n=='d')
{
Serial.println("Listing wifi routers");
mySerial.println(F("AT+CWLAP"));
}
else if(n=='e')
{
Serial.println("Listing current wifi router");
mySerial.println(F("AT+CWJAP?"));
}
}
}
Download code from here
No comments:
Post a Comment