6.S063 Engineering Interactive Technologies (fall 2017)

Tips for ESP8266 Microcontroller

General pipeline

Some general tips to make your life easier:

Mpfshell may be easier than using webrepl for uploading files. See the next section for more info.

Any Python saved as "main.py" on your board will automatically run when the board boots up. When developing, I recommend saving your files as something else, e.g. "foobar.py", and then running it manually in REPL: import foobar. This way, your "main.py" file won't prevent you from connecting to your board.

Use Ctrl+C or Cmd+C to break out of infinite loops and to stop the current process.

Uploading files to the chip via shell/terminal
The Python script mpfshell lets users run basic UNIX file commands on the chip. Some useful commands you can run with mpfshell:
  • li to view what's in the chip's file system.
  • rm to remove files.
  • put to upload files to the chip (relative from the directory you ran mpfshell).
  • get to download files from the chip.
  • repl to enter into Python REPL mode.
Alternatively, there is also Adafruit's ampy which lets you do many of the same things as mpfshell.
Multiple analog sensors

The microcontroller only has one analog pin.

If you want to work around this, you can use two digital output pins in place of the 3V pin to control which analog sensor gets powered at a time. Be careful not to short the circuit though, use a diode to isolate each analog sensor circuit from each other.

A more detailed tutorial can be found here.

Troubleshooting

The esptool we used has a Github with a troubleshooting section here.

There's also a forum for MicroPython, which may have some useful information.

As always, you can ask us for help on Piazza!