双模蓝牙模块
简介
蓝牙模块为标准透传模块,将串口数据发送至连接蓝牙的设备上。
您可以通过蓝牙连接方式对机器人进行无线上传程序或控制其运动。 您甚至可以使用我们的智能手机 APP Petoi 控制机器人。 我们在标准机器人套件中已包含了我们的官方蓝牙模块。如下图所示:
![](https://docs.petoi.com/~gitbook/image?url=https%3A%2F%2F201656985-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MQ6a951Q6Jn1Zzt5Ajr-3369173170%252Fuploads%252Ftu5oQccWSgqCPvnuKPfK%252Fbluetooth_cn.png%3Falt%3Dmedia%26token%3D30502249-ed2c-44a6-a9a6-feb91a6616ff&width=768&dpr=4&quality=100&sign=6b0d9fed&sv=1)
与NyBoard连接
蓝牙模块与 NyBoard 的连接如下图所示,您需要将蓝牙模块插入 NyBoard 上的 6 针插座。 注意蓝牙模块的引脚顺序。 将电池连接到 NyBoard 后,长按电池上的按钮为机器人供电。 蓝牙模块上连接指示灯闪烁表示正在等待连接。
![](https://docs.petoi.com/~gitbook/image?url=https%3A%2F%2F201656985-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MQ6a951Q6Jn1Zzt5Ajr-3369173170%252Fuploads%252FKLg2MT4wKgRx8M8kSG3s%252Fblue.jpg%3Falt%3Dmedia%26token%3De4135d37-ed61-4381-b26d-b0bb6573da13&width=768&dpr=4&quality=100&sign=2a6a8cbd&sv=1)
与手机连接
您需要在 Petoi App 内连接蓝牙,而不是在手机的系统蓝牙设置中。在某些型号的手机上,您可能需要给 app 蓝牙和位置服务的权限。更详细的配置说明请参阅手机 app 章节。
与电脑连接
在系统的蓝牙设置中,搜索以 Petoi 或 Bittle 开头的蓝牙设备名称,然后连接。 配对的默认 PIN 码是“0000”或“1234”(为了方便连接,后续批次默认密码设置为“0000“)。 配对成功后,系统会分配一个串口名称。
在 Mac 上,转到系统偏好设置 -> 蓝牙,找到以 Petoi 或 Bittle 开头的设备名称,然后连接。
在 Windows 上,在系统设置中添加蓝牙设备,具体步骤如下列图示:
![](https://docs.petoi.com/~gitbook/image?url=https%3A%2F%2F201656985-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MQ6a951Q6Jn1Zzt5Ajr-3369173170%252Fuploads%252Foba59JPFmzSMG34jeH3D%252Fbluetooth-config01.png%3Falt%3Dmedia%26token%3D1cf6db54-0cf8-4d39-9129-a34ff7930512&width=768&dpr=4&quality=100&sign=e33d257e&sv=1)
![](https://docs.petoi.com/~gitbook/image?url=https%3A%2F%2F201656985-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MQ6a951Q6Jn1Zzt5Ajr-3369173170%252Fuploads%252F9tlra2Fh35FNI2nzEGym%252Fbluetooth-config02.png%3Falt%3Dmedia%26token%3Dc294efe0-2ed1-4af4-bc59-6c901cb2bb4d&width=768&dpr=4&quality=100&sign=6e7cad21&sv=1)
![](https://docs.petoi.com/~gitbook/image?url=https%3A%2F%2F201656985-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MQ6a951Q6Jn1Zzt5Ajr-3369173170%252Fuploads%252FL1vjwLVvuSbXrGDW9k7m%252Fbluetooth-config03.png%3Falt%3Dmedia%26token%3De39b1e37-2910-4423-acf0-3bd7907eb58f&width=768&dpr=4&quality=100&sign=52e126a3&sv=1)
![](https://docs.petoi.com/~gitbook/image?url=https%3A%2F%2F201656985-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MQ6a951Q6Jn1Zzt5Ajr-3369173170%252Fuploads%252FXKsDXxduLsWQJoGih0B8%252Fbluetooth-config04.png%3Falt%3Dmedia%26token%3Ddab2e31b-4efe-4c34-b663-a1e806eb2296&width=768&dpr=4&quality=100&sign=e6211251&sv=1)
![](https://docs.petoi.com/~gitbook/image?url=https%3A%2F%2F201656985-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MQ6a951Q6Jn1Zzt5Ajr-3369173170%252Fuploads%252FajclzDNnkJsMvy0dwpmZ%252Fbluetooth-config05.png%3Falt%3Dmedia%26token%3D9462a41d-2ca2-4570-93d9-807f83f1c1c9&width=768&dpr=4&quality=100&sign=137e63a0&sv=1)
![](https://docs.petoi.com/~gitbook/image?url=https%3A%2F%2F201656985-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MQ6a951Q6Jn1Zzt5Ajr-3369173170%252Fuploads%252FlErh6gJEYiBHAXFQoLnf%252Fbluetooth-config06.png%3Falt%3Dmedia%26token%3D508ee3c9-58cb-4e8b-a81f-e03b97a05f1e&width=768&dpr=4&quality=100&sign=b651871b&sv=1)
![](https://docs.petoi.com/~gitbook/image?url=https%3A%2F%2F201656985-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MQ6a951Q6Jn1Zzt5Ajr-3369173170%252Fuploads%252FVdW0adakPufYNOcj5zLr%252F%25E8%2593%259D%25E7%2589%2599%25E4%25B8%25B2%25E5%258F%25A3%25E5%2588%2597%25E8%25A1%25A8_cn.jpg%3Falt%3Dmedia%26token%3Dce67d488-cbea-4db7-b166-5ec08c1df346&width=768&dpr=4&quality=100&sign=aa4943b8&sv=1)
对于Windows 10用户,系统会将蓝牙分配“传入”COM口和“传出”COM口,请使用“传出”COM口。具体步骤如下图所示:
![](https://docs.petoi.com/~gitbook/image?url=https%3A%2F%2F201656985-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MQ6a951Q6Jn1Zzt5Ajr-3369173170%252Fuploads%252F1F2zc5uVBcibqLfzFYSk%252FBluetooth_port_check01_cn.jpg%3Falt%3Dmedia%26token%3D8e1d03d8-38f5-4f43-adaf-8d9f561e1837&width=768&dpr=4&quality=100&sign=963a75d2&sv=1)
![](https://docs.petoi.com/~gitbook/image?url=https%3A%2F%2F201656985-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MQ6a951Q6Jn1Zzt5Ajr-3369173170%252Fuploads%252FLynnQkervVm72tWYdIRj%252FBluetooth_port_check02_cn.jpg%3Falt%3Dmedia%26token%3D5b658201-6b7a-40a4-b212-ec8c2c70bf0b&width=768&dpr=4&quality=100&sign=bd319411&sv=1)
然后您可以在 Arduino IDE 的 Tools->Port 下选择它,使用方法与USB上载器相同。打开串口监视器后请选择:没有结束符(No line ending),波特率设置为 115200。
电脑端的蓝牙连接时常会自动断开,打开 Arduino 的串口监视器可以保持连接。但要注意,这也会独占蓝牙串口,使其他应该无法访问它。
配置蓝牙模块
如果需要配置蓝牙模块,请参考“JDY-23 AT指令集”。将蓝牙模块插在USB上载器的通信模块调试接口上。如下图所示:
![](https://docs.petoi.com/~gitbook/image?url=https%3A%2F%2F201656985-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MQ6a951Q6Jn1Zzt5Ajr-3369173170%252Fuploads%252FbsUMKSmbQQfdSlb67GrE%252FconfigBlue.jpeg%3Falt%3Dmedia%26token%3Df0c51e3b-8eac-4232-a58c-fb18e85ce800&width=768&dpr=4&quality=100&sign=e4e983f9&sv=1)
以下列出常用的指令:
用途 | 指令 | 示例 |
查询蓝牙软件版本 | AT+VER | AT+VER >+VER=JDY-23A-V2.21,Bluetooth V3.0+BLE(版本信息) |
查询蓝牙广播名 | AT+NAME | AT+NAME >+NAME=BITTLE |
更改蓝牙广播名 | AT+NAME(名字) | AT+NAMEPiggy >+OK AT+NAME >+NAME=Piggy |
查询串口速率 | AT+BAUD | AT+BAUD >+BAUD=8 (8 = 115200, 7=57600) |
更改串口速率 | AT+BAUD | AT+BAUD7 >+OK (需要调整串口监视器至57600) AT+BAUD >+BAUD=7 |
打开Arduino IDE中的串口监视器,配置蓝牙模块时请选择:NL and CR(发送新行/回车), 波特率请设置为 115200,否则JDY-23模块将不识别任何指令。
如果想使用BLE功能,请扫描后连接BittleBLE-xxxx(随机数字),可以使用Lightblue软件对BLE进行常规调试。
Last updated