motine / esp

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MoHA - Motine Home Automation

This project is not for the public. It is not fully documented yet. The goal is to just to play around a little with the ESP and check out how easy it is to use it for home automation.

Getting started

# useful commands
nodemcu-tool terminal # now reset the device and see what comes up
nodemcu-tool upload --run file.lua
nodemcu-tool upload -k *.lua
nodemcu-tool reset && sleep 0.1

ESP 8266 - Initial setup

derived from this article. Check this the NodeMCU Getting Started Guide for more info.

Install Device

  1. Install the driver for Mac from here
  2. Plug in the device, then ls /dev should include something like: tty.usbserial-0001 and tty.SLAB_USBtoUART

Flash NodeMCU

  1. Goto nodemcu-build.com and build an image and save it to downloads folder (select LFS size 64KB)1
  2. Install esptool via pip3 install esptool (install pip via brew install python)2
  3. Flash: esptool.py erase_flash then esptool.py --port /dev/cu.SLAB_USBtoUART --baud 115200 write_flash -fm qio 0x00000 nodemcu-master-15-modules-2020-01-03-19-24-21-integer.bin

Upload code

  1. Install NodeMCU-Tool: npm install nodemcu-tool -g
  2. Download test script wget https://raw.githubusercontent.com/AndiDittrich/NodeMCU-Tool/master/helloworld.lua
  3. Upload test code nodemcu-tool --port=/dev/cu.SLAB_USBtoUART upload helloworld.lua
  4. Run test code nodemcu-tool --port=/dev/cu.SLAB_USBtoUART run helloworld.lua

ESP 32 - Initial setup

The setup is very similar to the ESP 8266...

Build the image

Follow this tutorial.

git clone --branch dev-esp32 --recurse-submodules https://github.com/nodemcu/nodemcu-firmware.git nodemcu-firmware-esp32

Follow these instructions

docker run --rm -ti -v (pwd):/opt/nodemcu-firmware:delegated marcelstoer/nodemcu-build configure-esp32
# select NodeMCU modules (e.g. JSON & Touch)
docker run --rm -ti -v (pwd):/opt/nodemcu-firmware:delegated marcelstoer/nodemcu-build build

Then flash:

esptool.py --port /dev/cu.SLAB_USBtoUART --baud 115200 erase_flash
esptool.py --port /dev/cu.SLAB_USBtoUART --baud 115200 write_flash -fm dio 0x0000 nodemcu_dev-esp32_20200105-1946.bin
# you may have to press the boot button

Footnotes

  1. Alternatively to building your own image you can download the latest release from github/nodemcu-firmware and then build it using docker like here.

  2. Alternatively to using esptool, you can download the nodemcu flasher from nodemcu-pyflasher

About


Languages

Language:Lua 49.3%Language:C++ 19.3%Language:JavaScript 13.0%Language:HTML 11.1%Language:CSS 7.4%