Bluetooth

roboalchemist edited this page Jan 11, 2013 · 23 revisions

Pairing Bluetooth to your PC

First, if you're using the module with a Servotor32, make sure you update to the latest Servotor32 firmware.

Next, turn on the module by providing 3.3v or 5v power to it. In this case, we're adding power to it by plugging it into the ArcBotics Servotor32 controller board. If you have a 6-pin module, plug in the middle 4 pins like the module below:

Bluetooth module plugged into Servotor32

It should be blinking its red light on and off now, this means its on, but not paired with anything.

Windows 7 Install Tutorial

OSX Install Tutorial

To pair, use your PC's Bluetooth browser to locate the Bluetooth Module. The name should be "Arcbotics-DevB" and the default PIN is "0000".

More information

The module is a JY-MCU Arduino Bluetooth Wireless Serial Port Module with the Linvor 1.5 firmware.

The datasheet/manual (or what passes for a chinese equivalent) is available [here](http://arcbotics.com/hosting/HC Serial Bluetooth Products 201104.pdf)

Extra Commands (AT Commands)

Much like the modems of yore, the Bluetooth module responds to a limited set of Hayes-like AT commands.

The module enters AT command mode when you power it up and it is not connected/paired to your PC.

The following is a subset of all the available commands. NOTE: Command intervals must be of 1 second and must not be followed with a newline/carriage-return, it is therefore easiest to copy/paste the commands instead of typing manually.

All settings are saved automatically.

Test your Connection

  • Request: AT
  • Response: OK

Changing the Serial Baud Rate

Example:

  • Request: AT+BAUD1
  • Response: OK1200

Baud Values

  • AT+BAUD1 Sets Baud rate to 1200
  • AT+BAUD2 Sets Baud rate to 2400
  • AT+BAUD3 Sets Baud rate to 4800
  • AT+BAUD4 Sets Baud rate to 9600 (Default)
  • AT+BAUD5 Sets Baud rate to 19200
  • AT+BAUD6 Sets Baud rate to 38400
  • AT+BAUD7 Sets Baud rate to 57600
  • AT+BAUD8 Sets Baud rate to 115200
  • AT+BAUD9 Sets Baud rate to 230400
  • AT+BAUDA Sets Baud rate to 460800
  • AT+BAUDB Sets Baud rate to 921600
  • AT+BAUDC Sets Baud rate to 1382400

##Troubleshooting

The red LED on the Bluetooth module does not come on

When Hexy is powered on and only has power supplied through the ‘SERVOS’ power jack the Bluetooth module may not power up properly (i.e. the red LED on the Bluetooth module may stay off and not flash). I found two solutions:

  1. Unplug the Bluetooth module and plug it back in again. The light will begin to flash.
  2. In addition to providing power to the ‘SERVOS’ power socket also provide power to the ‘LOGIC ‘ power jack using a separate power supply. If the ‘LOGIC’ jack receives power first the Bluetooth module will start up properly.

On Windows 7 PoMoCo does not connect

PoMoCo still might not connect even if everything is configured correctly (i.e. the Bluetooth module baud rate is correct, the computer is paired to the Bluetooth module and a COM port has been assigned to the Bluetooth adapter by Windows). This might be caused by the connection routine in ServotorComm.py failing to connect to the correct COM port. The routine first tries to use the COM ports returned by serial.tools.list_ports.comports(). This usually doesn’t return anything on Windows so other logic, called the ‘windows method’, is used to iterate through the COM ports from 1 to 100, testing each one. For some reason the Bluetooth COM port is returned by serial.tools.list_ports.comports() but does not allow a connection. You can force the connect() function to use the ‘windows method’ by commenting out the code that tries to use the comList. For example comment out the code as follows:

           ...
           comList = list(set(comList))
           print "Attempting to connect to Servotor"
           """
            for port in comList:
                    try:
                            ser = serial.Serial(port, baudrate= BAUD_RATE, timeout=2)
                            ser.write('V\n')
                            result = ser.readline()
                            if "SERVOTOR" in result:
                                    print "Connect Successful! Connected on port:",port
                                    self.ser = ser
                                    self.ser.flush()
                                    self.serOpen = True
                                    self.serNum = 1
                                    break
                    except:
                            pass
            """
            if self.serOpen == False:
                print "Trying Windows Method"
                ...

Side notes

Some Bluetooth modules ships pre-configured for 115200 baud though recent versions of the Servotor firmware are configured for 9600 baud. If you use the Servotor32 2.0 firmware or above, however, it will automatically reconfigure itself for you.

There is a red LED on the module which indicates its state. The module is on when the red LED is flashing. It will also flash when you pair it to your computer. It will stop flashing and glow when a connection to the module has been made (e.g. when you are using PoMoCo to control Hexy via Bluetooth).

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.