Package: cloudmanager-micropython-esp8266
Micropython ESP8266 Flash image with cloudmanagerThis package provides a utility to flash an esp8266 board such as a nodemcu  or
wemos d1 board with Micropython.  It will optionally configure networking and
set up the board to run cloudmanager or webrepl at start.RequirementsThis Utility requires python 3.6+ and is installed using the python pip package manager.Mac OSX requirementsOn Mac OSX you may need to install the device driver for the usb to serial converter chip
to interface with your board.For NodeMCU boards, you will need to install the SiLabs [serial driver for the chip](https://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx) ([direct link](https://www.silabs.com/Support%20Documents/Software/Mac_OSX_VCP_Driver.zip))For Wemos D1 boards, you will need to intall the [CH340 USB to UART driver](https://www.wemos.cc/downloads) ([direct link](https://www.wemos.cc/downloads/CH34x_Install_mac.zip))InstallationInstall the package using the python pip tool$pipinstallcloudmanager_micropython_esp8266Flashing a boardTheflash_esp_imageutility will flash a micropython image to the board and optionally configure it.To just flash the image to the board, if the are no other serial devices installedThis is the simplest option, the utility will attempt to guess the serial port the device is on and flash it.Plug the board into the usb portRun theflash_esp_imageutility without arguments.$flash_esp_imageesptool.py --port /dev/ttyUSB0 --baud 115200 erase_flash
esptool.py v1.2.1
Connecting...
Running Cesanta flasher stub...
Erasing flash (this may take a while)...
Erase took 9.1 seconds
esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash --verify --flash_size=32m --flash_mode=qio 0 /tmp/cloudmanager-micropython-esp8266/local/lib/python2.7/site-packages/cloudmanager_micropython_esp8266/firmware/firmware-combined.bin
esptool.py v1.2.1
Connecting...
Running Cesanta flasher stub...
Flash params set to 0x0040
Writing 557056 @ 0x0... 19456 (3 %)
557056 (100 %)
Wrote 557056 bytes at 0x0 in 48.3 seconds (92.3 kbit/s)...
Leaving...
Verifying just-written flash...
Verifying 0x8734c (553804) bytes @ 0x00000000 in flash against /tmp/cloudmanager-micropython-esp8266/local/lib/python2.7/site-packages/cloudmanager_micropython_esp8266/firmware/firmware-combined.bin...
-- verify OK (digest matched)$The board should now be flashed with micropython and the micropython repl prompt will be available on the serial port.Flash the board and configure it to automatically start as a cloudmanager clientPlug the board into the usb portRun theflash_esp_imageutility with the arguments to configure the network and cloudmanager.The following example starts a cloudmanager server on the default port and tells the board to connect to wifi network “mywifi” using wpa password of “wifipassword” and register with a cloudmanager server at our address “192.168.1.127” running on the default port of “18266” as a device named “nodemcu1”$mbmserver-start$mbmboard-list$flash_esp_image--wifi_ssidmywifi--wifi_passwordmywifipassword--cloudmanager_server192.168.1.127--cloudmanager_port18266--namenodemcu1esptool.py --port /dev/ttyUSB0 --baud 115200 erase_flash
esptool.py v1.2.1
Connecting...
Running Cesanta flasher stub...
Erasing flash (this may take a while)...
Erase took 9.0 seconds
esptool.py --port /dev/ttyUSB0 --baud 115200 write_flash --verify --flash_size=32m --flash_mode=qio 0 /tmp/cloudmanager-micropython-esp8266/local/lib/python2.7/site-packages/cloudmanager_micropython_esp8266/firmware/firmware-combined.bin
esptool.py v1.2.1
Connecting...
Running Cesanta flasher stub...
Flash params set to 0x0040
Writing 557056 @ 0x0... 557056 (100 %)
Wrote 557056 bytes at 0x0 in 48.3 seconds (92.3 kbit/s)...
Leaving...
Verifying just-written flash...
Verifying 0x8734c (553804) bytes @ 0x00000000 in flash against /tmp/cloudmanager-micropython-esp8266/local/lib/python2.7/site-packages/cloudmanager_micropython_esp8266/firmware/firmware-combined.bin...
-- verify OK (digest matched)
>>>
>>> import os
>>> os.mkdir('etc')
>>> from bootconfig.config import get, set
>>> set('wifi_ssid', 'mywifi')
>>> set('wifi_password', 'mywifipassword')
>>> set('redis_server', '192.168.1.127')
>>> set('redis_port', '18266')
>>> set('name', 'nodemcu1')
>>> import bootconfig.service
>>> bootconfig.service.autostart()
>>> import redis_cloudclient.service
>>> redis_cloudclient.service.autostart()
>>> import machine
>>> machine.reset()$mbmboard-listPlatform   Name                                               State
esp8266    nodemcu1                                           idle$It’s now possible to use thembmutility to upload/run code on the board.Connecting to the serial terminalTheesp_terminalcommand is a simple terminal program that will automatically connect the the micropython repl over usb/serial using the same device and port as theflash_esp_imageutility.$esp_terminalMicroPython v1.8.5-124-gbc4441a on 2016-11-06; ESP module with ESP8266
Type "help()" for more information.
>>>