Skip to content

Latest commit

 

History

History
96 lines (65 loc) · 1.97 KB

README.md

File metadata and controls

96 lines (65 loc) · 1.97 KB

Using Micropython on ESP8266 Nodemcu v3 board

Tools

Useful Links

https://randomnerdtutorials.com/esp8266-pinout-reference-gpios/ https://docs.micropython.org/en/latest/esp8266/tutorial/intro.html https://www.digikey.ca/en/maker/projects/micropython-basics-load-files-run-code/fb1fcedaf11e4547943abfdd8ad825ce

Local Virtualenv

Using pyenv-virtualenv micropython: pyenv virtualenv activate micropython

pip install -r requirements.txt

Flash firmware

python -m esptool --port /dev/tty.usbserial-1430 erase_flash
python -m esptool --port /dev/tty.usbserial-1430 --baud 460800 write_flash --flash_size=detect 0 firmware/esp8266-20210902-v1.17.bin

Test live

ampy --port /dev/tty.usbserial-1430 run src/main.py

Upload file

Don't forget to remove pyc files!

find . | grep -E "(__pycache__|\.pyc|\.pyo$)" | xargs rm -rf
ampy --port /dev/tty.usbserial-1430 put src/wifi.py /wifi.py
ampy --port /dev/tty.usbserial-1430 put src/midicontroller /midicontroller
ampy --port /dev/tty.usbserial-1430 put banks_dir /banks_dir
ampy --port /dev/tty.usbserial-1430 put src/main.py /main.py

Connect to REPL

Using screen

screen /dev/tty.usbserial-1430 115200

exit with Ctrl-A; Ctrl-\

Using rshell

rshell -p /dev/tty.usbserial-1430

exit with Ctrl-D

from rshell

repl

exit with Ctrl-X

Free Flash Space

From REPL

import uos
fs_stat = uos.statvfs('/')
fs_size = fs_stat[0] * fs_stat[2]
fs_free = fs_stat[0] * fs_stat[3]
print("File System Size {:,} - Free Space {:,}".format(fs_size, fs_free))

Wiring Schema

R-Tx = 10 Ohm

R-V3.3 = 47 Ohm

diagram

Note: Connect 74HC165 to Pin D3 (GPIO0) make the board fail to boot.

External Libraries Used

https://github.com/adafruit/Adafruit_CircuitPython_MIDI

  • added __str__ to MIDIMessage, ProgramChange and ControlChange classes

https://github.com/dhylands/python_lcd