Introduction: NodeMcu ESP8266 DevKit | Getting Started & Programming | Tutorial & Project
NodeMcu ESP8266 DevKit | Getting Started & Programming | Tutorial & Project
Step 1: GETTING STARTED
NodeMcu ESP8266 DevKit is a microprocessor-based development board developed by NodeMcu Team. It contains ESP12E Wi-Fi Module, which integrates an ESP8266EX Wi-Fi System-on-a-Chip (SoC). The chip is embedded with Tensilica Xtensa L106, 32-bit Microprocessor, which has a 160KB of SRAM. The chip has no programmable ROM, therefore, user program must be stored in an external 4MB SPI Flash Memory. It runs on the clock speed of 80MHz. It supports IEEE 802.11 b/g/n wireless networking standards and operates on 2.4GHz frequency band. It also supports WEP, WPA and WPA2 security protocols. NodeMcu ESP8266 DevKit uses Silicon Labs CP2102 chip, as a USB-to-Serial Convertor.
NodeMcu ESP8266 DevKit can be programmed with the Arduino IDE software. It allows you to write programs and upload them to your board. The board can be powered with an USB connection of 5V, via Type-Micro B USB Connector.
NodeMcu ESP8266 DevKit has several different kinds of pins, each of which is labeled on the board. Now, let’s see the function of each pins:
- NodeMcu ESP8266 DevKit has 9 digital input/output pins, which are labeled D0 through D8. These pins are used for general purpose input/output and can be configured by using the pinMode(), digitalRead() and digitalWrite() functions.
- NodeMcu ESP8266 DevKit also has 1 analog input pin, which is labeled A0. This pin is connected to onboard 1-Channel 10-Bit Analog-to-Digital Converter (ADC) and is used to read the analog voltages by using the analogRead() function.
Both digital and analog pins can tolerate a maximum of 3.3V and can provide or receive a maximum current of 12mA. Each of these pins has an internal pull-up resistor, which can be enabled by using the INPUT_PULLUP command.
- VIN Pin is used to power the board with an external power supply of 5V to 12V.
- 3V3 Pin provides a regulated 3.3V output from the board.
- GND Pins are the Ground pins.
- Digital Pin D1 to D8 are the External Interrupts pins, which can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value by using the attachInterrupt() function.
- Digital Pin D1 to D8 are also the PWM pins, which can provide 10-bit PWM output by using the analogWrite() function.
- Digital Pin D1 and D2 are SCL, SDA respectively are the Two Wire Interface pins, which support Two Wire Interface or I2C communication by using the Wire library.
- Digital Pin D5, D6, D7 and D8 are SCK, MISO, MOSI and SS respectively are the Hardware SPI pins, which support SPI communication by using the SPI library.
- RX and TX Pin are the Serial pins, are used to receive and transmit TTL serial data.
- RST Pin is the Reset pin, which is used to bring the line LOW to reset the microprocessor.
- EN Pin is the Chip Enable pin, which is to be active HIGH for normal operation.
- CLK, SD0, CMD, SD1, SD2 and SD3 Pins are the SPI pins, which are exclusively used for Quad-SPI communication with the Flash Memory on ESP12E Wi-Fi Module.
- RSV Pins are the Reserved pins, which are not used.
- RST Button is used to reset the microprocessor when pressed.
- FLASH Button enables us to flash the firmware into the microprocessor when pressed.
- There is a built-in LED which is connected to the Digital Pin D4.
In this tutorial, we will upload a simple Blink sketch, which will turn a LED on and off depending upon the pin value. When the pin value is HIGH, the LED turns on, and when the pin value is LOW, the LED turns off.
Step 2: COMPONENTS REQUIRED
Components that are required:
- NodeMcu ESP8266 DevKit: http://s.click.aliexpress.com/e/c5fWjmAM
- 220 Ohm Resistor: http://s.click.aliexpress.com/e/P7PvECg
- 400 Tie-Points Breadboard: http://s.click.aliexpress.com/e/b9Q3KNu8
- Jumper Wire: http://s.click.aliexpress.com/e/bsT7DpA0
- Type-A to Type-Micro B USB Cable: http://s.click.aliexpress.com/e/cjMhrDOo
Step 3: CONNECTIONS
Now, let’s see the connections.
- Connect the anode of LED to the Digital Pin D4 of NodeMcu ESP8266 DevKit, via a 220 Ohm Resistor.
- Connect the cathode of LED to the GND Pin of NodeMcu ESP8266 DevKit.
- Connect the one end of USB cable to the NodeMcu ESP8266 DevKit, and another end to the Computer.
Step 4: PROGRAMMING
In this tutorial, we will use Arduino IDE to program the board. Software and Source Code that are required:
Now, let’s program the board.
- Open the sketch in the Arduino IDE.
- Open Preferences dialog from the File menu of Arduino IDE.
- Enter the URL of the Board Package into the Additional Board Manager URLs field. We can add multiple URLs by separating them with commas.
- Open Boards Manager from Tools menu of Arduino IDE.
- Find the esp8266 platform. Select the proper version from drop-down box and click on the Install button.
- Select the proper Board from the Tools menu of Arduino IDE.
- Select the proper Serial Port from the Tools menu of Arduino IDE.
- Now, click on the Upload button to upload the sketch to the board.
If the upload is successful, the message "Done uploading" will appear in the status bar of Arduino IDE. After a few seconds, you should see the LED starts blinking.