====== 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 ===== - Connect the HC-06 to PC with an FTDI adapter (ensure RX and TX are crossed over). - Open a serial terminal to the COM port on baud rate 9600. - Type "**AT**" into the terminal, a "**OK**" response should be returned. Proceed to step 4. - Type "**AT+BAUD8**" into the terminal, a "**OK115200**" response should be returned. - All done! The following AT commands are used to configure the name and passcode on the Bluetooth module. * **AT+NAME** (e.g AT+NAMEPIDflight to set module name to "PIDflight") * **AT+PIN** (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=** (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. - Connect the HC-06 to Arduino Nano: - Arduino (5V) -> HC-06 (VCC) - Arduino (D6) -> HC-06 (TX) - Arduino (D7) -> HC-06 (RX) - Arduino (GND) -> HC-06 (GND) - Flash the {{:pidflight:bluetooth-passthru.zip|}} HEX file to the Arduino Nano. - 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. - Type "**AT**" into the serial terminal, "**AT> OK**" response should return to indicate the Bluetooth module is responding to AT commands. - 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: - Connect the HM-10 to PC with an FTDI adapter (ensure RX and TX are crossed over). - Open a serial terminal to the COM port on baud rate 9600. - Type "**AT**" into the terminal, a "**OK**" response should be returned. Proceed to step 4. - Type "**AT+BAUD0**" into the terminal, a "**OK+Set:1**" response should be returned. - All done! ^Parameter^Baud rate^ |0|9600| |1|19200| |2|38400| |3|57600| |4|115200| |5|4800| |6|2400| |7|1200| |8|230400| **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** (e.g AT+NAMEPIDflight to set module name to "PIDflight") * **AT+PASS** (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.