# Dual Mode Bluetooth&#x20;

### Introduction

โมดูล Bluetooth เป็นโมดูลสื่อสารโปร่งใสมาตรฐานซึ่งส่งข้อมูลพอร์ตซีเรียลไปยังอุปกรณ์ที่เชื่อมต่อกับ Bluetooth

คุณสามารถอัพโหลดเฟิร์มแวร์หรือควบคุมการเคลื่อนไหวของหุ่นยนต์ผ่านการเชื่อมต่อบลูทูธได้ และคุณยังสามารถควบคุมหุ่นยนต์ผ่านแอปพลิเคชัน [Petoi](https://docs.petoi.com/mobile-app/app-guide). บนสมาร์ทโฟนได้อีกด้วย และเราได้รวมโมดูลบลูทูธอย่างเป็นทางการของเราไว้ในชุดหุ่นยนต์มาตรฐานดังแสดงด้านล่าง:

![](/files/ScFYjgMRW07CMkuXx444)

### Connection with NyBoard

การเชื่อมต่อระหว่างโมดูลบลูทูธและ NyBoard แสดงในภาพด้านล่าง คุณจะต้องเสียบโมดูลบลูทูธเข้ากับช่อง 6 ขาบน NyBoard โดยให้ใส่ในทิศทางที่ถูกต้อง หลังจากเชื่อมต่อแบตเตอรี่กับ NyBoard ให้กดปุ่มบนแบตเตอรี่ค้างไว้เพื่อเปิดใช้งานหุ่นยนต์ หลอด LED บนโมดูลบลูทูธจะกระพริบแสดงว่ากำลังรอการเชื่อมต่อ

![](/files/QdIjG3X96goIBLCXnOzF)

### Connect the dongle with your phone

คุณต้องเชื่อมต่อดองเกิลภายในแอป Petoi เพื่อใช้งาน ไม่ใช่ผ่านการตั้งค่าบลูทูธของโทรศัพท์ของคุณ บางโทรศัพท์อาจต้องให้สิทธิ์ในการเข้าถึงบลูทูธและบริการตำแหน่งสำหรับแอปด้วย

ขั้นตอนการติดตั้งที่ละเอียดมากขึ้นสามารถพบได้ในส่วนของ [mobile app](https://docs.petoi.com/mobile-app/app-guide) .&#x20;

### Connect the dongle with your computer

ในการตั้งค่า Bluetooth ของระบบของคุณ ค้นหาชื่ออุปกรณ์ Bluetooth ที่เริ่มต้นด้วย Petoi หรือ Bittle และเชื่อมต่อ รหัส PIN สำหรับการจับคู่คือ "0000" หรือ "1234" หลังจากที่การจับคู่สำเร็จ ระบบจะกำหนดชื่อพอร์ตซีเรียลโปรต์ให้.

{% hint style="info" %}
เมื่ออยู่บน Mac ให้ไปที่ System Preference -> Bluetooth ค้นหาชื่ออุปกรณ์ที่เริ่มต้นด้วย Petoi หรือ Bittle แล้วเชื่อมต่อกับอุปกรณ์นั้นได้เลยค่ะ
{% endhint %}

![](/files/t61GHUxTUSKRtnB0eere)

{% hint style="info" %}
บนระบบ Windows ให้เพิ่มอุปกรณ์ Bluetooth ในการตั้งค่าระบบดังนี้
{% endhint %}

![](/files/Sd4sWOhn2nTQao06i6fR) ![](/files/suIIb5TLgNCchrpn55su)

![](/files/LSSCsL5b1nzMC5rqbNVH)

![](/files/7VCSfZSeDJyD9U5PYTzj) ![](/files/SmAwi3kOIaT8n0BFd2uN)

![](/files/31P8YHy0IRIFUX8o8OAG)

![](/files/GmEfmoBOSL3xH2zgfZpv)

{% hint style="info" %}
สำหรับผู้ใช้ Win10 ระบบจะกำหนด COM port ขาเข้าและขาออกให้กับบลูทูธ โปรดใช้ COM port ขาออก ("outgoing") และสำหรับรายละเอียดเพิ่มเติมโปรดดูใน "More Bluetooth options" ของ Win10 ดังรูปภาพต่อไปนี้:
{% endhint %}

![](/files/IpJiAAsBZuNEAluSi6XG)

![](/files/sfmoB7BTYA1vrwQkur5Q)

หลังจากนั้น คุณสามารถเลือกพอร์ตนั้นได้ในเมนู **Tools->Port** ใน **Arduino IDE** โดยใช้วิธีเดียวกับกับ USB Uploader หลังจากเปิด Serial Monitor โปรดเลือก: No line ending และอัตราการสั่งโอนข้อมูล **(baud rate)** ตั้งไว้ที่ **115200**.

<br>

{% hint style="info" %}
การเชื่อมต่อ Bluetooth กับคอมพิวเตอร์อาจขาดหายได้บ้างครั้ง การเปิดอ่านข้อมูลผ่านซีเรียลมอนิเตอร์อาจช่วยให้การเชื่อมต่อมีความเสถียรขึ้น แต่โปรดทราบว่าการเปิดซีเรียลมอนิเตอร์จะเก็บพอร์ตไว้และบล็อกแอปพลิเคชันอื่นที่ต้องการเชื่อมต่อด้วยด้วย
{% endhint %}

### Configure the Bluetooth module

ถ้าคุณต้องการกำหนดค่าโมดูลบลูทูธโปรดอ้างอิงไปที่ "JDY-23 AT Command List" ใส่โมดูลบลูทูธเข้ากับอินเตอร์เดบั๊กของแอดาพเตอร์ USB เช่นที่แสดงในรูปด้านล่าง:

![](/files/6qbVBGm1nV1TIL7cjRCK)

คำสั่งที่ใช้งานบ่อยแสดงด้านล่างนี้:

| Usage                    | Command     | Demo                                                                                            |
| ------------------------ | ----------- | ----------------------------------------------------------------------------------------------- |
| Check BT module version  | AT+VER      | <p>AT+VER</p><p>>+VER=JDY-23A-V2.21,Bluetooth V3.0+BLE</p><p>（BT module version infomation）</p> |
| Check BT broadcast name  | AT+NAME     | <p>AT+NAME</p><p>>+NAME=BITTLE</p>                                                              |
| Change BT broadcast name | AT+NAME(名字) | <p>AT+NAMEPiggy</p><p>>+OK</p><p>AT+NAME</p><p>>+NAME=Piggy</p>                                 |
| Check serial baud rate   | AT+BAUD     | <p>AT+BAUD</p><p>>+BAUD=8 （8 = 115200， 7=57600）</p>                                             |
| Change serial baud rate  | AT+BAUD     | <p>AT+BAUD7</p><p>>+OK （Set serial monitor to 57600）</p><p>AT+BAUD</p><p>>+BAUD=7</p>           |

เมื่อคุณใช้เทอร์มินัลซีเรียลเช่น "Arduino serial monitor" เพื่อตั้งค่า JDY-23 ด้วยคำสั่ง AT คุณต้องตั้งค่า "**NL** และ **CR**" และอัตราการส่งข้อมูล (baud rate) ต้องตั้งเป็น **115200** หรือโมดูล JDY-23 จะไม่รับรู้คำสั่ง AT ใดๆที่คุณส่งเข้ามา

![](/files/-MX5he3vsd-zAJM-lcTT)

{% hint style="info" %}
ถ้าคุณเป็นนักพัฒนา คุณสามารถใช้ Lightblue หรือเครื่องมืออื่นๆ เพื่อเชื่อมต่อกับบริการ BLE ของ dongle ได้
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.petoi.com/thai/communication-modules/dual-mode-bluetooth.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
