MCU
ESP32 DevKit V1(ESP-WROOM-32)
IDE
VSC + ESP-IDF
목표
ESP32 DevKit V1의 LED를 ON-OFF

 

1. ESP-IDF

View - Command Palette

 

blink - Create project using example blink

 

LED GPIO 설정

#define BLINK_GPIO 2
 

 

flash method - UART

 

serial port - COM3

 

Build - 에러남

 

다음과 같이 c_cpp_properties.json를 수정

{
    "configurations": [
        {
            "name": "ESP-IDF",
            "compilerPath": "E:\\WORK\\P_ESP32\\.espressif\\tools\\xtensa-esp32-elf\\esp-12.2.0_20230208\\xtensa-esp32-elf\\bin\\xtensa-esp32-elf-gcc.exe",
            "cStandard": "c11",
            "cppStandard": "c++17",
            "includePath": [
                "${config:idf.espIdfPath}/components/**",
                "${config:idf.espIdfPathWin}/components/**",
                "${config:idf.espAdfPath}/components/**",
                "${config:idf.espAdfPathWin}/components/**",
                "${workspaceFolder}/**"
            ],
            "browse": {
                "path": [
                    "${config:idf.espIdfPath}/components",
                    "${config:idf.espIdfPathWin}/components",
                    "${config:idf.espAdfPath}/components/**",
                    "${config:idf.espAdfPathWin}/components/**",
                    "${workspaceFolder}"
                ],
                "limitSymbolsToIncludedHeaders": false
            },
            "configurationProvider": "ms-vscode.cmake-tools",
            "compileCommands": "${workspaceFolder}/build/compile_commands.json"
        }
    ],
    "version": 4
}
 

 

Build - 에러 없어짐

 

Flash

 

 

 

1. ESP-IDF 설치

: Visual Studio Code가 설치 되어 있어야 한다.(이하 VSC)

: VSC에서 esp-idf를 검색하여 install

 

esp-idf install 후에 실제 IDE를 다운로드 하여 설치한다.

 

ESP-IDF version과 경로를 제대로 적지 않으면 설치가 안됨

 

 

MCU
ESP32 DevKit V1(ESP-WROOM-32)
IDE
Arduino IDE
목표
ESP32 DevKit V1의 Wifi 연결

 

1. Arduino IDE

Tools - Board - esp32 - ESP32 Dev module 선택

(이전 사용한 보드가 선택 되어져 있음)

2-1. HelloServer 예제 소스 불러오기

File - Examples - WebServer - HelloServer 선택

 

2-2. 코드 수정

※ PC와 ESP32는 같은 wifi를 사용해야 함

ssid : Wifi Name

password : Wifi Password

제어할 LED Port

#include <WiFi.h>
#include <WiFiClient.h>
#include <WebServer.h>
#include <ESPmDNS.h>

const char* ssid = "WifiName";
const char* password = "WifiPassword";

WebServer server(80);

const int led = 2;
 

기본 예제는 / 페이지만 존재

/LEDON 및 /LEDOFF 페이지를 추가

void setup(void) {
  pinMode(led, OUTPUT);
  digitalWrite(led, 0);
  Serial.begin(115200);
  WiFi.mode(WIFI_STA);
  WiFi.begin(ssid, password);
  Serial.println("");

  // Wait for connection
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());

  if (MDNS.begin("esp32")) {
    Serial.println("MDNS responder started");
  }

  server.on("/", handleRoot);

  server.on("/inline", []() {
    server.send(200, "text/plain", "this works as well");
  });

  server.on("/LEDON", []() {

    server.send(200, "text/plain", "LED ON");

    digitalWrite(led, 1);

    Serial.println("LED ON");

  });

  server.on("/LEDOFF", []() {

    server.send(200, "text/plain", "LED OFF");

    digitalWrite(led, 0);

    Serial.println("LED OFF");

  });

  server.onNotFound(handleNotFound);

  server.begin();
  Serial.println("HTTP server started");
}
 

 

2-3. 우측 상단 돋보기 모양의 Serial Monitor 클릭

 

2-4. Baudrate 확인

 

2-5. Compile 및 Upload​

Sketch - Verify/Compile

 

3-1. IP 확인

 

3-2. 확인된 IP에 접속

 

3-3. 동작 확인(LED ON)

 

 

 

MCU
ESP32 DevKit V1(ESP-WROOM-32)
IDE
Arduino IDE
목표
ESP32 DevKit V1의 Bluethooth Serial 연결

 

1. Arduino IDE

Tools - Board - esp32 - ESP32 Dev module 선택

(이전 사용한 보드가 선택 되어져 있음)

 

2-1. SerialToSerialBT 예제 소스 불러오기

File - Examples - BluetoothSerisl - SerialToSerialBT 선택

 

2-2. Tools - Upload Speed "115200"으로 설정

2-3. 우측 상단 돋보기 모양의 Serial Monitor 클릭

 

2-4. Baudrate 확인

 

2-5. Compile 및 Upload

Sketch - Verify/Compile

 

3-1. 스마트폰에서 Bluetooth Terminal 다운로드 및 실행

 

3-2. 블루투스 설정에 들어가서 ESP32 연결

 

3-3. Bluetooth Terminal app으로 돌아가서 Device 연결

 

3-4. 데이터 송신(수신)

 

4. 데이터 수신(송신) 확인

 

 

MCU
ESP32 DevKit V1(ESP-WROOM-32)
IDE
Arduino IDE
목표
ESP32 DevKit V1으로 RGB LED Strip 구동

 

0. SK9822(SPI 방식 RGB LED)

- SK9822는 two-wire 전송 채널 3(RGB) 구동 지능형 제어 회로 및 조명

- 3가지 RGB 출력 제어, 8Bit(256) 색상, 밝기 조절을 위한 5Bit(32);

- 3개의 정전류 구동, 자체 감지 기능별 신호

- 최대 30MHZ 직렬 데이터 입력 주파수

 

1. Arduino IDE

Tools - Board - esp32 - ESP32 Dev module 선택

(이전 사용한 보드가 선택 되어져 있음)

 

2-1. APA102 라이브러리 설치

Sketch - Include Library - Manage Libraries

APA102 검색 - APA102 by Polulu 설치

 

2-2. Rainbow 예제 소스 불러오기

File - Examples - APA102 - Rainbow 선택

 

2-3. 코드 수정

ESP32 DEVKITV1의

- 12번에 data 연결

- 13번에 clock 연결

- LED 갯수가 10개

const uint8_t dataPin = 12;
const uint8_t clockPin = 13;

// Create an object for writing to the LED strip.
APA102<dataPin, clockPin> ledStrip;

// Set the number of LEDs to control.
const uint16_t ledCount = 10;
 

 

3. Compile 및 Upload

Sketch - Verify/Compile

4. 동작 확인

 

 

 

 
MCU
ESP32 DevKit V1(ESP-WROOM-32)
IDE
Arduino IDE
목표
ESP32 DevKit V1의 LED를 ON-OFF

 

0. ESP32 DevKit V1

- Espressif System 뿐만 아니라 ShenzenAV, DFRobot, LILYGO 등 많은 업체에서 ESP32를 이용하여 개발 보드를 만들어 판매함

- 여기서는 ESP32 DevKit V1(ShenzenAV)를 사용함

 

 

1. Arduino IDE

Tools - Board - esp32 - ESP32 Dev module 선택

 

COM 포트 선택

 

2-1. Blink 예제 소스 불러오기

File - Examples - 01.Basics - Blink 선택

 

2-2. 코드 수정

LED_BUILTIN이 define 되지 않았으므로, define 추가

#define LED_BUILTIN 2
 

 

3. Compile 및 Upload

Sketch - Verify/Compile

 

Sketch - Upload(Compile 과정 포함)

 

4. 동작 확인

 

 

 

1. 아두이노 IDE 설치

: 아래 링크에서 사용자 환경에 맞는 버전 다운로드 및 설치

 

2. 아두이노 IDE 실행

 

3. ESP32 Boards Manager 주소 설정

: 아래 링크에서 최신 버전 확인

 

File - Preferences

 

Additional boards manager URLs:

 

위에서 확인한 Boards Manager 최신 버전 주소 기입

4. ESP32 Boards Manager 설치

Tools - Board - Boards Manager - ESP32 설치(아래는 이미 설치된 사진)

 

5. ESP32 Boards 설정

Tools - Board - esp32 - ESP32 Dev module 선택하면 아래와 같이 보드 정보가 나옴

 

6. 시리얼 드라이버 다운로드

: 처음 사용시 아래 드라이버를 설치해야 하므로 아래 링크에서 사용자 환경에 맞는 드라이버 다운로드

 

 

찾아보기 - 다운로드 받은 폴더 지정

 

- 설치가 완료 되면 아래와 같이 확인 가능

 

- 장치 관리자에서 확인한 COM 포트를 아두이노 IDE에서 포트 설정

 

사용하기 위한 환경 설정 완료

 

 

1. ESP32

: ESPRESSIF의 ESP32는 저전력 마이크로컨트롤러(Microcontroller) 칩

- Wi-Fi와 Bluetooth 포함한 무선 통신 가능

- 다양한 주변장치 인터페이스를 포함. GPIO 및 I2C, SPI, UART 등의 통신 인터페이스 지원.

- ESP32는 ESP8266의 후속 모델로 더 강력한 성능과 더 많은 주변장치 인터페이스를 제공

- ESP32는 듀얼 코어(Two-core) 프로세서로 구성되어 있어 병렬 작업을 수행할 수 있으며, 주파수는 최대 240MHz까지 동작

- 저렴한 가격에 IoT를 구현할 수 있어서 인기가 많음

 

1-1. 제품군(Modules)

- ESP32 SoCs를 기반으로 플래시 메모리 등을 추가 하여 모듈을 만들어 판매함

- 대표적으로 ESP32-WROOM-32가 있음

https://www.espressif.com/en/products/modules

 

ESP Modules | Espressif Systems

Modules Espressif offers a wide range of fully-certified Wi-Fi & Bluetooth modules powered by our own advanced SoCs

www.espressif.com

 

(1) ESP32-S2 Modules

: 32-bit MCU & 2.4 GHz Wi-Fi

Board
Chip Embedded
Dimensions (mm)
Flash (MB)
PSRAM (MB)
Antenna
Development Board
ESP32-S2-MINI-2
ESP32-S2FH4
ESP32-S2FN4R2
15.4×20×2.4
4
N/A
2
PCB antenna
ESP32-S2-DevKitM-1
ESP32-S2-MINI-2U
ESP32-S2FH4
ESP32-S2FN4R2
15.4×15.4×2.4
4
N/A
2
IPEX antenna connector
ESP32-S2-DevKitM-1
ESP32-S2-SOLO-2
ESP32-S2
ESP32-S2R2
18x25.5x3.1
4
N/A
2
PCB antenna
ESP32-S2-DevKitC-1
ESP32-S2-SOLO-2U
ESP32-S2
ESP32-S2R2
18×19.2×3.2
4
N/A
2
IPEX antenna connector
ESP32-S2-DevKitC-1
ESP32-S2-MINI-1
ESP32-S2FH4
ESP32-S2FN4R2
15.4×20×2.4
4 MB embedded in chip
N/A
2
PCB antenna
ESP32-S2-DevKitM-1
ESP32-S2-SOLO
ESP32-S2ESP32-S2R2
18×25.5×3.1
4,8,16
N/A
2
IPEX antenna connector
ESP32-S2-DevKitM-1
ESP32-S2-SOLO-U
ESP32-S2
ESP32-S2R2
18×19.2×3.2
4,8,16
N/A
2
IPEX antenna connector
ESP32-S2-DevKitC-1
ESP32-S2-WROVER
ESP32-S2
18x31x3.3
4,8,16
2
PCB antenna
ESP32-S2-Kaluga-1
ESP32-S2-HMI-DevKit-1
ESP32-S2-Saola-1
ESP32-S2-WROVER-I
ESP32-S2
18x31x3.3
4,8,16
2
IPEX antenna connector
ESP32-S2-Saola-1
ESP32-S2-Kaluga-1
ESP32-S2-WROOM
ESP32-S2
18x31x3.3
4,8,16
N/A
PCB antenna
ESP32-S2-Saola-1
ESP32-S2-WROOM-I
ESP32-S2
18x31x3.3
4,8,16
N/A
IPEX antenna connector
ESP32-S2-Saola-1

 

(2) ESP32-S3 Modules

: 32-bit MCU & 2.4 GHz Wi-Fi & Bluetooth 5 (LE)

Board
Chip Embedded
Dimensions (mm)
Flash (MB)
PSRAM (MB)
Antenna
Development Board
ESP32-S3-WROOM-1
ESP32-S3
ESP32-S3R2
ESP32-S3R8
18×25.5×3.1
4, 8, 16
N/A
2
8
PCB antenna
ESP32-S3-DevKitC-1
ESP32-S3-BOX
ESP32-S3-EYE
ESP32-S3-Korvo-1
ESP32-S3-Korvo-2
ESP32-S3-LCD-Ev-Board
ESP32-S3-WROOM-1U
ESP32-S3
ESP32-S3R2
ESP32-S3R8
18×19.2×3.2
4, 8, 16
0
2
8
IPEX antenna connector
ESP32-S3-DevKitC-1
ESP32-S3-WROOM-2
ESP32-S3R8V
18×25.5×3.1
16, 32
8
PCB antenna
ESP32-S3-DevKitC-1
ESP32-S3-MINI-1
ESP32-S3FN8
ESP32-S3FH4R2
15.4×20.5×2.4
8 MB embedded in chip
N/A
PCB antenna
ESP32-S3-DevKitM-1ESP32-S3-USB-OTG
ESP32-S3-MINI-1U
ESP32-S3FN8ESP32-S3FH4R2
15.4×15.4×2.4
8 MB embedded in chip
N/A
IPEX antenna connector
ESP32-S3-DevKitM-1

 

(3) ESP32-C2 Modules

: 32-bit RISC-V MCU & 2.4 GHz Wi-Fi & Bluetooth 5 (LE)

Board
Chip Embedded
Dimensions (mm)
Flash (MB)
PSRAM (MB)
Antenna
Development Board
ESP8684-MINI-1
ESP8684H2
ESP8684H4
13.2×16.6×2.4
1, 2, 4
N/A
PCB antenna
ESP8684-DevKitM-1
ESP8684-MINI-1U
ESP8684H2
ESP8684H4
13.2×12.5×2.4
1, 2, 4
N/A
IPEX antenna connector
ESP8684-DevKitM-1
ESP8684-WROOM-01C
ESP8684H2
ESP8684H4
24×16×3.1
2, 4
N/A
PCB antenna
N/A
ESP8684-WROOM-02C
ESP8684H2
ESP8684H4
18x20x3.2
2, 4
N/A
PCB antenna
N/A
ESP8684-WROOM-02UC
ESP8684H2
ESP8684H4
18x20x3.2
2, 4
N/A
IPEX antenna connector
ESP8684-DevKitC-02
ESP8684-WROOM-03
ESP8684H2
ESP8684H4
15×17.3×2.8
2, 4
N/A
PCB antenna
N/A
ESP8684-WROOM-04C
ESP8684H2
ESP8684H4
24×16×3.1
2, 4
N/A
PCB antenna
N/A
ESP8684-WROOM-05
ESP8684H2
ESP8684H4
15×17.3×2.8
2, 4
N/A
PCB antenna
N/A
ESP8684-WROOM-06C
ESP8684H2
ESP8684H4
15.8×20.3×2.7
2, 4
N/A
PCB antenna
N/A
ESP8684-WROOM-07
ESP8684H2
ESP8684H4
8.5x12.7x1.9
2, 4
N/A
PCB antenna
N/A

 

(4) ESP32-C3 Modules

: 32-bit RISC-V MCU & 2.4 GHz Wi-Fi & Bluetooth 5 (LE)

 

(5) ESP32-C6 Modules

: 32-bit RISC-V MCU & 2.4 GHz Wi-Fi 6 & Bluetooth 5 (LE) & IEEE 802.15.4

Board
Chip Embedded
Dimensions (mm)
Flash (MB)
PSRAM (MB)
Antenna
Development Board
ESP32-C6-MINI-1
ESP32-C6FH4
13.2×16.6×2.4
4
N/A
PCB antenna
ESP32-C6-DevKitM-1
ESP32-C6-MINI-1U
ESP32-C6FH4
13.2×12.5×2.4
4
N/A
IPEX antenna connector
ESP32-C6-DevKitM-1
ESP32-C6-WROOM-1
ESP32-C6
18×25.5×3.2
4, 8, 16
N/A
PCB antenna
ESP32-C6-DevKitC-1
ESP32-C6-WROOM-1U
ESP32-C6
18x19.2x3.2
4, 8, 16
N/A
ESP32-C6-DevKitC-1
N/A

 

(6) ESP32-H2 Series

: 32-bit RISC-V MCU & Bluetooth 5 (LE) & IEEE 802.15.4

Board
Chip Embedded
Dimensions (mm)
Flash (MB)
PSRAM (MB)
Antenna
Development Board
ESP32-H2-MINI-1
ESP32-H2FH2
ESP32-H2FH4
13.2×16.6×2.4
1, 2, 4
N/A
PCB antenna
ESP32-H2-DevKitM-1
ESP32-H2-MINI-1U
ESP32-H2FH2
ESP32-H2FH4
13.2×12.5×2.4
2, 4
N/A
IPEX antenna connector
ESP32-H2-DevKitM-1

 

(7) ESP32 Modules

: 32-bit MCU & 2.4 GHz Wi-Fi & Bluetooth/Bluetooth LE

 

(8) ESP8266 Modules

: 32-bit MCU & 2.4 GHz Wi-Fi

 

 

1-2. 개발 보드(DevKits)

 

(1) ESP32-S2 Series

: 32-bit MCU & 2.4 GHz Wi-Fi

Board
Flash/PSRAM
Interfaces
UI
ESP32-S2-DevKitM-1
4 MB Flash
I/O
USB
Buttons
LEDs
ESP32-S2-DevKitC-1
4MB Flash, 8MB Flash
+ 2 MB PSRAM
I/O
USB
Buttons
LED
ESP32-S2-Kaluga-1
4 MB Flash
+ 2 MB PSRAM
SPI
I2C
I2S
UART
ADC
DAC
PWM
Buttons
LED
ESP32-S2-Saola-1
4 MB Flash / 4 MB Flash
+ 2 MB PSRAM
I/O
USB
Buttons
LED

 

(2) ESP32-S3 Series

: 32-bit MCU & 2.4 GHz Wi-Fi & Bluetooth 5 (LE)

Board
Flash/PSRAM
Interfaces
UI
ESP32-S3-DevKitC-1
8 MB Flash
8 MB Flash + 3.3V 2 MB Quad PSRAM
8 MB Flash + 3.3V 8 MB Octal PSRAM
32 MB Flash + 1.8V 8 MB Octal PSRAM
I/O
USB
Buttons
LEDs
ESP32-S3-DevKitM-1
8 MB Flash
I/O
USB
Buttons
LEDs
ESP32-S3-BOX
16 MB Flash
+ 8 MB PSRAM
USB-C
I/O
Pmod™ headers
LCD Screen
Microphones
Speaker
LED
Buttons
ESP32-S3-EYE
8 MB Flash
+ 8 MB PSRAM
USB
Camera
LCD
Microphone
Buttons
TF card
ESP32-S3-USB-OTG
8 MB Flash embedded in chip
USB Device
USB Host
SD Card
LCD Screen
LED
Button
ESP32-S3-Korvo-1
16 MB Flash
+ 8 MB PSRAM
I/O
USB
Buttons
TF card
LEDs
Microphones
ESP32-S3-Korvo-2
16 MB Flash
+ 8 MB PSRAM
I/O
USB
Button
TF Card
Camera
LCD
ESP32-S3-LCD-EV-Board
16 MB Flash
+ 8 MB PSRAM
I/O
USB-C
UART
LCD Screen
Microphones
Speaker
LED
Buttons

 

(3) ESP32-C2 Series

: 32-bit RISC-V MCU & 2.4 GHz Wi-Fi & Bluetooth LE 5 (LE)

Board
Flash/PSRAM
Interfaces
UI
ESP8684-DevKitM-1
4 MB Flash
I/O
USB
Buttons
LEDs

 

(4) ESP32-C3 Series

: 32-bit RISC-V MCU & 2.4 GHz Wi-Fi & Bluetooth LE 5 (LE)

Board
Flash/PSRAM
Interfaces
UI
ESP32-C3-DevKitM-1
4 MB Flash
I/O
USB
Buttons
LEDs
ESP32-C3-DevKitC-02
4 MB Flash
I/O
USB
Buttons
LEDs
ESP32-C3-DevKit-RUST-1
4 MB Flash
I/O
USB type-C
Button
LED
IMU
Temperature and humidity sensor
ESP32-C3-AWS-ExpressLink-DevKit
4 MB Flash
Pin Headers
Micro USB
Buttons
LEDs
ESP32-C3-LCDkit
4 MB Flash
I/O
USB type-C
LCD Screen
Speaker
LED
Buttons
EC11 rotary encoder
Infrared sensor
ESP32-C3-Lyra
4 MB Flash
I/O
UART
Key
RGB
Microphone
Speaker

 

(5) ESP32-C6 Series

: 32-bit RISC-V MCU & 2.4 GHz Wi-Fi 6 & Bluetooth 5 (LE) & IEEE 802.15.4

Board
Flash/PSRAM
Interfaces
UI
ESP32-C6-DevKitC-1
8 MB Flash
I/O
USB
Buttons
LEDs
ESP32-C6-DevKitM-1
4 MB Flash
I/O
USB
Buttons
LEDs

 

(6) ESP32-H Series

: 32-bit RISC-V MCU & Bluetooth 5 (LE) & IEEE 802.15.4

Board
Flash/PSRAM
Interfaces
UI
ESP32-H2-DevKitM-1
4 MB Flash
I/O
USB
Buttons
LEDs
ESP Thread Border Router/Zigbee Gateway
4 MB Flash and 2 MB PSRAM in ESP32-S3-WROOM-1 + 2 MB Flash in ESP32-H2-MINI-1
I/O
USB type-C
ESP32-S3-WROOM-1ESP32-H2-MINI-1

 

(7) ESP32 Series

: 32-bit MCU & 2.4 GHz Wi-Fi & BT/Bluetooth LE

 

(8) ESP8266 Series

: 32-bit MCU & 2.4 GHz Wi-Fi

 

 

1-3. 개발 환경

(1) Arduino IDE

: 아두이노 호환 보드처럼 사용 가능

 

(2) PlatformIO

: 여러 MCU 플랫폼을 지원하는 통합 개발 환경

 

(3) ESP IDF

: Espressif에서 제공하는 공식 개발 프레임워크

 

+ Recent posts