User Tools

Site Tools


pidflight:bluetooth

PIDflight Lap

How to setup Bluetooth module for lap timing device

By default most modules are set to 9600 baud rate. The Bluetooth module must be configured to 115200 baud rate.

Please be aware the AT commands to configure your Bluetooth module may vary. Below are examples of typical AT commands for most common modules.

HC-06

  1. Connect the HC-06 to PC with an FTDI adapter (ensure RX and TX are crossed over).
  2. Open a serial terminal to the COM port on baud rate 9600.
  3. Type “AT” into the terminal, a “OK” response should be returned. Proceed to step 4.
  4. Type “AT+BAUD8” into the terminal, a “OK115200” response should be returned.
  5. All done!

The following AT commands are used to configure the name and passcode on the Bluetooth module.

  • AT+NAME<new name> (e.g AT+NAMEPIDflight to set module name to “PIDflight”)
  • AT+PIN<XX… X> (e.g AT+PIN0000 to set module pairing pin to “0000”)

Some generic HC-06 modules labelled ZS-040 may use a variant of AT commands to configure the module. If the above commands do not work, please refer to the ZS-040 section below.

ZS-040

These AT commands have been verified with AT+VERSION command that returns VERSION:3.0-20170609.

  • AT+UART=115200,0,0 (sets the baud rate to 115200)
  • AT+NAME=<new name> (e.g AT+NAME=PIDflight to set module name to “PIDflight”)

Arduino

An alternative option to setting up the Bluetooth module without an FTDI adapter is the use the bluetooth-passthru.hex with an Arduino Nano. This HEX file creates a software serial connection to the Bluetooth module on D6/D7 pins and relays input from the serial terminal to the Bluetooth module.

  1. Connect the HC-06 to Arduino Nano:
    1. Arduino (5V) → HC-06 (VCC)
    2. Arduino (D6) → HC-06 (TX)
    3. Arduino (D7) → HC-06 (RX)
    4. Arduino (GND) → HC-06 (GND)
  2. Flash the bluetooth-passthru.zip HEX file to the Arduino Nano.
  3. Once the HEX file has been flashed, open up a serial terminal (e.g. Serial Monitor within Arduino IDE) to the COM port of the Arduino Nano with baud rate 115200.
  4. Type “AT” into the serial terminal, “AT> OK” response should return to indicate the Bluetooth module is responding to AT commands.
  5. Proceed with configuring the Bluetooth module with AT commands.

HM-10

This module is supported as of PIDflight Lap v1.0.0-alpha.5.

This module should be set to 9600 baud rate by factory default and require no further changes.

If you need to configure your HM-10 module to use baud rate 9600, following these steps:

  1. Connect the HM-10 to PC with an FTDI adapter (ensure RX and TX are crossed over).
  2. Open a serial terminal to the COM port on baud rate 9600.
  3. Type “AT” into the terminal, a “OK” response should be returned. Proceed to step 4.
  4. Type “AT+BAUD0” into the terminal, a “OK+Set:1” response should be returned.
  5. All done!
ParameterBaud rate
09600
119200
238400
357600
4115200
54800
62400
71200
8230400

IMPORTANT: Please be careful, if you set the baud rate to 1200, the module may no longer support the configurations of the AT command. You may need to short-circuit the PIO0 to ground to restore factory settings.

The following AT commands are used to configure the name and passcode on the Bluetooth module.

  • AT+NAME<new name> (e.g AT+NAMEPIDflight to set module name to “PIDflight”)
  • AT+PASS<XX… X> (e.g AT+PASS0000 to set module pairing pin to “0000”)
  • AT+RENEW to restore factory settings, recommend to issue a AT+RESET afterwards to restart the device with factory settings.
  • AT+ROLE0 to set the module as slave.
pidflight/bluetooth.txt · Last modified: 2018/03/22 15:47 by cmengler