Friday 15 April 2016

Detailed Pin Diagram of Wifi-Shield ESP8266



ESP-8266-01 terminals

The terminals for this ESP models are depicted here:
  • VCC shall be connected to the 3.3V power supply
  • GPIO0 and GPIO2 are general purpose digital ports. GPIO0 also controls the module mode (programming or normal operation). In our case (normal operation), it shall be connected to 3.3V (high). GPIO2 is not used in this example, so I put it on 3.3V to simplify the connections
  • CH_PD: Chip enable. Keep it on high (3.3V) for normal operation
  • RST: Reset. Keep it on high (3.3V) for normal operation. Put it on 0V to reset the chip.
  • Tx: Goes to Arduino Rx
  • Rx: Goes to Arduino Tx (But needs a voltage adjusting)
  • GND is ground
You can see that, in this example, all pins go to VCC (3.3V), except GND, Rx and Tx.
Note that the module also has two-color led (or two separate leds, depending on your vendor)
  • Red led indicates the board is powered
  • Blue led indicates module activity (Initializing, Rx/Tx, etc)


Test code

In order to test your ESP, you'll need two serial ports:
  • One dedicated serial port, connected between Arduino and ESP, where Arduino will send AT commands to ESP.
  • A second serial port, connected between Arduino and the computer, where you can type your AT commands.
So, the best Arduino model for this task is Mega, since it provides up to 4 serial ports. You can still try other models, using the SoftSerial lib, but this library has some speed limitations, and it may not work with some ESP models.
You can test your ESP connection with the following simple code:
void setup()
{
    Serial.begin(9600);
    Serial1.begin(9600);
}
void loop()
{
    while (Serial1.available()) {
        Serial.write(Serial1.read());
    }
    while (Serial.available()) {
        Serial1.write(Serial.read());
    }
}
This code simply relays data from both Arduino serial. It gets the AT commands you type at your computer and sends them directly to your ESP. It also gets ESP return data and sends to your computer.

No comments:

Post a Comment

How to install google-chrome in redhat without redhat subscription

Install google-chrome in redhat  Download the .rpm file of chrome https://www.google.com/chrome/thank-you.html?installdataindex=empty&st...