Introduction: LED Bluetooth Control Using NRF Connect

This is the last module on the Arduino 101 Essentials series and marks the beginning of a new Arduino 101 BLE uses series.

This is an introduction on how to use the Bluetooth Low Energy capabilities of the Arduino 101 to control an LED remotely over BLE4.1. Furthermore, this uses an app that is very versatile and flexible for developers and is only compatible with the Arduino 101, called nRF Connect, which is quite different from it's other bluetooth counterparts like Blink. This can be applied to a number of other applications, from reading bluetooth unlocked.

The fact that the Arduino 101 possesses Bluetooth Low Energy (BLE4.1) is what makes it unique and different from all the other Arduino boards. It allows us to connect with our circuits remotely over bluetooth, even from another room!

Step 1: BoM

Arduino 101 (or any bluetooth capable Arduino boards)

LED

100Ω resistor

Jumper Wire

Breadboard

Step 2: Wiring

Connect the anode (positive pin) of the LED to a 100Ω resistor.

Then, connect this 100Ω resistor in series to pin 9 on the Arduino.

Connect the cathode (negative pin) of the LED to the ground pin of the Arduino 101 labeled as GND.

Step 3: Coding

The code is vastly different and more complex than any simple blinking an LED demo, since it needs to activate the bluetooth and interface properly. You can also change the name of your board under the command,

blePeripheral.setLocalName("Tech Martian");

This is the name that will show up in the App itself, so name it uniquely.

// if a central is connected to peripheral:
if (central)
{
// while the central is still connected to peripheral:
while (central.connected())
{
// if the remote device wrote to the characteristic,
// use the value to control the LED:
if (switchCharacteristic.written())
{
// any value other than 0, turn on the LED
if (switchCharacteristic.value())
{
digitalWrite(ledPin, HIGH);
}
//else turn the LED off
else
{
digitalWrite(ledPin, LOW);
}
}
}
}
}