Petoi Doc Center
🇹🇭 Thai
🇹🇭 Thai
  • ยินดีต้อนรับสู่ Petoi Doc Center
  • Infrared Remote
    • รีโมทคอนโทรล
  • Mobile App
    • คาลิเบเตอร์และคอนโทรลเลอร์
  • Desktop APP
    • การแนะนำเบื้องต้น
    • ตัวอัปโหลดเฟิร์มแวร์
    • การคาลิเบรทข้อต่อ
    • สกิลคอมโพสเซอร์
  • Arduino IDE
    • อัปโหลด Sketch สำหรับ NyBoard
    • อัปโหลด Sketch สำหรับ BiBoard
    • การคาลิเบรทด้วย Arduino IDE
    • ซีเรียลมอนิเตอร์
  • API
    • 🖇️ซีเรียลโปรโตคอล
    • 🐍คู่มือผู้ใช้ Python SerialMaster
    • 🐛MicroPython คอนโทรลเลอร์
      • การเรียกใช้ MicroPython บน ESP8266
      • ติดตั้ง WebREPL
      • การใช้โปรโตคอล ESP-NOW
    • 🍓การสื่อสารผ่านพอร์ตซีเรียลของ Raspberry Pi
    • 🤖ROS
  • Nyboard
    • NyBoard V1_0
    • NyBoard V1_1
  • BIBOARD
    • คู่มือเริ่มต้นใช้งาน BiBoard ฉบับรวบลัด
    • Demo Applications
      • 1.GPIO port
      • 2.Serial port
      • 3.Analog-digital converter
      • 4.Digital-Analog Converter
      • 5.EEPROM (Electrically Erasable Programmable read only memory)
      • 6.Gyro IMU(MPU6050)
      • 7.Infrared remote control
      • 8.PWM(Pulse Width Modulation)
      • 9.Servo(under construction)
      • 10.Classic Bluetooth serial port SPP
      • 11.Bluetooth low energy (BLE) serial port pass-through
      • 12.File system SPIFFS
      • 13.Add hardware partition configuration option in Arduino IDE
      • 14.Play MP3
      • 15.The usage of Wi-Fi OTA(Over-The-Air)
  • Communication Modules
    • Introduction
    • USB Uploader (CH340C or CH343G)
    • Dual Mode Bluetooth
    • WiFi ESP8266
      • ESP8266 + Python Scripts Implement wireless crowd control
  • Extensible Modules
    • Introduction
    • MU Camera
    • Ultrasonic Sensor
    • Light Sensor
    • Touch Sensor
    • Gesture Sensor
    • PIR Motion Sensor
  • Applications
    • Skill Creation
    • OpenCat Imitation Tutorial
    • Programmable Puppet Character
  • History
    • Upload Sketch For NyBoard (software 1.0)
  • Technical Support
    • 🛠️Supporting Application and Software
    • 🙋‍♂️FAQ(Frequently Asked Questions)
  • Useful Links 🕸
    • 🔭Official Site of Petoi
    • 💿GitHub of OpenCat
    • 🎪PetoiCamp (Forum)
Powered by GitBook
On this page

Was this helpful?

Export as PDF
  1. BIBOARD
  2. Demo Applications

3.Analog-digital converter

Application of ADC which is variable gain on BiBoard (ESP32)

คำสั่งแนะนำของ ADC บน BiBoard

พิน 34, 35, 36 และ 39 ของโมดูล ESP32 รองรับอินพุตเท่านั้น เรากำหนดค่าให้เป็นพอร์ตอินพุตแบบอะนาล็อกบน BiBoard ซึ่งทำให้สะดวกสำหรับนักพัฒนาในการเชื่อมต่อเซ็นเซอร์เท้า 4 ตัว

การใช้งานตัวแปลงสัญญาณอนาล็อกเป็นดิจิตอล (ADC) บน BiBoard นั้นเหมือนกับ Arduino UNO พื้นฐาน แต่ความแม่นยำนั้นสูงกว่า (12 บิต UNO คือ 10 บิต) และมีการเพิ่มตัวขยายสัญญาณที่ตั้งโปรแกรมได้เพื่อให้ ADC ทำงานในช่วงที่ดีที่สุด

เมื่อป้อนสัญญาณแรงดันไฟฟ้า 1V หากใช้การเข้าถึง 12 บิตตามการกำหนดค่าปกติ แรงดันอ้างอิงจะเท่ากับแรงดันแหล่งจ่ายไฟ (3.3V): เอาต์พุตที่สอดคล้องกันคือ 0~1241 ส่วนใหญ่ของช่วง ADC จะเสียเปล่า ทำให้ได้ข้อมูลที่ไม่ถูกต้อง เมื่อเรากำหนดค่าอัตราขยายที่ตั้งโปรแกรมได้ เราสามารถทำให้สัญญาณอินพุต 1V เติมเต็มช่วง ADC เกือบทั้งหมด และความแม่นยำและความละเอียดจะดีขึ้นอย่างมาก

การสาธิตนี้ใช้ 4 อินพุต กำหนดค่าตามลำดับเป็น: อัตราขยายเดซิเบล 0/2.5/6/11 ควรสังเกตว่าการกำหนดค่าเริ่มต้นของ ESP32 Arduino คืออัตราขยาย 11 เดซิเบล

เราใช้ "analogSetPinAttenuation(PIN_NAME, attenuation)" เพื่อกำหนดค่าอัตราขยายของพินอินพุตเดี่ยว หรือใช้ "analogSetAttenuation(attenuation)" เพื่อกำหนดค่าอัตราขยายของพินอินพุตแบบอะนาล็อกทั้งหมด

// Ain 34 - 0dB Gain - ADC_0db
analogSetPinAttenuation(34, ADC_0db);

// Ain 35 - 2.5dB Gain - ADC_2_5db
analogSetPinAttenuation(35, ADC_2_5db);

// Ain 36 - 6dB Gain - ADC_6db
analogSetPinAttenuation(36, ADC_6db);

// Ain 39 - 11dB Gain - ADC_11db    (default)
analogSetPinAttenuation(39, ADC_11db);

ในการทดสอบจริง เมื่อป้อนแรงดันไฟฟ้ามาตรฐาน 1V ค่า ADC จะเป็น: 3850/2890/2025/1050 ในการผลิตในอนาคต ช่วง ADC สามารถเปลี่ยนแปลงได้โดยการเปลี่ยนอัตราขยายของ ADC โดยไม่ต้องเปลี่ยนแหล่งจ่ายแรงดันอ้างอิง

Previous2.Serial portNext4.Digital-Analog Converter

Last updated 2 years ago

Was this helpful?