Giter VIP home page Giter VIP logo

esp-domotics's Introduction

ESP Domotics

Domotics with an esp8266

Table of Contents

  1. Connect
  2. Flash firmware
  3. Communication
  4. Test
  5. Upload scripts

Connect to the esp8266

find usb serial device with lsusb. Bus 004 Device 010: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port

sudo modprobe usbserial vendor=0x067b product=0x2303

Connect esp to USB to serial

VCC -> 3.3v
GND -> GND
Rx -> Tx
Tx -> Rx

For flasing mode connect also

GPIO0 -> GND
CH_PD -> 3.3v

You should now see that it is now showing as attached by running dmesg.

[11357.143838] usbserial: USB Serial support registered for pl2303
[11357.143891] pl2303 4-1.2:1.0: pl2303 converter detected
[11357.146034] usb 4-1.2: pl2303 converter now attached to ttyUSB0

Flash firmware

Recourse: https://nodemcu.readthedocs.io/en/release/getting-started/

Build the nodemcu firmware with site or with docker image

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

Change the modules in nodemcu-firmware/app/include/user_modules.h Enable bme280, bme280_math, file, GPIO, I2C, mqtt, net, node, ow, tmr, uart, wifi. Build the firmware

cd nodemcu-firmware
docker run --rm -ti -v `pwd`:/opt/nodemcu-firmware marcelstoer/nodemcu-build build

install flash tooling

sudo pip3 install esptool

flash firmware

sudo python3 -m esptool --trace --port /dev/ttyUSB0 --baud 115200 write_flash 0x00000 nodemcu-firmware/bin/nodemcu_float_release_20210105-1953.bin

Problems

when problems with flashing, try connecting, this works when your esp device keeps listening to serial and isn't ready to receive new firmware.

GPIO 0 -> GND
RST -> 3.3v

try format, remove extra wires and monitor with gtkterm

sudo python3 -m esptool erase_flash

Communicate to the ESP

using gtkterm for serial communication

sudo gtkterm --port /dev/ttyUSB0 --speed 115200

Test NodeMCU

write hello world or something to test it.

file.format()
file.open("init.lua", "w")
file.writeline([[print("init lua node")]])
file.close()

node.restart()

Upload scripts

install tool to upload files to the esp

npm install nodemcu-tool -g

upload the script to the esp

nodemcu-tool upload --port=/dev/ttyUSB0 init.lua

after uploading restart the esp. Connect with serial terminal and execute the command

node.restart()

scripts that use wifi import a credentials.lue. This contains the SSID and password

Secrets in lua scripts

-- Network Credentials
ssid=<insert SSID>
pass=<insert password>

esp-domotics's People

Contributors

mrlauy avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.