Blinky with Arduino on ESP32-S3

dev board ESP32-S3-DevKitC-1
chip ESP32-S3-WROOM-1-N8R2
features blinky led serial esp32s3

Before starting

Dependancies

Ensure the following dependancies are downloaded and available:

Pre-requisites

Try these simpler or similar examples:

Code

Download code blinky-arduino-esp32s3.ino
#define LED LED_BUILTIN
// #define LED 5

void setup() {
  pinMode(LED, OUTPUT);
  digitalWrite(LED, LOW);

  Serial.begin(115200);
  Serial.println("Start blinky");
}

void loop() {
  ledON();
  delay(200);

  ledOFF();
  delay(200);
}

void ledON() {
  Serial.println("LED ON");
  digitalWrite(LED, LOW);
}

void ledOFF() {
  Serial.println("LED OFF");
  digitalWrite(LED, HIGH);
}

Makefile

BOARD?=esp32:esp32:esp32s3:CDCOnBoot=cdc
PORT?=/dev/cu.usbmodem14*
BUILD=build
## Pass in V=--verbose to output more information than default

.PHONY: help default lint compile upload clean

default: clean lint compile upload

help: ## Show help message
	@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n  make \033[36m\033[0m\n"} /^[$$()% 0-9a-zA-Z_-]+:.*?##/ { printf "  \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

lint: ## Lint code using cpplint
	cpplint --extensions=ino --filter=-legal/copyright *.ino

compile: ## Compile code and create the firmware binary
	arduino-cli compile $(V) --fqbn $(BOARD) --output-dir $(BUILD) ./

upload: ## Upload the firmware to the board
	arduino-cli upload $(V) --fqbn $(BOARD) --port $(PORT) --input-dir $(BUILD)

	# terminal command from Arduino IDE
	# "~/Library/Arduino15/packages/esp32/tools/esptool_py/4.2.1/esptool" --chip esp32s3 --port "/dev/cu.usbmodem14101" --baud 921600  --before default_reset --after hard_reset write_flash  -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x0 "/path/to/code/blinky-esp32s3.ino.bootloader.bin" 0x8000 "/path/to/code/blinky-esp32s3.ino.partitions.bin" 0xe000 "~/Library/Arduino15/packages/esp32/hardware/esp32/2.0.5/tools/partitions/boot_app0.bin" 0x10000 "/path/to/code/blinky-esp32s3.ino.bin"

	# terminal command from arduino-cli
	#  ~/Library/Arduino15/packages/esp32/tools/esptool_py/4.2.1/esptool" --chip esp32s3 --port "/dev/tty.usbmodem14101" --baud 921600  --before default_reset --after hard_reset write_flash  -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x0 "build/blinky-esp32s3.ino.bootloader.bin" 0x8000 "build/blinky-esp32s3.ino.partitions.bin" 0xe000 "~/Library/Arduino15/packages/esp32/hardware/esp32/2.0.5/tools/partitions/boot_app0.bin" 0x10000 "build/blinky-esp32s3.ino.bin


clean: ## Remove all built files
	rm -rf build

Prototype

A photo of the actual setup.

Blinky with Arduino on ESP32-S3 prototype

Schematic

Wire up the hardware accordingly

Blinky with Arduino on ESP32-S3 schematic

Arduino IDE settings

Ensure the following IDE settings before flashing.

Blinky with Arduino on ESP32-S3 Arduino IDE settings

Serial console

Serial output from the firmware.

Blinky with Arduino on ESP32-S3 serial console

Blinky with Arduino on ESP32-S3 browser

Use GPIO5 to add a simple external LED

Blinky with Arduino on ESP32-S3 browser

Use GPIO5 to add a simple external LED

Blinky with Arduino on ESP32-S3 browser

Change to the UART port to view the serial monitor

Blinky with Arduino on ESP32-S3 browser

Setup of using an external USB power with an UART-USB bridge to the computer

Blinky with Arduino on ESP32-S3 browser

Setup of using an external power supply with an UART-USB bridge to the computer

Blinky with Arduino on ESP32-S3 browser

Setup of using an external power supply with an UART-USB bridge to the computer

Description

LED

LED_BUILTIN is pin 48 as defined in the Arduino variant and schematic.

Alternatively #define LED 5 can be used as well to test a simpler LED.

Upload using USB port

  1. There are 2 ports on the board: USB and UART
  2. Plug into the USB port and check the addresses

     $ ls /dev/cu.*
    
     /dev/cu.Bluetooth-Incoming-Port  /dev/cu.usbmodem14101
    
  3. Upload using the USB port for example, /dev/cu.usbmodem14101 with USB CDC on Boot enabled or disabled:
    • disable if you want to access the serial monitor via the UART port or TX/RX with an external UART-to-USB bridge
    • enable if you want to access the serial monitor via the USB port

Access serial monitor using UART port

  1. Plug into the USB port.
  2. Compile and upload with USB CDC on Boot disabled.
  3. Unplug and plug into the UART port and check the address

     $ ls /dev/cu.*
    
     /dev/cu.Bluetooth-Incoming-Port  /dev/cu.SLAB_USBtoUART  /dev/cu.usbserial-1410
    
  4. Start the serial monitor in the port /dev/cu.usbserial-1410 when plugged into UART

Access serial monitor using an external UART-USB bridge

Use this option when using an external power supply for the board.

  1. Plug into the USB port of the board to the computer.
  2. Compile and upload with USB CDC on Boot disabled.
  3. Unplug from the USB port and into the power supply unit.
  4. Connect TX, RX and GND to an external USB-UART bridge connected to the computer.
  5. Plug into the UART port and check the address
     $ ls /dev/cu.*
    
     /dev/cu.Bluetooth-Incoming-Port  /dev/cu.SLAB_USBtoUART  /dev/cu.usbserial-1410
    
  6. Start the serial monitor in the port /dev/cu.usbserial-1410

Access serial monitor using USB port

  1. Plug into the USB port.
  2. Compile and upload with USB CDC on Boot enabled.
  3. Plug into the USB port
  4. Compile code with the menu item USB CDC on Boot Enabled on Arduino IDE
    • or on arduino-cli with --fqbn esp32:esp32:esp32s3:CDCOnBoot=cdc
  5. Using the same USB port, access the serial monitor

References