ARTICLES

Control LED light color via an Arduino and an iPhone over BLE

This tutorial will show you how to control an RGB LED via an Arduino and an iOS device. It will utilize the LightShow app which lets you set a single color or create a light show with a sequence of colors.

If you want to control a Light Strip check out this tutorial instead.

Arduino_LED_BLE_Finished

 

Materials:

Common Cathode RGB LED

3 x 220-ohm resistors

nRF8001 BLE board

Arduino Uno

iOS device

 

Step 1: Attach the RGB LED

LED_Resistors_Wiring
    <div class="photoset-item photoset-image">
      <figure id="attachment_120" style="width: 72px" class="wp-caption aligncenter"><img src="/wp-content/uploads/2016/02/LED-72x300.jpg" alt="LED" width="72" height="300" srcset="/wp-content/uploads/2016/02/LED-72x300.jpg 72w, /wp-content/uploads/2016/02/LED.jpg 94w" sizes="(max-width: 72px) 100vw, 72px" /><figcaption class="wp-caption-text">The longest pin marked with a &#8211; is the cathode</figcaption></figure>
    </div>

    <div class="photoset-item photoset-image">
      <figure id="attachment_121" style="width: 300px" class="wp-caption aligncenter"><img src="/wp-content/uploads/2016/02/Resistors.jpg" alt="Resistors" width="300" height="300" srcset="/wp-content/uploads/2016/02/Resistors.jpg 300w, /wp-content/uploads/2016/02/Resistors.jpg 150w, /wp-content/uploads/2016/02/Resistors.jpg 270w, /wp-content/uploads/2016/02/Resistors.jpg 230w, /wp-content/uploads/2016/02/Resistors.jpg 390w" sizes="(max-width: 300px) 100vw, 300px" /><figcaption class="wp-caption-text">220-ohm resistor</figcaption></figure>
    </div>
  </div>
</div>

<div class="photoset-row cols-2">
</div>

Use a common cathode RGB LED and three 220-ohm resistors.

<p style="text-align: left;">
  The longest pin of the LED is the cathode and should be connected to the common ground.
</p>

<p style="text-align: left;">
  Connect a 220-ohm resistor between each of the LED&#8217;s anodes and the Arduino.
</p>

<p style="text-align: left;">
  Connect the Red, Green, and Blue pins to digital pins 3,5, and 6 respectively.
</p>

Step 2: Connect the Bluetooth Low Energy board

Arduino_LED_Resistors_BLE_Wiring
    <div class="photoset-item photoset-image">
      <img class="wp-image-66 size-medium aligncenter" src="/wp-content/uploads/2016/02/LightShow_BluetoothLE_nRF8001.jpg" alt="LightShow_BluetoothLE_nRF8001" />
    </div>
  </div>
</div>

Connect the nRF8001 Bluetooth LE breakout board to your breadboard. Connect the BLE pins to the Arduino as follows:

<ul>
  <li>
    SCK &#8211; 13
  </li>
  <li>
    MISO &#8211; 12
  </li>
  <li>
    MOSI &#8211; 11
  </li>
  <li>
    REQ &#8211; 10
  </li>
  <li>
    RST &#8211; 9
  </li>
  <li>
    RDY &#8211; 2
  </li>
</ul>

<p>
  Further information on the using the nRF8001 BLE board is available <a href="https://learn.adafruit.com/getting-started-with-the-nrf8001-bluefruit-le-breakout/introduction" rel="nofollow">here</a>.
</p>

Step 3: Upload the sketch to the Arduino

Clone or download the LightShow GitHub repository at https://github.com/kitefaster/LightShow.

  1. Copy and paste the Adafruit_BLE_UART folder located in the libraries directory into your Arduino/libraries/ folder.
  2. Launch the Arduino IDE and open the LightShow/LightShowArduino/LightShowArduino.ino sketch. Upload it to your Arduino board.

Step 4: Download and install the LightShow app

LightShow_iPhone5S_white_v1

Download and install the iOS LightShow app from the iTunes App Store.

<p>
  Launch the app and press the Action button on the top right. Locate your bluetooth device, named &#8220;HSLight&#8221; by default, and connect to it. Go back one screen and you should be able to remotely control the color of your LED.
</p>

 

 

 

 

 

 

 

Did you find this helpful? If so please leave a review via iTunes.

Need help?  Contact Us.



Our Products

Kitemetrics
Keyword level attribution for Apple Search Ads. Optimize your bids and increase your revenue. Sign up for free at kitemetrics.com.

White Noise and Deep Sleep Sounds
Calming and relaxing sounds that will help you sleep like a baby tonight.
Download for free from the App Store.
Get it on Google Play.




Our Sponsors

Get Sleepy
Get Sleepy
The free podcast that puts you to sleep with meditative bedtime stories. Listen at getsleepy.com.