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.
Materials:
iOS device
Step 1: Attach the RGB LED
<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 – 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’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
<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 – 13
</li>
<li>
MISO – 12
</li>
<li>
MOSI – 11
</li>
<li>
REQ – 10
</li>
<li>
RST – 9
</li>
<li>
RDY – 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.
- Copy and paste the Adafruit_BLE_UART folder located in the libraries directory into your Arduino/libraries/ folder.
- 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
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 “HSLight” 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
The free podcast that puts you to sleep with meditative bedtime stories. Listen at getsleepy.com.