ESP32 Pinout Reference
Complete ESP32 WROOM-32 pinout with GPIO, ADC, SPI, I2C, UART pins.
ข้อมูลอ้างอิง ESP32 pinout — GPIO, ADC, DAC, SPI, I2C และอื่น ๆ
ESP32 เป็น microcontroller module ที่มีประสิทธิภาพสูงสุดรายหนึ่งที่มีอยู่ในตลาด รวม dual-core processing (สูงสุด 240 MHz), WiFi ในตัว, Bluetooth 4.2 และ BLE, GPIO 34 pin, ADC 18 ช่อง, DAC 2 ช่อง, UART 3 ตัว, I2C 2 บัส, SPI 3 บัส และ capacitive touch sensing ทั้งหมดในราคาต่ำกว่า $5 ความยืดหยุ่นของมันทำให้เป็นตัวเลือกหลักสำหรับโปรเจกต์ IoT, home automation, wearable และอะไรก็ตามที่ต้องการการเชื่อมต่อไร้สาย เอกสาร pinout แบบ interactive นี้บันทึกฟังก์ชัน ข้อจำกัด และคำแนะนำการใช้งานที่ดีที่สุดของ GPIO pin ทุกตัว
GPIO pin สี่ตัวบน ESP32 เป็นแบบ input-only ได้แก่ GPIO 34, 35, 36 (VP) และ 39 (VN) Pin เหล่านี้ไม่มี pull-up หรือ pull-down resistor ภายในและไม่สามารถส่งสัญญาณ output ได้ ได้รับการปรับแต่งสำหรับการใช้งาน ADC และเชื่อมต่อกับ Hall effect sensor (GPIO 36 และ 39) และ temperature sensor ภายใน อย่าพยายามใช้เป็น digital output เด็ดขาด เนื่องจากจะไม่ทำงานและอาจทำให้การแก้ปัญหาวงจรสับสน
ADC2 ของ ESP32 (GPIO 0, 2, 4, 12, 13, 14, 15, 25, 26, 27) ไม่สามารถใช้งานได้ในขณะที่ WiFi ทำงานอยู่ เนื่องจาก WiFi radio ใช้ ADC2 ภายใน หากโปรเจกต์ของคุณใช้ทั้ง WiFi และ sensor แบบ analog ให้ใช้เฉพาะ ADC1 pin ได้แก่ GPIO 32, 33, 34, 35, 36, 39 ความแม่นยำของ ADC บน ESP32 ยังไม่เป็นเชิงเส้นที่ค่าสุดขั้ว (ต่ำกว่า 0.1 V และสูงกว่า 3.1 V บนแหล่งจ่ายไฟ 3.3V) ควรใช้การปรับเทียบ ADC ที่ติดตั้งมาหรือเพิ่ม op-amp buffer สำหรับการวัดที่ต้องการความแม่นยำสูง
GPIO pin หลายตัวของ ESP32 เป็น "strapping pin" ที่ชิปอ่านเมื่อบูตเพื่อกำหนดโหมดการทำงาน ได้แก่ GPIO 0 (boot mode), GPIO 2 (ต้องเป็น LOW สำหรับการดาวน์โหลด flash), GPIO 12 (การเลือกแรงดันไฟ flash) และ GPIO 15 (เปิดใช้งาน debug output) การดึง pin เหล่านี้ HIGH หรือ LOW เมื่อบูตอาจทำให้ ESP32 ไม่เริ่มทำงานอย่างถูกต้อง หลีกเลี่ยงการใช้ GPIO 0, 2, 12 และ 15 สำหรับ I/O ทั่วไปหากเป็นไปได้ หากจำเป็นต้องใช้ ให้แน่ใจว่า pull-up หรือ pull-down ภายนอกไม่ขัดแย้งกับข้อกำหนดเมื่อบูต
ESP32 มี capacitive touch pin 10 ตัว (T0–T9) บน GPIO 0, 2, 4, 12, 13, 14, 15, 27, 32, 33 Touch input ทำงานโดยวัดการเปลี่ยนแปลง capacitance เมื่อนิ้วเข้าใกล้ pin สามารถใช้สร้างปุ่มสัมผัส slider และ proximity sensor โดยไม่ต้องใช้ส่วนประกอบเพิ่มเติม ใช้ touchRead() ใน Arduino IDE หรือ esp_touch ใน ESP-IDF Touch sensing ไม่น่าเชื่อถือบน pin เดียวกันขณะใช้สำหรับ I2C หรือ SPI ควรใช้ GPIO เฉพาะสำหรับแต่ละฟังก์ชัน
คำถามที่พบบ่อย
- Which ESP32 pins are input-only?
- Pins GPIO 34, 35, 36 (VP) and 39 (VN) are input-only. They have no internal pull-up or pull-down resistors and cannot be used as outputs.
- Which pins should I avoid on ESP32?
- Avoid GPIO 6–11 (connected to internal SPI flash). GPIO 0, 2, 12, and 15 have boot-mode functions and must be in specific states during reset. Use them with caution.
- How many ADC channels does the ESP32 have?
- The ESP32 has two ADC units: ADC1 (GPIOs 32–39, usable while WiFi is active) and ADC2 (GPIOs 0,2,4,12–15,25–27, cannot be used while WiFi is active).
เครื่องมือที่เกี่ยวข้อง
- Resistor Color Code Calculator
Decode resistor color bands. Supports 4-band and 5-band.
- Ohm's Law Calculator
Calculate voltage, current, resistance, or power using Ohm's Law.
- Voltage Divider Calculator
Calculate output voltage for a resistor voltage divider.
- 555 Timer Calculator
Calculate frequency, duty cycle, and timing for 555 timer circuits.
- CRC Calculator
Calculate CRC checksums — CRC-8, CRC-16, CRC-32, and custom polynomials.