diy/esp8266

esp-12 gpio핀 정리

do121 2023. 11. 13. 11:02

https://randomnerdtutorials.com/esp8266-pinout-reference-gpios/

 

ESP8266 Pinout Reference: Which GPIO pins should you use? | Random Nerd Tutorials

The ESP8266 comes with 33 GPIOs with multiple functions. This article is a simple and easy to follow reference guide for the ESP8266 NodeMCU GPIOs.

randomnerdtutorials.com

esp-01류만 사용하다 사용가능한 핀도 2개 뿐이고 ap 모드에서 접속도 잘안되고 해서 sta 모드만 사용하거나 간단한 기능구현 할때 외에는 esp-12를 사용하려고 알아보던 중 gpio핀에 대해 정리된게 있어 스크랩을 남게 본다

Label GPIO Input Output Notes
D0 GPIO16 no interrupt no PWM or I2C support HIGH at boot
used to wake up from deep sleep
D1 GPIO5 OK OK often used as SCL (I2C)
D2 GPIO4 OK OK often used as SDA (I2C)
D3 GPIO0 pulled up OK connected to FLASH button, boot fails if pulled LOW
D4 GPIO2 pulled up OK HIGH at boot
connected to on-board LED, boot fails if pulled LOW
D5 GPIO14 OK OK SPI (SCLK)
D6 GPIO12 OK OK SPI (MISO)
D7 GPIO13 OK OK SPI (MOSI)
D8 GPIO15 pulled to GND OK SPI (CS)
Boot fails if pulled HIGH
RX GPIO3 OK RX pin HIGH at boot
TX GPIO1 TX pin OK HIGH at boot
debug output at boot, boot fails if pulled LOW
A0 ADC0 Analog Input X

 

결론적으로 사용하기 용이한 핀은 gpio 4, 5 , 12, 13, 14임

 

아래 핀은 부팅시에 high나 low 상태이어야 한다.

  • GPIO16: pin is high at BOOT
  • GPIO0: boot failure if pulled LOW
  • GPIO2: pin is high on BOOT, boot failure if pulled LOW
  • GPIO15: boot failure if pulled HIGH
  • GPIO3: pin is high at BOOT
  • GPIO1: pin is high at BOOT, boot failure if pulled LOW
  • GPIO10: pin is high at BOOT
  • GPIO9: pin is high at BOOT

 그리고 아래 핀은 부팅시에 high가 항상 출력되어 릴에이 같은 부품과 사용시 조심해야한다.

  • GPIO16
  • GPIO3
  • GPIO1
  • GPIO10
  • GPIO9

 

부팅 후 각핀의 상태

GPIO 0 State: High
GPIO 1 State: Low
GPIO 2 State: High
GPIO 3 State: Low
GPIO 4 State: High
GPIO 5 State: High
GPIO 6 State: Low
GPIO 7 State: Low
GPIO 8 State: Low
GPIO 9 State: Low
GPIO 10 State: Low
GPIO 11 State: Low
GPIO 12 State: High
GPIO 13 State: Low
GPIO 14 State: High
GPIO 15 State: Low
GPIO 16 State: High