#iot #esp8266

Tarun Yadav Nov 10 2021 · 2 min read
Share this

  Hello, My name is Tarun Yadav and  am writing this blog to share my learning, understanding  on the ESP8266.

What is a Microcontroller?

The easiest way to understand what is a microcontroller is to think about a tiny computer: it includes a processor, memory and input/output (I/O) peripherials to connect small display, buttons, motors, sensors, etc. To “control” a microcontroller, you can put programs onto it and run them. As we will see later in this lesson, we usually write programs using a laptop and then transfer the programs into the microcontroller to execute it.

What is an ESP8266?

An ESP8266 is a microcontroller:

  • Low-power, highly-integrated Wi-Fi solution
  • A minimum of 7 external components
  • Wide temperature range: -40°C to +125°C
  • ESP8285 — 8 Mbit flash embedded
    Different kind of ESP8266 can be found on the market so your ESP8266 board may differ slightly from the one shown below:-

  • ESP8266 Board

    On the picture above, the ESP8266-12 block is where the processor, memory and WIFI unit are located. The rest ensures communication with external sensors, USB port, voltage regulator, etc.

    For those interested in computer architecture, have a look at the functional diagram of an ESP8266:

    ESP8266 architecture

    Become familiar with the ESP8266 architecture

    On the picture above, can you identify:

  • the CPU (Central Processing Unit)
  • the memory SRAM (Static Random Access Memory)
  • The ESP8266 uses a 32bit processor with 16 bit instructions. It is Harvard architecture which mostly means that instruction memory and data memory are completely separate.

    The ESP8266 has on die program Read-Only Memory (ROM) which includes some library code and a first stage boot loader. All the rest of the code must be stored in external Serial flash memory (provides only serial access to the data - rather than addressing individual bytes, the user reads or writes large contiguous groups of bytes in the address space serially).

    Depending on your ESP8266, the amount of available flash memory can vary.

    As any other microcontroller, ESP8266 has a set of GPIO pins (General Purpose Input(Output pins) that we can use to “control” external sensors.

    Our ESP8266 has 17 GPIO pins but only 11 can be used (among 17 pins, 6 are used for communication with the on-board flash memory chip). It also has an analog input (to convert a voltage level into a digital value that can be stored and processed in the ESP8266).

    It also has a WIFI communication to connect your ESP8266 to your WIFI network, connect to the internet, host a web server, let your smartphone connect to it, etc.

    Another advantage of an ESP8266 is that is can be programmed as any other microcontroller and especially any Arduino.

    ESP8266 Pin Diagram:

    Pin Diagram
  • Power Pins There are four power pins. VIN pin and three 3.3V pins.VIN can be used to directly supply the Node MCU/ESP8266 and its peripherals. Power delivered on VIN is regulated through the onboard regulator on the Node MCU module – you can also supply 5V regulated to the VIN pin3.3V pins are the output of the onboard voltage regulator and can be used to supply power to external components.
  • GND are the ground pins of Node MCU/ESP8266
  • I2C Pins are used to connect I2C sensors and peripherals. Both I2C Master and I2C Slave are supported. I2C interface functionality can be realized programmatically, and the clock frequency is 100 kHz at a maximum. It should be noted that I2C clock frequency should be higher than the slowest clock frequency of the slave device.
  • GPIO Pins Node MCU/ESP8266 has 17 GPIO pins which can be assigned to functions such as I2C, I2S, UART, PWM, IR Remote Control, LED Light and Button programmatically. Each digital enabled GPIO can be configured to internal pull-up or pull-down, or set to high impedance. When configured as an input, it can also be set to edge-trigger or level-trigger to generate CPU interrupts
  • ADC Channel The Node MCU is embedded with a 10-bit precision SAR ADC. The two functions can be implemented using ADC. Testing power supply voltage of VDD3P3 pin and testing input voltage of TOUT pin. However, they cannot be implemented at the same time.
  • UART Pins Node MCU/ESP8266 has 2 UART interfaces (UART0 and UART1) which provide asynchronous communication (RS232 and RS485), and can communicate at up to 4.5 Mbps. UART0 (TXD0, RXD0, RST0 & CTS0 pins) can be used for communication. However, UART1 (TXD1 pin) features only data transmit signal so, it is usually used for printing log.
  • SPI Pins Node MCU/ESP8266 features two SPIs (SPI and HSPI) in slave and master modes. These SPIs also support the following general-purpose SPI features:
  • SDIO Pins Node MCU/ESP8266 features Secure Digital Input / Output Interface (SDIO) which is used to directly interface SD cards. 4-bit 25 MHz SDIO v1.1 and 4-bit 50 MHz SDIO v2.0 are supported.
  • PWM Pins The board has 4 channels of Pulse Width Modulation (PWM). The PWM output can be implemented programmatically and used for driving digital motors and LEDs. PWM frequency range is adjustable from 1000 μs to 10000 μs (100 Hz and 1 kHz).
  • Control Pins are used to control the Node MCU/ESP8266. These pins include Chip Enable pin (EN), Reset pin (RST) and WAKE pin.
  • Applications :

  • Prototyping of IoT devices
  • Low power battery operated applications
  • Network projects
  • Projects requiring multiple I/O interfaces with Wi-Fi and Bluetooth functionalities
  • Comments
    Read next