3D Robotics

3689591143?profile=original

[UPDATE: We now sell a Bluetooth set that has all this pre-setup for you. If you get that, no need to read further!]. We're going to be adding Bluetooth connectivity to more 3DR products in the coming months, but there's no need to wait. Right now you can add Bluetooth connectivity yourself with cheap third-party bluetooth modules. Connecting the APM and Pixhawk via Bluetooth is a great way to do basic setup and mission planning with your laptop (Mac, PC or Linux) or Android phone or tablet, without the need to carry and connect a 3DR radio and OTG cable.  You’re limited to Bluetooth range (about 50m), but for wireless setup before launch, this works fine.  Mission Planner (Windows), APM Planner (Mac, Windows, Linux), DroidPlanner and AndroPilot (both Android) all support Bluetooth connectivity.

 

This tutorial will show you how to connect two kinds of commonly available Bluetooth modules (shown above) to APM or Pixhawk.

The process consists of three steps: 

  1. Configuring the modules so they’re running at 57600 baud
  2. Physically connecting the modules to APM/Pixhawk
  3. Connect via BT to your Android device or laptop and a GCS app (pair the module with your device)

 

Option 1: Setup with RN-42 and RN-41 Bluetooth modules

 

Connect the module with an XtreamBee adapter board and this cable

g_B8E93AMguxqCeHDMKVpJcHzH9edrF6ttUQ_EIRshx_Y2R1fOeK3BmhOnozob6gDAaJkwAPxhxj8jTvXrPg5nI6V2mhXvl6qftfwzJZoSYurmZJJZxYU_8gBFm-lBMv6A

 

TO GET THE COMMAND PROMPT

 

You can use any serial terminal program (the terminal in the Arduino IDE is shown), but there are a few things you need to do:

  1. You must enter command mode within 60 seconds of powering up the board
  2. The board can’t be already wirelessly paired with a device (such as your phone or tablet)
  3. The default baud rate is usually 115200. We need to change that to 57600 baud. But for the first connection, to get the command prompt for this change, we’re going to start at 115200.
  4. To get to command mode, you need to select “No line ending” in your terminal program, then enter “$$$” [enter]. After that, the terminal program needs to be in “Newline”  mode, as shown below. Crazy, but that’s the way Roving Networks set it up. Now you know!

First, ensure that your terminal baud rate is at 115200 and “No line endings” is selected. Then plug in your module and within 30 seconds type “$$$” [enter]. You should get the return message “CMD”.

3689591252?profile=original

Once you have that, switch your terminal program to “Newline” for the rest of the commands.

_dev_tty_usbserial-FTE3HYK7.png

Now you can enter commands. To switch to a 57600k baud rate the command would be "SU,57" (A full list of commands is here, although you won’t need them for this change). Once you reboot the board, that baud change will take effect.

 

Congrats, you’re done! Now you’re ready to use it with APM/Pixhawk. See the bottom of the post for instructions on how to use the GCS apps with Bluetooth.

 

-------------------------

 

Option 2: Setup with cheap ($10) HC-05 Arduino Bluetooth Module

 

Full instructions are here, but the basics are below:

IMG_20140423_113806.jpg

 You can make your own cable by swapping some wires in the standard 3DR telem-to-Xbee adapter cable. For clarity’s sake, I’ve used some color-coded wires above to show what goes where.

 

Here’s a neater cable that I’ve made with some regular breakaway header pins:

IMG_20140501_102034.jpg

 

This same custom cable will allow you to plug it into a regular FTDI cable (shown below) so you can change the configuration of the Bluetooth board to switch the default baud rate from 9600 baud to 57600 baud.

IMG_20140501_102142.jpg

Once you’ve plugged the board into your FTDI cable and plugged that into your computer, it will show up in your computer as a serial port. The LED on the board should be blinking red, not blue. You should NOT wirelessly pair the Bluetooth model with any device at this point; if it the LED is blue that means that it’s paired with something, so if that’s the case make sure that you unpair it first.  At that point you can use any serial terminal to communicate with the Bluetooth module. For the sake of this demo, we’ll use the serial terminal built into Arduino.

 

First, select the port assigned to your FTDI cable (it probably won’t be 26, as shown below, and on a Mac it may show us as “tty-usbserial”):

ConfirmCOMport.jpg

Ensure that the serial terminal baud rate is set for 9600 baud and “No line ending”, as shown.


Type AT [return]. The board should return “OK”.  That means that all is well and you’re talking to the board. If you don’t get a return, check your wiring and make sure that the Bluetooth board is showing a blinking red LED (powered on) and is not blue (paired with something).  

AT-OK.jpg


Now we can change the baud rate to 57600. The command for that is “AT+BAUD7 [return]”, as shown. If this is a success, it will report back “OK57600”, as shown below. If so, you’re done! Unplug the board and you’re ready to use it with APM/Pixhawk.

_dev_tty_usbserial-FTE3HYK7_and_Bluetooth_module_configurations___www_hobbyist_co_nz.png

-------------------

Now that you have your module working, you just need to pair with your device. On Android, this is the Bluetooth settings. Set your device to "discoverable" and you'll see the module show up. Then pair it. If it asks for a code, type "1234". 

Once it's paired you can connect with either Android app: DroidPlanner 2 and Andropilot. On Andropilot, there's a button marked "Bluetooth" on the main screen. On DroidPlanner, go to the settings menu (top left) and under "Telemetry Connection Type" select Bluetooth and the module you've paired with it. 

Both of these modules work great with either app!

DroidPlanner_2_-_Android_Apps_on_Google_Play.pngAndropilot_-_Android_Apps_on_Google_Play.png

 

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • I have a COM port with SPP-RNI service : is it correct ?

    I had to choose the MDM-SPP profile as when I select SPP profile, my BT device is recognised as HID (keyboard) without any virtual COM port

  • Thanks for your answer

    I tested with Droidplanner over BT : the BT connection is OK but I don't get any data (GPS pos, alt, orientation) on Droidplanner

  • 3D Robotics

    The APM code should be fine as is. Do you have an Android device that you can test with Tower/Droidplanner over BT? If it works there, the problem is in your Mission Planner settings?

  • I succeeded in programming the XBee + RN41XV to meet the correct parameters !! The bluetooth is OK with the computer, including the SPP Rev to get the correct COM port @57600

    Now I fail to get the mavlink connection : MissionPlanner answers "No heartbeat" whatever the RX/TX configuration. I wonder whether the APM (FW 3.2.1) has to be set a certain way to get the Mavlink connection work : could any user send me its own configuration or bring my any help ?

    Thanks

  • PS I did a UDP connection in to port 1450

  • I ended up with this and I'm very happy with it. APM Planner and my MacBook air connect instantly. Range is outstanding. I often just leave the wifly in my basement hobby shop while I go fly outside. Love the little switch / charging port. The hardest part for me was setting up the network settings on the wifly. That's not really my cup of tea but Bill helped me out a lot. Thanks again. 

    3701827525?profile=original

    3701827888?profile=original

    3701827915?profile=original

  • For future reference, I bought a cheapo HC-05 module from ebay and it wouldn't work with AT commands. After trawling through tons of info I found that the following works:

    - Wire FTDI programmer to bluetooth module
    - Wires up KEY pin to VCC pin
    - Plug in FTDI programmer to USB port
    - In Arduino IDE, select appropriate COM port
    - In Arduino IDE serial monitor, set "Both NL & CR" and "38400 baud"
    - Then type "AT+UART=57600,0,0" without quotes
    - It will return "+UART:57600,0,0 OK" if it went well

  • Thanks Bill for your answer and help.

    The XBee USB adapter is this one : http://www.aliexpress.com/item-img/Bluetooth-Bee-XBee-Adapter-USB-A...

    Through USB, I succeeded to send commands to the RN41XVC ($$$, changed baud rate to 57k, renamed) but in a total blind mode : I never got any answer in the Arnuino serial terminal.

    Now my problem consists in getting the connection to the DroidPlanner. I paired the Bluetooth dongle with the phone but it is recognized as a keyboard and Droidplanner (both versions) either refuse to connect "Disconnected" or answer "MAVLink error, read fail, socket might closed or timeout, read ret: -1"

    Thanks again for your help

    usb 2.0 display adapter Picture - More Detailed Picture about Free shipping ! Bluetooth xbee adapte…
    usb 2.0 display adapter Picture about Free shipping ! Bluetooth xbee adapter, USB adapter for Arduino Picture, adapter jack to usb Picture, adapter…
  • Developer
    Can you post a link to the Wbee adapter? I use https://www.sparkfun.com/products/11373 as the adapter, but removed the level translation circuitry as it was not working
    SparkFun XBee Explorer Regulated
    The SparkFun XBee Explorer Regulated takes care of the 3.3V regulation, signal conditioning, and basic activity indicators (Power, RSSI and DIN/DOUT…
  • Hi,

    I have the same problem with Wbee USB adapter + RN41XVC : no way to get access to the command mode with the "$$$" entry.

    When I connect it to PC though Bluetooth, I have only 1 COM ingoing port (no outgoing) and the BT module is recognized as a keyboard.

    Any idea to set the right parameters ?

This reply was deleted.