Computers, Development Boards & Shields
Educational & Robotics Kits
Electronic Sensors
Motors & Controllers
Communication & Display
Electronic Components
Soldering & Lab Tools

Virtuabotix BT2S Master configuration and pinout guide

Setting up your BT2S-M (Master)

Currently the BT2S-Slave and BT2S-M (master) are programmable in the exact same way. We are working on some customizations that will only work on the Master, and look forward to providing more information in the future.

Using a Hyper-terminal program

BT2S Slave is configured to operate at 9600 Baud with a Pin of 1234 right out of the box, but it can be configured in the following way:
First power up the device and connect it to a serial port that you can use Hyperterminal or an equivalent Serial Communication software. Remember you need to have the device in seek mode while configuring it (make sure it is not paired while trying to change the configuration). Configure your Hyperterminal to the baud rate you have your device set to (in this case 9600).
IMPORTANT NOTE: The commands must be entered very quickly, so it is suggested that you type the command into a text editing program and copy/paste into the terminal program to make configuring your device easier.
Send the command “AT”, and the device should return “OK”. If not check your Hyperterminal configuration and make sure the device isn’t paired.
To change the PIN code send the device “AT+PIN####” <- replace #### with your four digit pin.
To change the Baud rate send the device “AT+BAUD#” <- replace # with the BAUD code from the look up table below (keep in mind you will have to change your Hyperterminal Baud to that Baud rate if you want to continue to command the device).
To change the device name send the device “AT+NAMExxxx” <- Where xxxx is the new name.
CODE BAUD 1 >> 1200 
2 >> 2400
3 >> 4800
4 >> 9600 (Default)
5 >> 19200
6 >> 38400
7 >> 57600
8 >> 115200 //Must be programmed manually through serial port

Connected to a Versalino/Arduino

Now if you don’t want to go through all the trouble of programming by hand and you have a Versalino or Arduino handy, we came up with a way of making the changes with a program for the Arduino IDE.

First edit the code below to reflect the setup you want (for the moment 115200 and BT2S units that have been configured to 115200 must be configured directly with serial commands from the previous section):

This new program is fully automated, just change the desiredBaud and desiredPin at the top and the rest will automatically find the proper baud and setup your device to work as you desire.

int statusLED = 2; //the pin you connect your status LED to
int desiredBaud = 4;//index of your desired baud rate 4 is 9600
char* desiredPin = "1234";//change to the pin of your choice

unsigned int baudLookup[] =
{
1200, //code 1
2400, //code 2
4800, //code 3
9600, //code 4
19200, //code 5
38400, //code 6
57600 //code 7
};

void setup()
{
pinMode(statusLED, OUTPUT);
digitalWrite(statusLED, HIGH);

//this block of code searches every possible baud rate until a
//working rate is found (blinking briefly between searches)
int myBaud = 1;
while(!checkBT2Sstatus(myBaud)) {
digitalWrite(statusLED, LOW);
myBaud++;
delay(200);
if(myBaud > 7) myBaud=1;//reset baud and keep searching
digitalWrite(statusLED, HIGH);
}
//blink fast to show baud found
for(int i =0; i <10; i++) { digitalWrite(statusLED, LOW); delay(100); digitalWrite(statusLED, HIGH); delay(100); } delay(1000);//wait a second //blink number that corresponds to baud for(int i =0; i 0)Serial.read();//clear the buffer

Serial.print("AT+BAUD");
Serial.print(endingBaud, DEC);

delay(1500);//let it reset
if(checkBT2Sstatus(endingBaud)) myReturn = true; //final check

return myReturn;
}

boolean checkBT2Sstatus(uint8_t baud)
{
Serial.begin(baudLookup[baud-1]);//pulls baud from baudLookup
delay(500);//give it half a tick just to be sure its ready
while(Serial.available()>0)Serial.read();//clear the buffer
delay(1500);//wait for reset to complet

Serial.print("AT");//checks to see if BT2S is connected, and set to proper baud

for(int i = 0;Serial.available()<2 && i <100; i++ ) delay(12);//give as much as 1.2 seconds for a responseif(Serial.read()=='O' && Serial.read()=='K') return true; else return false;}

Having Problems?

If you have any problems whatsoever please let me know by either calling and leaving a message, making a Technical support request, or simply emailing/messaging me either directly or via Amazon.

8 Responses to “Virtuabotix BT2S Master configuration and pinout guide”

  1. I purchased a BT2S and cannot get it to work with my Android phone, I have tried using a wireless keyboard to enter the 1234 password more quickly but it will not work, It also comes up as HC-06 and not linvor. Any suggestions?

    • The first thing to double check is that you have a Virtuabotix BT2S Slave not master, then you should verify that the device isn’t pairing with another Virtuabotix BT2S Master (if applicable just turn off the master).

      If the device HC-06 or Linvor shows up in your pairing menu then you should be able to pair with it using the code 1234 (you may also try 0000 if you are having trouble, though I have not seen any units with that version of the firmware to date). If the device isn’t even showing up in your Bluetooth pairing menu (which I suspect is not the case since you saw HC-06) then you may want to adjust the power supply on the unit (give it more juice).

      Once paired I recommend doing a sanity check by installing Bluterm and shunting the Tx and Rx pins together. If it is connected properly anything you type in Bluterm should show back up on the terminal screen while the Tx is connected to the Rx pin.

      Let me know if those suggestions help, or if you need more help getting your problem solved.

  2. I’m having troubles sending commands from the Arduino IDE Serial Monitor to the Arduino connected via Bluetooth. The Serial Monitor can receive data just fine, but if I send a character to it, it does not appear to be received correctly.

    On my code, Serial is the normal USB serial port (0/1) and Serial2 is where the BT2S is set up. If I connect the serial monitor via USB, and send “A”, it correctly echoes back “65”.

    If I connect via BT, I receive the word “transmitting” and “echo” correctly, but the actual character I send always comes back as garbage, most often just “0”. Thus the BT on the arduino doesn’t appear to be ‘receiving’ the data correctly since what it’s echoing back is garbage.

    Here’s my test code:

    void setup() {
    Serial.begin(9600); // USB port
    Serial2.begin(9600);// BT2S slave
    }
    void loop() {

    while (Serial2.available() > 0) {
    char c = Serial2.read();
    Serial2.print(“BT echo:”);
    // what ends up being echoed back is never the decimal value of character sent.
    Serial2.println(c,DEC);
    }
    while (Serial.available() > 0) {
    char c = Serial.read();
    Serial.print(“USB echo:”);
    // this works correctly, the DEC value of the character sent is correctly echoed back.
    Serial.println(c, DEC);
    }

    delay(250);
    Serial2.println(“transmitting”);
    Serial.println(“transmitting”);

    }

    • That sounds like a problem with VOH. The Virtuabotix BT2S is a 3.3 volt device, and some more recent Atmega328 chips have a slightly higher VOH than previous batches. If you are on the harry edge of VOH then you will often get garbled data like that, but it should only be on the receive side since 5v is more than enough to clock in serial data to the the BT2S itself.

      I have a board design that is getting checked out this week to boost 2 to 3 volt signals to 5V, and if all of the checks go well I should be releasing it right away. If you are interested I can post a reply with more info after check out. Alternatively you could try putting a transistor in line on the TX out from the Virtuabotix BT2s to the Arduino RX to raise the signal voltage enough for successful receive.

      • Hi,

        Thanks for the response. Do you mean the power supply to the BT2S or the RX pin. I’ve tried powering it from both the 3.3 and 5.0 V supply on the Arduino Mega. (into BT2S VCC ) Changing VCC doesn’t affect it.

        Are you saying that I need to put a resister inline with the RX or TX pin on the BT2S ?? Assuming that the Arduino Pins are 5v, what circuit should I build to resolve this problem. (aka what rough resistance would you recommend.)

        For example I currently have Arduino 16 attached directly to BT2S RX and Arduino 17 attached directly to BTS2 TX

        Just to be clear, the Arduino is having trouble receiving data from the remote computer, not transmitting data to the remote computer.

Leave a Reply