Scale-N

Scale-N
Arduino
Componenten
Rollend Materieel
Naslag
Onderdelen
Wissels
Basis Electronica
Symbols Electronica
Programming Arduino
DCC++
DR5000
Products
Link













































NodeMCU

De nodeMCU is een van de populairste ontwikkelborden voor de ESP-12E module en de daarin opgenomen ESP8266EX system-on-chip. Deze kan net als een Arduino geprogrammeerd worden, maar dan met een 80 tot 160Mhz snelle processor en volledige wifi functionaliteit ingebouwd.
Er zijn naast Arduino ook nog andere software opties om met de nodeMCU te werken:

  • De AT command firmware staat er al op, en laat je de wifi functies met seriële opdrachten interactief aansturen
  • Er zijn script interpreter firmwares voor onder andere microPython en Lua
  • En voor het zwaardere programmeerwerk is er de native C SDK omgeving (NONOS of RTOS) van Espressif, of esp-open-sdk als alternatief.
De nodeMCU/ESP8266 chip werkt op 3.3V logisch niveau voor datasignalen. De datasheet geeft 3.6V als maximum aan voor de input pinnen, dus er is voltage level conversie nodig als er met 5V sensors of processors gecommuniceerd wordt.

AT command interpreter:
Eenmaal met USB verbonden, kan de nodeMCU direct getest worden vanuit de serial monitor van de Arduino IDE.
Als de nodeMCU (her)start, geeft de ESP8266 bootloader eerst enige output op 74880 baud (op 115200 zie je dit als onleesbare tekens terug). Vervolgens start de AT firmware, en die geeft op 115200 baud ‘ready’ aan.
Met de serial monitor op 115200 baud, en de regeleinde optie op NL+CR, kun je opdrachten geven en de reactie zien, zoals:

  • AT+GMR – vraagt de versie informatie op
  • AT+CWMODE=1 – zet de module in station mode (client)
  • AT+CWLAP – geeft een lijst van beschikbare access points
  • AT+CWJAP=”ssid”,”password” – geeft opdracht te verbinden met access point
  • AT+CWJAP? – vraagt informatie over het verbonden access point op
Alle at-instructies 4a-esp8266_at_instruction_set_en_v2.2.1.pdf
Als je een Arduino sketch uploadt, overschrijf je de AT command firmware. Wil je die daarna herstellen, dan kun je daarvoor de Espressif flash download tool gebruiken.

Layout

the NodeMCU board consists of 30 Pins (15 on each side), an ESP-12E Module with PCB Antenna, CP2102 USB to UART Bridge Controller from Silicon Labs, two push buttons (one is RESET and the other is Flash), a micro–USB Connector for Power and Uploading, a 3.3V Regulator, some passive and active components and two LEDS.

Pinout


PinDescriptionAlternate FunctionsDefault
ADC0Analog InputADC0
Reserved
Reserved
SDD3SDIO Data 3GPIO10SDD3
SDD2SDIO Data 2GPIO9SDD2
SDD1SDIO Data 1GPIO8SDD1
SDDCMDSDIO CMDGPIO11SDDCMD
SDD0SDIO Data 0GPIO7SDD0
SDCLKSDIO CLKGPIO6SDCLK
GNDGround
3.3V3.3V Output
ENChip Enable (Active HIGH)
RSTReset (Active LOW)
GNDGround
VIN5V Input to 3.3V Regulator
3.3V3.3V Output
GNDGround
TXD0UART0 TXDGPIO1TXD0
RXD0USRT0 RXDGPIO3RXD0
GPIO15GPIO15HSPI_CS/RTS0GPIO15
GPIO13GPIO13HSPI_MOSI/CTS0GPIO13
GPIO12GPIO12HSPI_MISOGPIO12
GPIO14GPIO14HSPI_SCKGPIO14
GNDGround
3.3V3.3V Output
GPIO2GPIO2UART1 TXDGPIO2
FlashFlashGPIO0Flash
GPIO4GPIO4Software SDA (I2C)GPIO4
GPIO5GPIO5Software SCL (I2C)GPIO5
GPIO16GPIO16Wake (deep sleep)GPIO16

Power

There are two ways to power the NodeMCU board. One is through the micro-USB port and the other is through VIN pin. Note that ESP8266EX SoC is compatible with only 3.3V. So, the NodeMCU board has 3.3V Regulator IC (AMS1117 – 3.3).
If you have regulated 5V power, then you can apply this to the VIN pin. There are three 3.3V pins, which are connected to the 3.3V output of the regulator.

Peripherals

GPIO
The ESP8266EX has 17 GPIO pins. But not all them available for the user as some of these are used for their alternative functions (like UART, SDIO, SPI etc.) in NodeMCU (ESP-12E Module).

SPI

There are two SPI Interfaces on ESP8266EX SoC (SPI and HSPI). Both support Master and Slave Operations. Master mode clock can be configured to 80 MHz while slave mode clock is up to 20 MHz.

  • SCLK – GPIO6 (Not Available)
  • MISO – GPIO7 (Not Available)
  • MOSI – GPIO8 (Not Available)
  • CS – GPIO11 (Not Available)
  • HSPI_CLK – GPIO14
  • HSPI_MISO – GPIO12
  • HSPI_MOSI – GPIO13
  • HSPI_CS – GPIO15
GPIO pins for SPI are multiplexed with some SDIO pins. Also, there is a 4MB SPI Flash on the ESP-12E Module connected through SPI Pins. So, you do not have access to SPI pins. You can only used HSPI pins for SPI communication.

I2C

Hardware I2C is not available in ESP8266 but is can implemented through software. GPIO4 and GPIO5 can be used as SDA and SCL as they do not have any other alternative functions.

UART

ESP8266EX has two hardware UARTs (UART0 and UART1) with baud rates up to 115200. In this, UART0 can be used for communication and it has data flow control as well. UART1 has only TX pin (its RX pin is used by SDD1) so, it can used for data logging.
  • UART0 TX – GPIO3
  • UART0 RX – GPIO1
  • UART0 RTS – GPIO15
  • UART0 CTS – GPIO13
  • UART1 TX – GPIO2
  • UART1 RX – GPIO8 (Not Available)
Additional Features

All the GPIO pins except GPIO16 support Interrupts.
There are two on-board LEDs on the NodeMCU Board. One LED is on the ESP-12E Module and is connected to GPIO2 and the other LED is on the NodeMCU Board and this is connected to GPIO16.

GPIO Pins

GPIO6 – GPIO11 are used for SPI Flash. So, these are not available for user.
Also, GPIO1 and GPIO3 are used as UART TX and RX Pins, which also rules them out. So, out of 17 GPIO pins, 8 are already used for other purposes. This leaves us with 9 pins. These pins are marked as D0 to D8 on NodeMCU Board.

GPIO PinNodeMCU PinInformation
0D3Pulled HIGH and connected to Flash Button
1TXDo not use while TXing
2D4
3RXDo not use while RXing
4D2I2C SDA
5D1I2C SCL
6-11-Connected to SPI Flash
12D6
13D7
14D5
15D8Pulled LOW
16D0Used to wake from deep sleep. No interrupt, I2C, PWM

Boot Mode Selection Pins

GPIO 0GPIO 2GPIO 15Boot Mode
LOWHIGHLOWUART Bootloader
HIGHHIGHLOWBoot from SPI Flash
xxHIGHBoot from SDIO

#6, Bak 5.10.A


github