Giter Club home page Giter Club logo

fishy-wifi's Introduction

Scripts, notes and the odd fish for the ESP8266

Hamish Cunningham, Gareth Coleman, Caolan McMahon and Crowds.Work

A small corner of The Commons

("Tragedy?!" That was bad science!)

Note: the Lua code uses NodeMCU. This is a great firmware for the ESP8266, but sometimes struggles with the resource constraints of the device. It is also quite a lot of work to port existing Arduino code for the sensors etc. that we're using over to Lua. So the new stuff now uses the ESP Arduino IDE (forum).

This is all AGPL 3. Like it or lump it :-)

## Developing on the ESP8266 with NodeMCU
  • check out this tree including its submodules (third-party dependencies)
  • the Makefile assumes you've either checked out and rebuilt the open source SDK (see below), or -- if you're on 64 bit Linux -- you're using the local copy in ./esp8266-local-sdk
  • there are targets for
    • rebuilding the NodeMCU firmware (inc. with or without a DNS server)
      • make nodemcu[-with-dns]
    • flashing the firmware (inc. to several choices of board)
      • pull the relevant ESP pin low; cycle chip enable (or do a hard reset; the Olimex board always seems to require a hard reset) -- see below
      • make flashnodemcu (for e.g. the ESP01 or other board with small flash)
      • make flasholimex (for e.g. the Olimex, 2MB flash)
      • disconnect the flashing pin and cycle chip enable (or hard reset) again
  • running the ESPlorer development tool
    • to pick up a set of useful code snippets, run make seed-esplorer-prefs
    • to run ESPlorer make esplorer
    • then do a scan, port open, etc.
  • uploading Lua code and experimenting
    • have a poke around in e.g. the JoinMe code (below)
    • open the .lua files in ESPlorer and save them to the ESP
    • restart the board and off you go (details here)
  • running the MQTT Spy tool: make mqtt-spy

If you're using a breadboard from me with a DIP switch, you can fiddle with the flashing pin and chip enable via that switch:

Olimex breadboard with switch

Flashing is enabled by setting switch 1 to on; chip enable is switch 5.

How to...

(Note: some of these are superseded by the above...)

Build open source toolchain:

  • instructions from http://nathan.chantrell.net/20141230/wifi-mqtt-display-with-the-esp8266/
  • sudo apt-get install make unrar autoconf automake libtool gcc g++ gperf flex bison texinfo gawk ncurses-dev libexpat-dev python python-serial sed
  • cd esp-open-sdk
  • make STANDALONE=n
    • Xtensa toolchain is built, to use it:
    • export PATH=${HOME}/fishy-wifi/esp8266-local-sdk/esp-open-sdk/xtensa-lx106-elf/bin:$PATH
    • TODO is this nesc?
      • Espressif ESP8266 SDK is installed. Toolchain contains only Open Source components To link external proprietary libraries add:
      • xtensa-lx106-elf-gcc -I${HOME}/fishy-wifi/esp8266-local-sdk/esp-open-sdk/sdk/include -L${HOME}/fishy-wifi/esp8266-local-sdk/esp-open-sdk/sdk/lib`

Rebuild NodeMCU:

cd nodemcu-firmware
PATH=${PATH}:${HOME}/fishy-wifi/esp8266-local-sdk/esp-open-sdk/xtensa-lx106-elf/bin make

Flash the firmware to the ESP8266:

cd app
make flashnodemcu

or, for the Olimex board:

make flasholimex

Older methods:

.../esptool.py --port /dev/ttyAMA0 write_flash 0x00000
  ../bin/0x00000.bin 0x10000 ../bin/0x10000.bin 0x7E000 ../bin/blank.bin
  0x7C000 ../bin/esp_init_data_default.bin
.../esptool.py --port /dev/ttyAMA0 write_flash 0x00000 ../nodemcu_512k_latest.bin

Rebuild ESPlorer:

ant -Dplatforms.JDK1.7.home=/usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/ jar

Connect via picocom:

(first disable getty on /dev/ttyAMA0 via /etc/inittab)
picocom /dev/ttyAMA0 --omap crcrlf
(then toggle DTR to get elua prompt)

Picocom commands:

^A plus...
^T toggle DTR line
^U baud rate up (^D for down)

Wiring the ESP01 breadboard:

  • red vcc
  • black module gnd
  • brown module rx
  • gpio0
  • black gnd
  • white tx

Wiring the Olimex board:

  • gpio 1 & 3 are rxt and txt
  • need gpio 15 low and cp_en high
  • to flash hold gpio0 low -- sometimes I think it doesn't float high so might try using 4.7k resistor to connect it to high?
  • to get normal mode after flashing perhaps most useful

Luatool filetransfer thingy:

${HOME}/fishy-wifi/esp8266-local-sdk/luatool/luatool/luatool.py -p /dev/ttyAMA0 -f init.lua -t init.lua -v

Resources

fishy-wifi's People

Contributors

hamishcunningham avatar layerzerolabs avatar z-0 avatar tr1nt avatar charlynebzt avatar drrob avatar aeprox avatar

Watchers

James Cloos avatar  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.