Project tutorial
Arduino101 Bluetooth Interfacing

Arduino101 Bluetooth Interfacing © GPL3+

Use the Arduino101 Bluetooth wireless interface with the Blynk GUI Library for control of things directly from your phone or tablet!

  • 13 respects

Components and supplies

Apps and online services

About this project

The Arduino101 features the Intel Curie Processor with a Bluetooth Low Energy Radio, Inertial Measurement Unit and sensors, in an Arduino Uno format.

Today we'll be learning about the Bluetooth Low Energy Radio and a simple method to get access to sensors and peripherals on your phone or tablet using the Blynk GUI Library to make our user interface.


The following project was tested using a few specific versions of libraries and applications - as the most recent versions have some bugs in them.

If you experience problems, first make sure you are using these tested versions:

  • Arduino IDE Version 1.8.1
  • Intel Curie Board File Version 1.0.7
  • Blynk Version 0.4.6

Bluetooth Low Energy support in Blynk is still in BETA test status, so this is pretty new code that is being actively developed. Bluetooth security is also low. Be warned, there may be bugs and dragons here, as you are on the bleeding edge now...


On your laptop or computer, please install :

  • Install the Arduino_101_BLE_Relays.ino sketch from below.

On your smartphone or tablet, please install :

Start the Blynk Application on Android or iPhone

  • After installing the Blynk application, start it up
  • While Blynk is free, they do charge for using many "widgets" (it's how they stay in business...) for complicated GUI displays, this basic example should fit within a "free" account. You can add "Energy" in the store, usually start with a small amount (< $20), that will last for a number of different Blynk projects.
  • Blynk can "clone" a user interface project using a QRcode image - shine your camera at the image below :

Now your smartphone screen should look like :

Email the Blynk Authorization Code to Yourself

Press the "Setup" icon (the Nut Icon on the top right), and you'll get the setup menu like this :

Press the "Email All" button, and it Blynk will email you a unique authorization code for your device. You will need to enter that Auth Code String into your Arduino sketch (program) and then download it to your hardware in order to pair your device with your smartphone.

Plug in your Arduino101

The first time you plug in your Arduino101 board, it may take several minutes to identify and load drivers. Don't worry if you get an error the first time, the USB serial port can get disabled during Arduino101 reset, and can sometimes fail before the drivers get loaded. Note which serial port get assigned (i.e. COM7, etc.)

Program your Arduino101 Bootloader

  • Start the Arduino IDE
  • Under "Tools->Board Manager" select the Arduino/Genuino101 board
  • Under "Tools->Board Manager" select the correct serial port (i.e. COM7)
  • Under "Tools->Board Manager" select Programmer: Arduino/Genuino101 Firmware Update
  • Under "Tools->Board Manager" select "Burn Bootloader"

This will insure that your boards file and bootloader version match. If you have problems uploading, try burning the bootloader again.

Program your Arduino101

  • Cut the Blynk Auth Code from your Email and paste it into the Arduino Sketch in place of the "XXXX''s"
  • From the Arduino IDE select "Sketch->Upload", and your project will compile and get loaded into flash memory.
  • The default Device name under Bluetooth is "hack01", you can change this in the sketch if you wish to uniquely identify your board.

Install your Adapter board and Relays

If not already installed, unplug the Arduino101 and add the boards as shown:

Now your smartphone screen should look like:

The first thing we need to do is to connect to the Arduino101 Bluetooth - so press the little "Bluetooth" icon on the display:

Now press the "Connect BLE device" button:

Select your device from the list, in the workshop they should have different names for each team's device. "hack02" is shown here...

The internal gears will spin a bit, and then you should get a connected message:

Use the <- back arrow to return to the Relayer setup screen

Now make sure to press the "play" arrow in the upper right hand corner of the screen to change from "setup" mode to "live" mode. If you press the buttons in "setup" mode (which has the dotted background screen), you can change the button settings. In "live" mode, the four buttons operate the four (4) relays, turning them on and off.

How does it work?

In a Blynk enabled sketch, you can either call out physical device pins to manipulate, or use virtual device pins. I prefer virtual device pins for flexibility in porting a project to different boards and/or devices. Virtual pins also allow for arbitrary data types to be passed back and forth across a connection - making it easy to use Wi-Fi, or Bluetooth radios with little or no code changes.

Virtual Pins

Virtual pins are named V0 thru Vxx and use a simple access method:

 int pinData = param.asInt(); 
 digitalWrite(relay1_pin, pinData); 

V1 controls Relay1, V2 controls Relay2, V3, controls Relay3, etc.

Under the Widget settings for buttons, slider, etc is a pin select menu, just pick an unused virtual pin number to add a new function, either read or write or both.

The widget above will display a value sent from the device on VIrtual Pin V5 with a range of 0-1023 and update frequency of 1 second. Simple widgets, like the button, have less parameters to set. Use "Delete" to remove unwanted widget and to restore your "Energy Points" for making other projects.

Don't Flood the Server...

Free accounts are limited to the amount of data they can upload to the server, typically 10 pins per second, which is plenty for most applications. The easiest way to do that is to use a SimpleTimer set to interrupt once per second and update the pins. Another trick I use is to only send data change updates, not the raw data; and if your input data is noisy, then filter it first. See this ESP32/Blynk project for a more advanced example using timers data change flags and filters.

Okay, I got it, what's next?

Now that we have simple control of pins working from the Bluetooth Low Energy radio, in the next project we'll read the Inertial Measurement Unit and transmit the sensor data back to the smartphone. The Arduino101 has both a 3D Gyro and a 3-D Accelerator that we'll wire up in the next installment...


Uses the Arduino 101 Bluetooth wireless interface to control four output pins, connected to four (4) mechanical relay units capable of switching over an amp of current each.
  Download latest Blynk library here:

  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials:
    Sketch generator: 
    Blynk community:  
    Social networks:  

  Blynk library is licensed under MIT license
  This example code is in public domain.

  Note: This requires CurieBLE library
    from http://librarymanager/all#CurieBLE

  Warning: Bluetooth support is in BETA!
/* This sketch uses four (4) Blynk virtaul pins to 
   control four (4) mechanical relay units.

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

#include <BlynkSimpleCurieBLE.h>
#include <CurieBLE.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";

BLEPeripheral  blePeripheral;

int relay1_pin = 6;
int relay2_pin = 10;
int relay3_pin = 5;
int relay4_pin = 9;

  int pinData = param.asInt();
  digitalWrite(relay1_pin, pinData);

  int pinData = param.asInt();
  digitalWrite(relay2_pin, pinData);

  int pinData = param.asInt();
  digitalWrite(relay3_pin, pinData);

  int pinData = param.asInt();
  digitalWrite(relay4_pin, pinData);

void setup()
  // Debug console
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB

  pinMode(relay1_pin, OUTPUT);
  pinMode(relay2_pin, OUTPUT);
  pinMode(relay3_pin, OUTPUT);
  pinMode(relay4_pin, OUTPUT);
  digitalWrite(relay1_pin, 0);
  digitalWrite(relay2_pin, 0);
  digitalWrite(relay3_pin, 0);
  digitalWrite(relay4_pin, 0);

  Blynk.begin(blePeripheral, auth);


  Serial.println("Waiting for BTLE connection...");

void loop()


Arduino_101_BLE_Relayer Presentation
Workshop Slides and Presentation
Arduino101 BLE Workshop Presentation
Presenters Slides and Notes


Similar projects you might like

Arduino101 Bluetooth Intertial Measurement Unit (IMU)

Project tutorial by Tom Moxon

  • 6 respects

Hackster Live April 2017 Workshop - Optional - Easy Add-on

Project tutorial by Katie Kristoff

  • 9 respects

Arduino101 / tinyTILE BLE: Match-Making Sunglasses

Project tutorial by Kitty Yeung

  • 50 respects

Home Automation With Arduino 101 Using Bluetooth Low Energy

Project tutorial by naveen manwani

  • 8 respects
Add projectSign up / Login