Thursday, March 31, 2016

Hardware Connections LED Blink Test

My First Program LED Blink on ESP8266-12
Let's to check that everything is working properly we will test LED blink program on ESP-12 (ESPino), For this test you can use ESP-01 also, this is taken on internal Blue led present on esp8266 WiFi Module, Different modules have different connection for internal led, for esp-12 LED is connected to GPIO2, and on esp-01 it is on GPIO1 which is TXD0, remember that you can use GPIO2 instead of LED_BUILTIN. Maximum IO pin current is 15mAmps so take care if you are connecting external LED.

ESP8266 Pin diagram:

esp-01 pin connections
RX and TX: Pins are used for serial communication and programming. TTL 3.3V logic voltage levels

GPIO2: are general purpose IO pin.

GPIO0: To put esp-01 or esp8266 in programming mode we have to make "GPIO 0" low at power on / reset

VCC : +3.3V from LM1117-3.3

GND : Ground

CH_PD: Connect this pin to 3.3V. connecting this pin to GND puts the ESP8266 in power down mode.

ESP-12 Pin Diagram:
esp-12 pin labels are written on bottom side

ESP8266 Circuit Connections for LED Blink Test:
esp8266 Wifi Module contains a blue LED on board which is internally connected to GPIO2.

Programming Steps:
1. Connect GPIO0 to Ground.
2. Connect USB to Serial Converter to RX,TX,GND Lines
3. Turn On the circuit, Blue LED blinks once while turning on the circuit if everything is ok.
4. Program the esp-12 using Arduino software.
5. While Programming on board blue LED starts flashing.

LED Blink Sample Code:

 ESP8266 Blink
 Blink the blue LED on the ESP-01 module
 This example code is in the public domain
 The blue LED on the ESP-01 module is connected to GPIO1 
 (which is also the TXD pin; so we cannot use Serial.print() at the same time)
 Note that this sketch uses LED_BUILTIN to find the pin with the internal LED

void setup() {
  pinMode(LED_BUILTIN, OUTPUT);     // Initialize the LED_BUILTIN pin as an output

// the loop function runs over and over again forever
void loop() {
  digitalWrite(LED_BUILTIN, LOW);   // Turn the LED on (Note that LOW is the voltage level
                                    // but actually the LED is on; this is because 
                                    // it is acive low on the ESP-01)
  delay(1000);                      // Wait for a second
  digitalWrite(LED_BUILTIN, HIGH);  // Turn the LED off by making the voltage HIGH
  delay(2000);                      // Wait for two seconds (to demonstrate the active low LED)

Points to Remember:
1. GPIOs are multiplexed with RX TX Lines
in ESP-01 module GPIO1 is also TXD Pin and internal LED pin.

2. GPIO2 on ESP-12 is connected to TXD and internal blue LED.

3. Do not forget to GPIO15 to pull low using 1K resistor.

4. Connect CH_PD pin to 3.3V through 1K resistor.

No comments:

Post a Comment