Jump to content

Uploading IoT Application From Command Line

From cognifront
Revision as of 09:27, 6 June 2025 by Pooja (talk | contribs) (Created page with "== Deploy NodeMCU (ESP8266) Code via Command Line == === Prerequisites === # Install Python: https://www.python.org/downloads # Install esptool: <code> pip install esptool </code> # Install Arduino IDE: https://www.arduino.cc/en/software # (Optional) Install USB-to-Serial Drivers: * CH340: https://sparks.gogo.co.nz/ch340.html * CP210x: https://www.silabs.com/developers/usb-to-uart-bridge-vcp-drivers === Step 1: Compile Code === # Open your sketch in Arduino IDE # Go to...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Deploy NodeMCU (ESP8266) Code via Command Line

Prerequisites

  1. Install Python: https://www.python.org/downloads
  2. Install esptool:

pip install esptool

  1. Install Arduino IDE: https://www.arduino.cc/en/software
  2. (Optional) Install USB-to-Serial Drivers:

Step 1: Compile Code

  1. Open your sketch in Arduino IDE
  2. Go to: Sketch → Export Compiled Binary
  3. Find the .bin file in your sketch folder (e.g., MySketch.ino.bin)

Step 2: Identify COM Port

  1. Plug in NodeMCU
  2. Open Command Prompt and run:

mode

  1. Note your device COM port (e.g., COM3)

Step 3: Flash Firmware

  1. Navigate to your compiled sketch folder:

cd "C:\Users\<YourName>\Documents\Arduino\MySketch"

  1. Flash the firmware:

python -m esptool --port COM3 --baud 115200 write_flash 0x00000 MySketch.ino.bin

Optional: Erase Flash Before Writing

python -m esptool --port COM3 erase_flash

Step 4: View Serial Monitor Output

  1. Install pyserial (if not already):

pip install pyserial

  1. View Serial Monitor:

python -m serial.tools.miniterm COM3 115200

  1. Press Ctrl + ] to exit

Notes

  • Ensure no other serial monitor (like Arduino IDE) is open when using miniterm.
  • Make sure baud rate matches your Serial.begin() setting.