Using the BlueTooth TinyShield Tutorial

by TinyCircuits Staff February 24, 2016

Using the BlueTooth TinyShield Tutorial

The TinyShield Bluetooth board lets you use Bluetooth 2.1 wireless communications to your TinyDuino. This uses the Bluetooth Serial Port Profile (SPP), which is supported by most computers and smartphones (except Apple iPhones / iPads), and lets you communicate with your TinyDuino via a COM port, just like it’s connected via USB. No special software is required on your TinyDuino, all that’s needed is a standard serial connection software.

This TinyShield is based around the Microchip Roving Networks RN42 Bluetooth Module.


Powering the System

The RN42 module that is on this board is fairly power hungry and a coin cell battery is not sufficient to run this board. A larger battery or external power source is needed that can supply burst currents up to 100 mA.

The Bluetooth TinyShield includes a local voltage regulator and level shifters, so your TinyDuino system can operate from 3 - 5 Volts safely.


Using the Bluetooth TinyShield

Note: The Bluetooth TinyShield and the USB TinyShield share the same UART signals, therefore only one or the other can be plugged in at one time. The USB TinyShield and the Bluetooth TinyShield cannot be used at the same time.


Computer Setup

To connect to the Bluetooth TinyShield, plug it into a TinyDuino and power the system(note, the USB TinyShield and the Bluetooth TinyShield share the same UART lines, so these cannot both be used at the same time).

On your computer, or phone, go to your Bluetooth settings and select to "Add a device".

Your computer should scan for available devices, and the TinyShield Bluetooth should appear and start with the name “TinyXXXX”, where XXXXX is the last few digits of the BT MAC Address (also shown printed on the module itself). Select to pair with this device.

If asked for a pairing code, the default code is “1234″. Newer operating systems also support creating a pairing code, if so you can use the code it provides to you.

After paired, the computer will create a COM Port for the Bluetooth device, make note of the number it provides for you. Now you can open up the COM port using different programs (like the serial terminal in the Arduino IDE, or Hyperterminal), to communicate with your TinyDuino over Bluetooth. This following example sketch will just report back the keypress that the user pushes to test out the Bluetooth connection:


Microcontroller Settings

By default, the Bluetooth TinyShield will power up at 57600 baud, so the TinyDuino processor needs to be configured at this baud rate in order for communications to work.

Note: Several Bluetooth TinyShields have accidentally been shipped with the resistor R4 included on the assembly - this will set the UART baud rate to 9600.  Check to see if this is present if you are having issues, if so, you will need to set the UART baud rate of your TinyDuino processor to 9600 baud.  You can also remove the resistor to return this to 57600 baud, or contact us at TinyCircuits and we can modify the unit for you.


Example:

void setup()
{  
  Serial.begin(57600);
}

void loop()
{
  if (Serial.available())
  {    
     Serial.print("The character typed is: ");
     Serial.write(Serial.read());
     Serial.println("");
  }
}


TinyCircuits Staff
TinyCircuits Staff

Author



Also in Learn

SRAM TinyShield Tutorial
SRAM TinyShield Tutorial

by Nick DiVitto July 02, 2018

The SRAM Tinyshield allows you to add memory to your TinyDuino projects that can read and write at a virtually instant rate. Here's...

View full article →

Servo Controller TinyShield Tutorial
Servo Controller TinyShield Tutorial

by Nick DiVitto June 26, 2018

Learn how to control servos with TinyDuino using the Servo Controller TinyShield!

View full article →

Battery Voltage Reading Using the TinyScreen+
Battery Voltage Reading Using the TinyScreen+

by TinyCircuits Staff June 15, 2018

View full article →