I have ordered a NodeMCU dev board with CP2102 UART (12-12 Lazada Sale) it is from China and has the label Amica. The order arrived sooner than I expected and it arrived yesterday. It was inside an anti-static bag with a foam on the pin side, but the foam was to small that a pin got bent due to shipping handling?
Notice the bent pin, crazy english text at the back of the board.
This appears to be a version 2 board but whether it is a clone or not, I do not know.
Dimensions (mm): 26 x 48
The board has a CP2102 USB-UART chip but the label is sanded off, the voltage regulator is the AMS1117-3.3V and it is not a Low Dropout Voltage Regulator because it requires 1V dropout and has 11mA quiescent current (Not for Battery Applications). I really want to replace the voltage regulator to a HT7333 or MCP1700 but I cannot buy them in pieces only in bulk and will cost me more.
Plugging the device in with my GNU+Linux laptop:
$ sudo dmesg|tail
[52673.132072] usb 1-2: new full-speed USB device number 6 using uhci_hcd
[52673.336176] usb 1-2: New USB device found, idVendor=10c4, idProduct=ea60
[52673.336194] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[52673.336204] usb 1-2: Product: CP2102 USB to UART Bridge Controller
[52673.336214] usb 1-2: Manufacturer: Silicon Labs
[52673.336222] usb 1-2: SerialNumber: 0001
[52673.670822] usbcore: registered new interface driver cp210x
[52673.670904] usbserial: USB Serial support registered for cp210x
[52673.671000] cp210x 1-2:1.0: cp210x converter detected
[52673.676550] usb 1-2: cp210x converter now attached to ttyUSB0
$ sudo lsusb
Bus 001 Device 006: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light
Getting info about flash size/manufacturer info
$ esptool.py -p /dev/ttyUSB0 flash_id
esptool.py v2.5.1
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 80:7d:XX:XX:XX:XX
Uploading stub...
Running stub...
Stub running...
Manufacturer: 20
Device: 4016
Detected flash size: 4MB
Hard resetting via RTS pin...
The SPI Flash information, according to the flashchips.h source code the device SPI Flash chip is one of the following:
#define GIGADEVICE_GD25Q32 0x4016 /* Same as GD25Q32B */
#define SPANSION_S25FL132K 0x4016
#define WINBOND_NEX_W25Q32_V 0x4016 /* W25Q32BV; W25Q32FV in SPI mode (default) */
#define AMIC_A25LQ032 0x4016 /* Same as A25LQ32A, but the latter supports SFDP */
#define ESMT_F25L32QA 0x4016
It could be winbond? Until I can remove the Metal RF Shielding I will not know the chip’s manufacturer.
32Megabit = 4 MegaByte
After plugging the device in, the board LEDs started to blink. There are two Blue LED, the first one is near the ESP8266 module and the other near the CP2102 Chip and I detected an Access Point with the name:
I do not know how to use it, opening picocom or minicom does not help. So, I decided to flash my firmware for the ESP_WNATS (it worked!) and the Micropython
Flashing the latest micropython:
Needs the esptool for GNU+Linux
Download the latest miropython bin file, select the latest one and stable for 1MB (1024 KB) board:
Erase the flash:
$ esptool.py --port /dev/ttyUSB0 erase_flash
esptool.py v2.5.1
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 80:7d:XX:XX:XX:XX
Uploading stub...
Running stub...
Stub running...
Erasing flash (this may take a while)...
Chip erase completed successfully in 7.8s
Hard resetting via RTS pin...
Flashing the micropython to our device:
$ sudo esptool.py --port /dev/ttyUSB0 write_flash -fs 4MB -ff 80m -fm dio 0 ./esp8266-20180511-v1.9.4.bin
esptool.py v2.5.1
Serial port /dev/ttyUSB0
Connecting....
Detecting chip type... ESP8266
Chip is ESP8266EX
Features: WiFi
MAC: 80:7d:XX:XX:XX:XX
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Flash params set to 0x024f
Compressed 604872 bytes to 394894...
Wrote 604872 bytes (394894 compressed) at 0x00000000 in 35.8 seconds (effective 135.3 kbit/s)...
Hash of data verified.
Leaving...
Hard resetting via RTS pin...
The nodemcu devkit now is broadcasting with the AP name:
MicroPython-dea123
The default password is:
micropythoN
REPL stands for Read Evaluate Print Loop, and is the name given to the interactive MicroPython prompt that you can access on the ESP8266, If you used Python before it is just like the interactive Command Line interface on the desktop.
There are two ways to access the REPL: either via a wired connection through the UART serial port, or via WiFi.
The Nodemcu devkit has a CP2102 UART to USB, so you can access the REPL easily by using the picocom or minicom.
Starting picocom and communicating with our device:
$ sudo picocom /dev/ttyUSB0 -b 115200
Check firmware status:
>>> import esp
>>> esp.check_fw()
size: 604856
md5: 53b9852a38ac9f9e27694b3123fd1420
True
You can also access it also using WiFi, if you do not want to host your own WebREPL client you can use: http://micropython.org/webrepl/
But I prefer to host my own for security and privacy reasons:
Install a git and web server in your GNU+Linux like lighttpd.
Clone the git repo for the webrepl: https://github.com/micropython/webrepl
Move the webrepl directory to your web server directory, set permissions and enjoy.
$ sudo apt install git lighttpd
$ git clone https://github.com/micropython/webrepl
$ sudo mv webrepl /var/www/
$ sudo chown -R www-data:www-data /var/www/webrepl
Test: http://localhost/webrepl/webrepl.html
Configure the WebREPL server using Serial and set a password:
>>> import webrepl_setup
WebREPL daemon auto-start status: disabled
Would you like to (E)nable or (D)isable it running on boot?
(Empty line to quit)
> E
To enable WebREPL, you must set password for it
New password (4-9 chars): minda
Confirm password: minda
Changes will be activated after reboot
Would you like to reboot now? (y/n) y
The default IP address for the micropython is 192.168.4.1.
To access the webrepl server (nodemcu) just type in to the address ws://192.168.4.1:8266
Click connect and type your commands!
Serial output and WebREPL output are echoed
GPIO2 LED Turning On and Off
>>> import machine
pin = machine.Pin(2)
pin = machine.Pin(2, machine.Pin.OUT)
pin.off()
pin.on()
GPIO16 LED Turning On and Off
>>> import machine
pin = machine.Pin(16)
pin = machine.Pin(16, machine.Pin.OUT)
pin.off()
pin.on()
References:
https://docs.micropython.org/en/latest/esp8266/tutorial/repl.html
Except where otherwise noted, this work is licensed under Creative Commons Attribution-ShareAlike 4.0 International License (http://creativecommons.org/licenses/by-sa/4.0/).
I hope that this post is useful to you, if you liked this post you may support me via Patreon or liberapay. Thank you for your support.