Skip to content

Scripts, notes and the odd subaquatic gizmo for the ESP8266 and what-have-you.

License

Notifications You must be signed in to change notification settings

DrRob/fishy-wifi

 
 

Repository files navigation

Scripts, notes and the odd fish for the ESP8266

Hamish Cunningham, Gareth Coleman, 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)
    • git clone --recursive git@github.com:hamishcunningham/fishy-wifi.git
  • 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

About

Scripts, notes and the odd subaquatic gizmo for the ESP8266 and what-have-you.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 70.1%
  • C 24.6%
  • Objective-C 2.4%
  • Python 1.1%
  • Lua 0.7%
  • Other 0.4%
  • Other 0.7%