Skip to content

Instantly share code, notes, and snippets.

@bergie
Last active March 6, 2024 05:42
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bergie/0dcdf0730765602ccfb4cf3a61b92989 to your computer and use it in GitHub Desktop.
Save bergie/0dcdf0730765602ccfb4cf3a61b92989 to your computer and use it in GitHub Desktop.
Arduino CLI with ESP8266
  • Install Arduino IDE to /opt/arduino
  • Install PubSubClient and MsgFlo
  • Edit /opt/arduino/libraries/PubSubClient/src/PubSubClient.h and set a bigger buffer size (for example 512)
  • Add ESP8266 board URL:
/opt/arduino/arduino --pref "boardsmanager.additional.urls=http://arduino.esp8266.com/stable/package_esp8266com_index.json" --save-prefs
  • Install board package
/opt/arduino/arduino --install-boards esp8266:esp8266 --save-prefs
  • Fix build-flash linking:

    • Edit packages/esp8266/hardware/esp8266/2.3.0/platform.txt
    • Replace {build.flash_ld} with eagle.flash.4m.ld
  • Verify build: /opt/arduino/arduino -v --verify --board esp8266:esp8266:nodemcu --port /dev/ttyUSB0 sensor.ino

  • Upload build: /opt/arduino/arduino -v --upload --board esp8266:esp8266:nodemcu --port /dev/ttyUSB0 sensor.ino

See also Arduino CLI docs https://github.com/arduino/Arduino/blob/master/build/shared/manpage.adoc

./node_modules/.bin/nodemcu-tool -p /dev/ttyUSB0 -b 115200 terminal
@adi-g15
Copy link

adi-g15 commented Nov 30, 2022

For anyone looking, an updated gist to do this using arduino-cli is at: https://gist.github.com/adi-g15/de41e96079a5b63045e86dc7c8c5c87e.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment