Information: Voltages & Power Consumption

The ESP8266’s maximum voltage is 3.6V, so the nodeMcu has a build-in 3.3V regulator to deliver a safe, consistent voltage to the IC. That means the ESP8266’s I/O pins also run at 3.3V, you’ll need to level shift any 5V signals running into the IC.

The input to the build-in voltage regulator can either be delivered by USB, LiPo battery, or through the VIN pin.

Max Input Voltage: If you supply power to the board through the VIN, make sure the voltage does not exceed 6V.

Another option: If you have an external, regulated, supply you’d like to deliver directly to the ESP8266, you can supply that voltage through the 3V pin. While this voltage doesn’t have to be 3.3V, it must be within the range of 2.9-3.6V.

Current Ratings

Each GPIO pin can safely source 12mA, and sink 20mA.
See the ESP8266 pinout diagram for an overview of the pin mapping and further information on each pin.

As for total current: On average, the NodeMcu pulls about 80mA. WiFi transmits and receives can result in short burst in current draw. Here’s a table, transcribed from the ESP8266 datasheet, with some of the more common current characteristics.

Parameter Typical Max Unit
Transmit 802.11b (1 Mbps) 215   mA
Transmit 802.11b (11 Mbps) 197   mA
Transmit 802.11g (54 Mbps) 145   mA
Transmit 802.11n 135   mA
Receive 802.11b 60   mA
Receive 802.11g 60   mA
Receive 802.11n 62   mA
Standby 0.9   mA
Deep Sleep 10   µA
Maximum I/O Pin Drive Capability   12 (Output) 

20 (Input)



ESP8266 NodeMcu: First Steps

Step 1: Materials

  • micro-USB cable
  • Laptop/PC
  • ESP8266 NodeMcu
  • Wifi enabled Router
  • NodeMCU Firmware (Firmware)
  • Latest Arduino IDE (Arduino)


Step 2: Setup

When you buy the ESP8266, it comes with a pre-installed AT firmware. It is possible to program the chip with another firmware such as NodeMCU, for example. However, ESP8266 is compatible with the Arduino IDE, so we are going to use this firmware for this tutorial and in all projects presented in our blog section. To install Arduino IDE and setup ESP8266 firmware follow the guidelines here.


Step 3: Connect the ESP8266 to your PC

Connect your ESP8266 to your PC via a micro USB cable. During development, connecting the ESP8266 with a PC via USB serves 3 purposes:

  • Flashing the firmware: The ESP8266 has a build-in programmer
  • Power Source: The ESP8266 uses 3.3V and 82mA. An internal voltage regulator steps down the 5V USBvoltage to 3.3V
  • Serial interface (e.g. for displaying sensor data on the screen)


Step 4: Add and edit one of the Example codes below to the ESP8266

Example Code 1: Blink (Absolute Beginners)

This simple example will make the build-in LED of the ESP8266 NodeMcu blink in a certain interval. In the code below edit the delay value by changing the value assigned to delayms.



// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin LED_BUILTIN as an output.

int delayms=1000;
// the loop function runs over and over again forever
void loop() {
digitalWrite(LED_BUILTIN, HIGH); // turns the LED off
delay(delayms); // wait for milliseconds specified in the variable delayms
digitalWrite(LED_BUILTIN, LOW); // turns the LED on by making the voltage LOW
delay(delayms); // wait for milliseconds specified in the variable delayms

Example Code 2: Wifi Web Server (Advanced)

This example takes the first example further. We create a local web server on the ESP8266. Thus the build-in LED can be turned on and off from a browser on any device that is connected to the same local Wifi network.

 *  This sketch demonstrates how to set up a simple HTTP-like server.
 *  The server will set a GPIO pin depending on the request
 *    http://server_ip/gpio/0 will set the GPIO2 low,
 *    http://server_ip/gpio/1 will set the GPIO2 high
 *  server_ip is the IP address of the ESP8266 module, will be 
 *  printed to Serial when the module is connected.


const char* ssid = "your_ssid";          //replace "your_ssid" with the ssid of your wifi router
const char* password = "your_password"; //replace "your_password" with the password of your wifi router

// Create an instance of the server
// specify the port to listen on as an argument
WiFiServer server(80);
char LEDpin= LED_BUILTIN;  //LED_BUILTIN corresponds with GPIO16

void setup() {

  // prepare GPIO2
  pinMode(LEDpin, OUTPUT);
  digitalWrite(LEDpin, 0);

  // Connect to WiFi network
  Serial.print("Connecting to ");

  WiFi.begin(ssid, password);

  while (WiFi.status() != WL_CONNECTED) {
  Serial.println("WiFi connected");

  // Start the server
  Serial.println("Server started");

  // Print the IP address

void loop() {
  // Check if a client has connected
  WiFiClient client = server.available();
  if (!client) {

  // Wait until the client sends some data
  Serial.println("new client");

  // Read the first line of the request
  String req = client.readStringUntil('\r');

  // Match the request
  int val;
  if (req.indexOf("/gpio/0") != -1)
    val = 0;
  else if (req.indexOf("/gpio/1") != -1)
    val = 1;
  else {
    Serial.println("invalid request");

  // Set Led pin according to the request
  digitalWrite(LED_BUILTIN, val);

  // Prepare the response
  String s = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n\r\n\r\nGPIO is now ";
  s += (val)?"high":"low";
  s += "\n";

  // Send the response to the client
  Serial.println("Client disonnected");

  // The client will actually be disconnected 
  // when the function returns and 'client' object is detroyed

Step 5: Select the correct Port and board in the Arduino IDE

After connecting your ESP8266 to a PC via a USB cable, navigate to Tools>Port. You will see a single or a list of available COM ports (See Image). Select the COM port corresponding to your ESP8266.

After that you also need to select the board you are using. In Our case it is the ESP8266 NodeMcu 1.0. Navigate to Tools>Board. By default it is set to Arduino Uno. Change it to the NodeMCU 1.0 (See image below)

Step 6: Upload the Blink Example code to the ESP8266

To upload (flashing) the sketch to the ESP8266 board, click on the arrow icon in the Arduino IDE (see image). It usually takes 20-40 seconds. Sometimes the upload (flash) process might fail. Just retry until the process is completed.

Step 7: Result

Example Code 1:
As a result, if everything worked well, you should be able to see the build-in LED of the ESP8266 blinking in the interval you have specified in the code in the variable “delayms”.

Example Code 2:
Open the serial monitor in the arduino IDE (see image below). As soon as the ESP8266 is connected it will show its ip address. Also, open a browser on your smart phone or PC (they have to be connected to the same local Wifi network). In the address bar type the ip number that is shown on the serial monitor followed by the port number 80 and /gpio/0 or /gpio/1.

Example: Turns the LED on Turns the LED off

You can switch the LED of the ESP8266 from your browser now.

Congratulations, this is your first sketch running on an ESP8266. It is a basic example to get you familiar with ESP8266 board and the Arduino IDE. In the Projects section there will be more sophisticated examples where Wifi functionality, timers, interrupts, Websocket connections and analog reading will be dealt with


<ESP8266: General Information ESP8266 NodeMcu Pinout >

(Visited 431 times, 2 visits today)