Difference between revisions of "NodeMCU Amica"

From CommonsLab
Jump to navigation Jump to search
(Init)
 
(link to ESP E-12)
Line 1: Line 1:
The [[nodeMCU Amica]] is a small module, which hosts an [[ESP8266]] SOC (system-on-chip) on an [[ESP-12]] module. The [[nodeMCU Amica | Amica]] module has also a [[CP1202]] USB-UART adapter on board, so that it is easy to communicate to the [[ESP8266]] chip though the MicroUSB connector.
+
The [[nodeMCU Amica]] is a small module, which hosts an [[ESP8266]] SOC (system-on-chip) on an [[ESP8266#E-12 | ESP E-12]] module. The [[nodeMCU Amica | Amica]] module has also a [[CP1202]] USB-UART adapter on board, so that it is easy to communicate to the [[ESP8266]] chip though the MicroUSB connector.
  
 
=== Communication ===
 
=== Communication ===

Revision as of 16:49, 16 July 2016

The nodeMCU Amica is a small module, which hosts an ESP8266 SOC (system-on-chip) on an ESP E-12 module. The Amica module has also a CP1202 USB-UART adapter on board, so that it is easy to communicate to the ESP8266 chip though the MicroUSB connector.

Communication

The modules come configured with one or various firmwares:

Ai-Thinker (AT)
With this firmware, the module listens at a baud rate of 115200 bps (or older ones at 57600 bps) for commands in the shape of AT+... to establish WiFi, IP and TCP connections.
Example: (User input in bold.)

Ai-Thinker Technology Co.,Ltd.
 
ready
AT+CWMODE=1
 
OK
AT+CWJAP="CommonsLab","12345678"
WIFI CONNECTED
WIFI GOT IP  
 
OK
AT+CIFSR
+CIFSR:STAIP,"10.176.30.89"
+CIFSR:STAMAC,"18:fe:34:e2:0e:85"
 
OK

nodeMCU
With this firmware, the module listens at a baud rate of 9600 bps for commands in the Lua programming language.
Example: (User input in bold.)

NodeMCU 0.9.6 build 20150704  powered by Lua 5.1.4
> wifi.setmode(wifi.STATION)
> wifi.sta.config("TEST-AP","12345678")
> wifi.sta.connect()
> print(wifi.sta.getip())
10.176.30.118	255.255.255.192	10.176.30.65

Changing the Firmware

The module can be changed from the [http:// AT (Ai-Thinker) firmware] to the nodeMCU firmware and back or even to other firmware written in C with, for example, the Arduino IDE. To write new firmware into the flash memory of the module, the Python script espTool can be used:

python esptool.py --port /dev/ttyUSB0  write_flash 0x00000 /Path/To/The/Firmware.bin

You might have to change /dev/ttyUSB0 to /dev/ttyUSB1 or similar.

List of AT commands

(Based on info from ElectroDragon.)

  • Baud rate at 57600, 115200 (new line) use option "send new line" or 'carriage return' for each command
  • <x> is the command
Set Inquiry Test Execute
Syntax: AT+<x>=<…> AT+<x>? AT+<x>=? AT+<x>
Example: AT+CWMODE=1 AT+CWMODE? AT+CWMODE=? -
Explanation: Set the WiFi mode to Client Check current mode Return which modes supported -
Command Description Type Set/Execute Inquiry test Parameters and Examples
AT general test basic - - - -
AT+RST restart the module basic - - - There must be no white space!
AT+GMR check firmware version basic - - - -
AT+CWMODE wifi mode wifi AT+CWMODE=<mode> AT+CWMODE? AT+CWMODE=? 1= Sta, 2= AP, 3=both, Sta is the default mode of router, AP is a normal mode for devices
AT+CWJAP join the AP wifi AT+CWJAP =<ssid>,< pwd > AT+CWJAP? - ssid = ssid, pwd = wifi password
AT+CWLAP list the AP wifi AT+CWLAP
AT+CWQAP quit the AP wifi AT+CWQAP - AT+CWQAP=?
AT+CWSAP set the parameters of AP wifi AT+CWSAP= <ssid>,<pwd>,<chl>, <ecn> AT+ CWSAP? ssid, pwd, chl = channel, ecn = encryption; eg. Connect to a WiFi Access-Point: AT+CWJAP="TEST-AP","12345678"; and then check if you are connected: AT+CWJAP?
AT+CWLIF check join devices' IP wifi AT+CWLIF - -
AT+CIPSTATUS get the connection status TCP/IP AT+CIPSTATUS <id>,<type>,<addr>,<port>,<tetype>= client or server mode
AT+CIPSTART set up TCP or UDP connection TCP/IP 1: single connection (+CIPMUX=0) AT+CIPSTART= <type>,<addr>,<port>; 2: multiple connection (+CIPMUX=1) AT+CIPSTART= <id><type>,<addr>, <port> - AT+CIPSTART=? id = 0-4, type = TCP/UDP, addr = IP address, port= port; eg. Connect to another TCP server, set multiple connection first: AT+CIPMUX=1; connect: AT+CIPSTART=4,"TCP","X1.X2.X3.X4",9999
AT+CIPMODE set data transmission mode TCP/IP AT+CIPMODE=<mode> AT+CIPSEND? 0: non-data mode, 1: data mode
AT+CIPSEND send data TCP/IP 1: single connection(+CIPMUX=0) AT+CIPSEND=<length>; 2: multiple connection (+CIPMUX=1) AT+CIPSEND= <id>,<length> AT+CIPSEND=? eg. send data: AT+CIPSEND=4,15 and then enter the data.
AT+CIPCLOSE close TCP or UDP connection TCP/IP AT+CIPCLOSE=<id> or AT+CIPCLOSE AT+CIPCLOSE=?
AT+CIFSR Get IP address TCP/IP AT+CIFSR AT+ CIFSR=?
AT+CIPMUX set multiple connections TCP/IP AT+CIPMUX=<mode> AT+CIPMUX? 0 for single connection 1 for multiple connections
AT+CIPSERVER set as server TCP/IP AT+CIPSERVER= <mode>[,<port> ] mode 0 to close server mode, mode 1 to open; port = port; eg. turn on as a TCP server: AT+CIPSERVER=1,8888, check the self server IP address: AT+CIFSR=?
AT+CIPSTO Set the server timeout TPC/IP AT+CIPSTO= AT+CIPSTO?
+IPD received data For Single Connection mode(CIPMUX=0): + IPD, <len>:
For Multi Connection mode(CIPMUX=1): + IPD, <id>, <len>: