메뉴 여닫기
개인 메뉴 토글
로그인하지 않음
만약 지금 편집한다면 당신의 IP 주소가 공개될 수 있습니다.

2x2 매크로 키보드 만들기: 두 판 사이의 차이

데브카페
 
(같은 사용자의 중간 판 8개는 보이지 않습니다)
5번째 줄: 5번째 줄:
# 1N4148 다이오드 (저항)
# 1N4148 다이오드 (저항)


=== ESP32 C3 칩 구성도 ===
=== ESP32 C3 칩 구성도 (gpio) ===
* 뒷면 ESP32-C3 Supermini     
* (뒷면) ESP32-C3 Supermini     
<SOURCE>
<SOURCE>
                     ┌─────────────┐
                     ┌─────────────┐
24번째 줄: 24번째 줄:


=== 납땜 ===
=== 납땜 ===
<source>
  ROW0 ── GPIO4
  ROW1 ── GPIO5
  COL0 ── GPIO6
  COL1 ── GPIO7
</source>
*  1N4148 다이오드 (검은 몸통에 흰 띠 있는 부분 = 캐소드)


<source>
        COL0                COL1
          │                  │
  SW1 ────┼──●              SW2──┼──●
          │  │                  │  │
        [D1]│(캐소드→ROW0)    [D2]│(캐소드→ROW0)
          │  │                  │  │
          └──┴───── ROW0 ────────┴──┘
         
  SW3 ────┼──●              SW4──┼──●
          │  │                  │  │
        [D3]│(캐소드→ROW1)    [D4]│(캐소드→ROW1)
          │  │                  │  │
          └──┴───── ROW1 ────────┴──┘
</source>


=== 펌웨어 플래싱 ===
=== 펌웨어 플래싱 ===
* ESP32-C3 + BLE HID (Arduino)
==== Arduino + BLE Keyboard 라이브러리 (추천) ====
* 가장 검증되고 쉬운 방법입니다.
# 준비물
#:- Arduino IDE 설치
#:- ESP32 보드 패키지 설치
#:- ESP32-BLE-Keyboard 라이브러리 (T-vK 제작)
# Arduino IDE 설정
#: Arduino IDE 설치 => https://www.arduino.cc/en/software/
#:<source>
파일 → 환경설정 → 추가 보드 매니저 URL에 입력:
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json


도구 → 보드 → 보드매니저 → "esp32" 검색 후 설치
도구 → 보드 → ESP32C3 Dev Module 선택
</source>
# 라이브러리 설치
#:<source> 스케치 → 라이브러리 포함하기 → 라이브러리 관리
검색: "ESP32 BLE Keyboard" (by T-vK) 설치
</source>
# 예제 (2x2 매크로패드)
#:<SOURCE LANG=C>
#include <BleKeyboard.h>
BleKeyboard bleKeyboard("Macro Pad", "DIY", 100);
// 행/열 핀 설정 (ESP32-C3 Supermini 기준 예시)
const int rowPins[2] = {4, 5};
const int colPins[2] = {6, 7};
void setup() {
  Serial.begin(115200);
  bleKeyboard.begin();
  for (int i = 0; i < 2; i++) {
    pinMode(rowPins[i], OUTPUT);
    digitalWrite(rowPins[i], HIGH);
  }
  for (int i = 0; i < 2; i++) {
    pinMode(colPins[i], INPUT_PULLUP);
  }
}
void loop() {
  if (bleKeyboard.isConnected()) {
    for (int r = 0; r < 2; r++) {
      digitalWrite(rowPins[r], LOW);
      for (int c = 0; c < 2; c++) {
        if (digitalRead(colPins[c]) == LOW) {
          handleKey(r, c);
          delay(200); // 디바운스
        }
      }
      digitalWrite(rowPins[r], HIGH);
    }
  }
}
void handleKey(int row, int col) {
  if (row == 0 && col == 0) bleKeyboard.write('1');
  if (row == 0 && col == 1) bleKeyboard.write('2');
  if (row == 1 && col == 0) bleKeyboard.write('3');
  if (row == 1 && col == 1) bleKeyboard.write('4');
}
</SOURCE>


=== 사용법 ===
=== 사용법 ===

2026년 8월 15일 (토) 00:40 기준 최신판

2x2 매크로 키보드 만들기

  • 준비물
  1. ESP32 C3 Supermini
  2. 1N4148 다이오드 (저항)

ESP32 C3 칩 구성도 (gpio)

  • (뒷면) ESP32-C3 Supermini
                    ┌─────────────┐
                    │   USB-C     │
                    └─────────────┘
                 ┌───────────────────┐
            5V ● │                   │ ● IO5
           GND ● │                   │ ● IO6
           3V3 ● │                   │ ● IO7
           IO4 ● │      ESP32-C3     │ ● IO8
           IO3 ● │                   │ ● IO9
           IO2 ● │                   │ ● I1O
           IO1 ● │                   │ ● I20
           IO0 ● │                   │ ● I21
                 └───────────────────┘

납땜

   ROW0 ── GPIO4
   ROW1 ── GPIO5
   COL0 ── GPIO6
   COL1 ── GPIO7
  • 1N4148 다이오드 (검은 몸통에 흰 띠 있는 부분 = 캐소드)
         COL0                COL1
          │                   │
  SW1 ────┼──●              SW2──┼──●
          │  │                   │  │
         [D1]│(캐소드→ROW0)     [D2]│(캐소드→ROW0)
          │  │                   │  │
          └──┴───── ROW0 ────────┴──┘
          
  SW3 ────┼──●              SW4──┼──●
          │  │                   │  │
         [D3]│(캐소드→ROW1)     [D4]│(캐소드→ROW1)
          │  │                   │  │
          └──┴───── ROW1 ────────┴──┘

펌웨어 플래싱

  • ESP32-C3 + BLE HID (Arduino)

Arduino + BLE Keyboard 라이브러리 (추천)

  • 가장 검증되고 쉬운 방법입니다.
  1. 준비물
    - Arduino IDE 설치
    - ESP32 보드 패키지 설치
    - ESP32-BLE-Keyboard 라이브러리 (T-vK 제작)
  2. Arduino IDE 설정
    Arduino IDE 설치 => https://www.arduino.cc/en/software/
    파일 → 환경설정 → 추가 보드 매니저 URL에 입력:
    https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
    
    도구 → 보드 → 보드매니저 → "esp32" 검색 후 설치
    도구 → 보드 → ESP32C3 Dev Module 선택
  3. 라이브러리 설치
     스케치 → 라이브러리 포함하기 → 라이브러리 관리
     검색: "ESP32 BLE Keyboard" (by T-vK) 설치
  4. 예제 (2x2 매크로패드)
    #include <BleKeyboard.h>
    
    BleKeyboard bleKeyboard("Macro Pad", "DIY", 100);
    
    // 행/열 핀 설정 (ESP32-C3 Supermini 기준 예시)
    const int rowPins[2] = {4, 5};
    const int colPins[2] = {6, 7};
    
    void setup() {
      Serial.begin(115200);
      bleKeyboard.begin();
    
      for (int i = 0; i < 2; i++) {
        pinMode(rowPins[i], OUTPUT);
        digitalWrite(rowPins[i], HIGH);
      }
      for (int i = 0; i < 2; i++) {
        pinMode(colPins[i], INPUT_PULLUP);
      }
    }
    
    void loop() {
      if (bleKeyboard.isConnected()) {
        for (int r = 0; r < 2; r++) {
          digitalWrite(rowPins[r], LOW);
          for (int c = 0; c < 2; c++) {
            if (digitalRead(colPins[c]) == LOW) {
              handleKey(r, c);
              delay(200); // 디바운스
            }
          }
          digitalWrite(rowPins[r], HIGH);
        }
      }
    }
    
    void handleKey(int row, int col) {
      if (row == 0 && col == 0) bleKeyboard.write('1');
      if (row == 0 && col == 1) bleKeyboard.write('2');
      if (row == 1 && col == 0) bleKeyboard.write('3');
      if (row == 1 && col == 1) bleKeyboard.write('4');
    }

사용법

Comments