NodeMCU ESP8266: Details and Pinout

Introduction: NodeMCU ESP8266: Details and Pinout

About: Do you like technology? Follow my channel on Youtube and my Blog. In them I put videos every week of microcontrollers, arduinos, networks, among other subjects.

Today, we will talk about ESP8266 pinning, or in other words, NodeMCU. Personally, I really like this component, as it already comes with USB input. But it is important to explain that the NodeMCU is formed by an ESP12E, which still has an ESP8266EX inside it. Thus, we’ll learn the correct pin identification by doing the following: looking at the NodeMCU datasheet, knowing which of these pins work with digitalWrite, digitalRead, analogWrite, and analogRead, and understanding the boot more thoroughly.

As I program more with Arduino IDE, I practically see the NodeMCU as an Arduino. However, I must emphasize these devices have differences, especially concerning the pinning. If you watched the ESP32 video entitled “Internal Details and Pinout,” you’ve learned there are pins that can’t be used, or that are reserved for certain things. So I want to do something useful here related to this, but this time with ESP8266.

Step 1: NodeMCU Devkit 1.0

The term NodeMCU usually refers to the firmware, while the board is called Devkit.

NodeMCU Devkit 1.0 consists of an ESP-12E on a board, which facilitates its use.

It also has a voltage regulator, a USB interface.

Step 2: ESP-12E

The ESP-12E is a board created by AI-THINKER, which consists of an ESP8266EX inside the metal cover.

Step 3: ESP8266EX

Made by Espressif, this microchip has integrated WiFi and low-power consumption.

Processor RISC Tensilica L 106 32bit with a maximum clock of 160 MHz

Step 4: NodeMCU 1.0 ESP-12E Pinout

Step 5: ESP-12E Pinout

I want to emphasize that NodeMCU and ESP-12E are not the same things. In the case of the ESP-12E, the recording uses the serial, the UART. In NodeMCU, this is performed by the USB.

Step 6: And After All This, What's the Number to Put When Programming?

Use the number that is in front of the GPIO or the constants A0, D0, D1, D2, D3, D4, D5, D6, D7, and D8.

Step 7: Boot

We put the oscilloscope at the tip of each pin. This allows us to find, for example, that when we turn on the NodeMCU, its pins are not all the same. Some are up and others down, by default. See the comments on the behavior of each post after the boot in the image below.

Step 8: Constants That Are Already Predefined

Step 9: Blink Example

In this example, we connected an LED on port D5, which is GPIO14. So the options are as follows:

//O led está no GPIO14
#define LED 6 //ou usar a constante D5 que já está definida //#define LED D5 void setup() { pinMode(LED, FUNCTION_3); } void loop() { digitalWrite(LED, HIGH); delay(1000); digitalWrite(LED, LOW); delay(1000); }

Step 10: INPUT / OUTPUT

When performing INPUT and OUTPUT tests on the pins, we obtained the following results:

  • digitalWrite did NOT work with GPIOs 6, 7, 8, 11, and ADC (A0)
  • digitalRead did NOT work with GPIOs 1, 3, 6, 7, 8, 11, and the ADC (A0)
  • analogWrite did NOT work with GPIOs 6, 7, 8, 11, and ADC (A0) (GPIOs 4, 12, 14, 15 have hardware PWM, and the others are by software)
  • analogRead worked only with the ADC (A0)

  • 6, 7, 8, 11 do NOT work for the above four commands

Step 11: PDF

Download the PDF.

Be the First to Share

    Recommendations

    • Block Code Contest

      Block Code Contest
    • Make it Glow Contest

      Make it Glow Contest
    • Crafts For Kids Challenge

      Crafts For Kids Challenge

    10 Comments

    0
    73gibi
    73gibi

    Answer 1 year ago

    ******************************************/
    #include <NewPing.h>
    // HC-SR04 ultrasonic sensor
    #define TRIGGER_PIN A1 // Arduino pin tied to trigger pin on the ultrasonic sensor.
    #define ECHO_PIN A0 // Arduino pin tied to echo pin on the ultrasonic sensor.
    #define MAX_DISTANCE 200 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-500cm.
    #define buzzer 8 //the pin of the active buzzer
    #define push 6
    #define led 4
    long TimeRef = 0;
    int Cycle = 600000;
    int cms = 0;
    NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.
    void setup() {
    //Serial.begin(9600); // Open serial monitor at 115200 baud to see ping results.
    pinMode(buzzer,OUTPUT);//initialize the buzzer pin as an output
    pinMode(led,OUTPUT);//led
    pinMode(push,INPUT_PULLUP);// poussoir
    BipBip();
    }
    void loop() {
    bool StatePush = digitalRead(push);
    if (StatePush == LOW)
    TimeRef = 0;
    Cycle = millis() - TimeRef;
    // Read every 10 minutes
    if (Cycle > 600000){
    digitalWrite(led,HIGH);
    delay(200);//wait for 2ms
    digitalWrite(led,LOW);
    // Read the distance
    unsigned int uS = sonar.ping();
    cms = uS / US_ROUNDTRIP_CM;
    //Serial.print(cms);
    //Serial.println("cm");
    if (cms > 45 and cms < 70)
    BipBip();
    TimeRef = millis();
    }
    }
    void BipBip() {
    digitalWrite(buzzer,HIGH);
    delay(100);//wait for 1ms
    digitalWrite(buzzer,LOW);
    delay(100);//wait for 1ms
    digitalWrite(buzzer,HIGH);
    delay(100);//wait for 1ms
    digitalWrite(buzzer,LOW);
    }

    0
    farisi6
    farisi6

    2 years ago

    Is esp 12e same as esp8266

    0
    JonasB55
    JonasB55

    Reply 2 years ago

    As Fernando explains in his first paragraph: ESP 8266 Ex is a hidden chip in there somewhere. (under the silver shield. What you can see is the ESP12E board. That's the smaller board on top of the NodeMCU devkit.

    0
    fantamax
    fantamax

    Question 2 years ago

    Hello Fernando,
    in the guide of MCU results that every port can be used as PWM, except D0.
    Your picture about pinout shows only 4 ports PWM.
    What is correct?
    Sorry, but I don't understand your language in the video.
    Thank you

    0
    JonasB55
    JonasB55

    Answer 2 years ago

    Perhaps both are correct. Hardware PWM is more reliable than software PWM.

    0
    mukeshgupta12
    mukeshgupta12

    Question 4 years ago on Step 11

    hello sir
    i have one question in my mind
    i have a code for temperature sensor with esp 8266 12 e. i set this code to take reading every 30 min
    but when i insert this code to esp it take reading every 27-28 min. i cannot understand that where is the error in code or hardware plz tell me. i can share my code also ...thanks
    please reply me

    0
    JonasB55
    JonasB55

    Answer 2 years ago

    I'm guessing you're running on a high current/voltage.

    1
    Amandeep Singh1984
    Amandeep Singh1984

    2 years ago

    Nice Article. Today I understood the relation between NodeMCU, ESP8866, ESP12E. Thanks.

    0
    mtoruc
    mtoruc

    Question 3 years ago on Step 4

    For Nokia5110 Lcd display, which pins can we use?

    nodemcu.jpg