THIS PACKAGE IS CURRENTLY UNDER DEVOLOPMENT AND TO BE CONSIDERED ALPHA
NodeMCU Thingy is an atom package for "over the air" development on the NodeMCU platform. It uses a websocket connection to the esp8266 for communication, so in an ideal world the USB cable should be needed only to upload the basic firmware and the initial websocket server to the NodeMCU.
Get the firmware
Flash your esp8266 with a current NodeMCU firmware. I recommend using a firmware built with Marcel Stoer's excellent online tool at https://nodemcu-build.com/
master and at least the following 9 modules:
crypto are not selected by default.
This creates two versions of the firmware: integer and float. If you do not know which one to use, the integer version is probably ok for you.
Flash the firmware
esptool.py from https://github.com/espressif/esptool.
Flash the firmware to the esp8266 with (use the appropriate
esptool.py --port /dev/ttyUSB0 erase_flash esptool.py --port /dev/ttyUSB0 write_flash -fm dio 0x00000 nodemcu-master*.bin
which should produce an output like:
esptool.py v1.3-dev Connecting... Running Cesanta flasher stub... Erasing flash (this may take a while)... Erase took 6.6 seconds esptool.py v1.3-dev Connecting... Auto-detected Flash size: 32m Running Cesanta flasher stub... Flash params set to 0x0240 Writing 401408 @ 0x0... 401408 (100 %) Wrote 401408 bytes at 0x0 in 34.8 seconds (92.3 kbit/s)... Leaving...
Give it a few seconds to reboot.
Install websocket server
init.lua to match your wireless LAN.
station_cfg.ssid="your ssid" station_cfg.pwd="yout wifi password" wifi.sta.sethostname("your hostname for the esp8266")
upload.sh and check if the
--port value matches your system and execute
This takes some time and you should see a lot of lines like
->file.writeline([==[end]==]) -> ok
->file.flush() -> ok ->file.close() -> ok --->>> All done <<<---
Restart the esp8266 by pressing the
RST button on the esp8266.
After a few seconds you should be able to ping the esp8266 using the value from
Configure package nodemcu-thingy
Open Atom's preferences screen (
Packages. Find package
nodemcu-thingy and click
Enter the ip address or hostname of your esp8266 (value from
wifi.sta.sethostname()) into the
Activate the package with
If everything worked the red
Disconnected changes to a green
Connected after a few seconds.
You are now good to go. Very brave programmers can now unhook the usb cable from the computer and run the esp8266 on some other power source (probably a phone charger).
Use package nodemcu-thingy
You can upload, download, erase files on the esp8266.
The installation process has installed 3 files on the esp8266 which are protected from modification by this package:
websocket.lcimplements the websocket protocol
main.lcimplements the server side functions for this package
init.luacalled by the NodeMCU firmware on startup.
(The original implementation of these 3 files is borrowed from nodemcu-webide)
To implement your own functionality upload a custom
userinit.lua to start your own custom code.
See https://nodemcu.readthedocs.io/en/master/ for the all the good stuff you can use...
The Websocket server on the NodeMCU is a slightly modified version of the one in Creationix's nodemcu-webide
Good catch. Let us know what about this package looks wrong to you, and we'll investigate right away.