# Circuit Playground & Bluetooth Low Energy

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/034/546/medium800/circuit_playground_IMG_5098.jpg?1470197692)

[Circuit Playground](https://www.adafruit.com/product/3000) is an excellent all-in-one board&nbsp;for learning electronics, but did you know you can control Circuit Playground wirelessly from your phone or tablet? &nbsp;With the magic of Bluetooth Low Energy and a little helper like the [Flora Bluefruit LE module](https://www.adafruit.com/product/2487) you can start experimenting with wireless control of Circuit Playground today!

Adafruit's Bluefruit LE Connect apps for both iOS and Android provide a simple&nbsp;interface for controlling the digital inputs/outputs on Circuit Playground. &nbsp;Toggle digital pins high or low to control LEDs, relays, or other digital devices. &nbsp;Read digital inputs to detect when buttons are pressed or simple digital sensors activate. &nbsp;You can even control the color of the NeoPixels on Circuit Playground&nbsp;wirelessly from a few clicks in the app.

Best of all there's no soldering required for this project--just connect a few components with alligator clips and you're all set!

Before you get started you'll want to familiarize yourself with a few guides:

- [Adafruit Circuit Playground](../../../../introducing-circuit-playground/overview)
- [Introduction to Bluetooth Low Energy](../../../../introduction-to-bluetooth-low-energy/introduction)

Continue on to learn about the parts needed to follow this guide.

# Circuit Playground & Bluetooth Low Energy

## Parts

![](https://cdn-learn.adafruit.com/assets/assets/000/034/537/medium800/circuit_playground_IMG_5114.jpg?1470195557)

To follow this guide&nbsp;you'll need the following parts:

- **[Circuit Playground](https://www.adafruit.com/products/3000)**
- **[Flora Bluefruit LE](https://www.adafruit.com/products/2487)** or **[Bluefruit LE UART Friend](https://www.adafruit.com/product/2479)**

  - I recommend using the [Flora Bluefruit LE module](https://www.adafruit.com/product/2487) with Circuit Playground because&nbsp;it has big pads&nbsp;that are easy to connect with alligator clips--no soldering necessary! &nbsp;You could however use a Bluefruit LE UART friend module but you'll need to solder headers or wires to it and Circuit Playground. &nbsp;**Be aware only Bluefruit LE modules with a serial connection (like Flora Bluefruit LE or Bluefruit LE UART Friend) will work with Circuit Playground!**

- **[Alligator Clip Test Leads](https://www.adafruit.com/products/1592)**

  - To reduce noise on the serial connection try to use short cables (less than 12" or so). &nbsp;Longer cables should&nbsp;still work but you might notice small glitches or errors from time to time.

- **Android or iOS device with Bluetooth Low Energy support**

  - You'll need to run the Bluefruit LE Connect application from Adafruit which is available on both Android and iOS platforms. &nbsp;Make sure your device has Bluetooth Low Energy support (not just Bluetooth 'Classic' support, LE is different!). &nbsp;Most phones and tablets sold in the last ~5 years should have Bluetooth LE support.

If you're using the Flora Bluefruit LE module this project is very easy to put together and requires no soldering--just connect components with alligator clip wires as shown on the next page!

# Circuit Playground & Bluetooth Low Energy

## Wiring

To connect a Flora Bluefruit LE module to Circuit Playground wire it up as follows:

![](https://cdn-learn.adafruit.com/assets/assets/000/034/196/medium800/circuit_playground_Wiring_Diagram_bb.png?1469124767)

![](https://cdn-learn.adafruit.com/assets/assets/000/034/538/medium800/circuit_playground_IMG_5093.jpg?1470195924)

- **Circuit Playground 3.3V** to **Flora Bluefruit LE 3.3V** (red wire).
- **Circuit Playground GND** to **Flora Bluefruit GND** (black wire).
- **Circuit Playground serial TX** to **Flora Bluefruit serial RX** (yellow wire). &nbsp;Double check you connect **TX to RX** and not TX to TX!
- **Circuit Playground serial RX** to **Flora Bluefruit serial TX** (green wire). &nbsp;Again double check you connect **RX to TX** and not RX to RX!
- **Circuit Playground #12** to **Flora Bluefruit MODE** (blue wire). &nbsp;You can actually use any of the other numbered pins on Circuit Playground for this&nbsp;mode switch connection, however you'll need to modify the examples to use the pin number. &nbsp;For simplicity stick with pin 12 so you don't need to modify the code in the rest of the guide.

Note if you're using a Bluefruit LE UART Friend the connections are&nbsp;the same but the MODE pin is labeled MOD, 3.3V is labeled VIN, RX is labeled RXI, and TX is labeled TXO. &nbsp;In addition you can ignore the other pins like CTS, RTS, and DFU.

**One last very important step is to flip the mode switch on the Flora Bluefruit LE module (or Bluefruit LE UART Friend) into the DATA position.** &nbsp;If the switch is in the CMD position the software won't work correctly so be careful to double check the switch is in DATA mode.

Danger: 

# Circuit Playground & Bluetooth Low Energy

## Arduino Setup

After wiring the Bluefruit LE module to Circuit Playground you'll need to do a small bit of software setup to run the examples.

First if you're new to Circuit Playground be sure to [follow its guide](../../../../introducing-circuit-playground) to setup Arduino for programming the board. &nbsp;Make sure you can load some of the basic examples like blinking a LED on the board before continuing further. &nbsp;Also don't forget to [install the Circuit Playground library](../../../../introducing-circuit-playground/libraries) in Arduino as the guide mentions.

Next follow the [Bluefruit LE module guide](../../../../adafruit-flora-bluefruit-le/overview) to install the necessary Arduino libraries for using the module. &nbsp;In particular you need to install this library (use the library manager in Arduino to search for and easily install it):

- [Adafruit Bluefruit LE nRF51](https://github.com/adafruit/Adafruit_BluefruitLE_nRF51)

That should be all the setup necessary to&nbsp;program Circuit Playground with sketches that use a Bluefruit LE module! &nbsp;The next pages explain example sketches to control Circuit Playground with the Bluefruit LE module.

# Circuit Playground & Bluetooth Low Energy

## Pin IO

https://www.youtube.com/watch?v=UXfdgqjBSpQ

Pin IO is a way to control the digital inputs, outputs, and more on Circuit Playground wirelessly from a phone or tablet. &nbsp;Right now only basic components like digital inputs, outputs, and even PWM (i.e. dimming an LED) are controllable&nbsp;with pin IO.

Pin IO works using&nbsp;the [Firmata protocol](https://github.com/firmata/arduino) to remotely control the Circuit Playground. &nbsp;Normally Firmata is used with a USB or serial connection between an Arduino and a computer. &nbsp;However by hooking up a Bluefruit LE module to the serial pins on Circuit Playground you can wirelessly talk the Firmata protocol to control Circuit Playground too. &nbsp;You don't need to write any code to control the board--just load the Bluefruit LE Connect iOS or Android apps!

To use&nbsp;pin IO mode make sure you've followed all of the previous pages in this guide and have a Circuit Playground wired to a Bluefruit LE module, and the Arduino IDE setup to program both Circuit Playground and the Bluefruit LE module.

Next install the following Arduino library (use the library manager to find it, filter to **BLEFirmata** and install the Adafruit BLEFirmata library):

- [Adafruit BLE Pin IO Library](https://github.com/adafruit/Adafruit_BLE_PinIO)

Once the library is installed open the&nbsp; **CircuitPlayground\_nRF51822** example from the library in Arduino. &nbsp;This sketch implements the Firmata protocol and uses the Bluefruit LE module to listen for commands.

![](https://cdn-learn.adafruit.com/assets/assets/000/034/540/medium800/circuit_playground_Screen_Shot_2016-08-02_at_8.48.21_PM.png?1470196647)

You don't need to make any modificiations to the sketch to use it,&nbsp;however if you changed the mode pin from 12 to something else you will need to modify the&nbsp; **BLUEFRUIT\_UART\_MODE\_PIN** define in the BluefruitConfig.h tab.

Upload the sketch to Circuit Playground and you should be ready to start controlling the pins with either the [Bluefruit LE Connect iOS app](https://itunes.apple.com/us/app/adafruit-bluefruit-le-connect/id830125974?mt=8) or [Bluefruit LE Connect Android app](https://play.google.com/store/apps/details?id=com.adafruit.bluefruit.le.connect). &nbsp;If you haven't used the Bluefruit LE Connect app before be sure to [skim the guide on its usage](../../../../bluefruit-le-connect-for-ios/pin-i-slash-o) (although the guide is for iOS that application is very similar on Android).

Danger: 

&nbsp;Some of the components on Circuit Playground work just with digital IO and pin control:

- The red LED on the board is pin 13 and can be turned on or off as a digital output.
- The slide switch is pin 21 and will read a low level when on the right/+ and high level when on the left/-.
- The left push button is pin 4 and right push button is pin 19, each will read a low level when not pressed and a high level when pressed.

Try pushing the buttons or moving the slide switch--you should see the pin state change in the Bluefruit LE Connect application. &nbsp;That's all there is to the basics of controlling digital pins wirelessly with Bluefruit LE & Circuit Playground!

# Circuit Playground & Bluetooth Low Energy

## NeoPixels

In addition to toggling pins on Circuit Playground you can also control the color of its NeoPixel LEDs wirelessly from a phone or tablet. &nbsp;The Bluefruit LE Connect iOS and Android apps&nbsp;have a special color picker mode which makes it easy to change pixel colors.

To use this NeoPixel control sketch make sure you've followed all the steps in this guide and have a Circuit Playground wired up to a Bluefruit LE module. &nbsp;In addition make sure you have the Circuit Playground and Adafruit Bluefruit LE nRF51 Arduino libraries installed as [previously mentioned](../../../../circuit-playground-and-bluetooth-low-energy/software).

Next open the Arduino IDE and pick the **cplay\_neopixel\_picker** example from the **Adafruit Bluefruit LE nRF51 library.**

![](https://cdn-learn.adafruit.com/assets/assets/000/034/505/medium800/circuit_playground_Screen_Shot_2016-08-02_at_3.38.47_PM.png?1470177566)

You shouldn't need to modify anything in the sketch, however there are some #define values near the top that can adjust the behavior like the intensity of the NeoPixel brightness. &nbsp;Also&nbsp;if you changed the mode pin from 12 to something else you will need to modify the&nbsp; **BLUEFRUIT\_UART\_MODE\_PIN** define in the BluefruitConfig.h tab.

Upload the sketch to Circuit Playground and you should be ready to start controlling the NeoPixels&nbsp;with either the [Bluefruit LE Connect iOS app](https://itunes.apple.com/us/app/adafruit-bluefruit-le-connect/id830125974?mt=8) or [Bluefruit LE Connect Android app](https://play.google.com/store/apps/details?id=com.adafruit.bluefruit.le.connect). &nbsp;If you haven't used the Bluefruit LE Connect app before be sure to [skim the guide on its usage](../../../../bluefruit-le-connect-for-ios/controller) (although the guide is for iOS that application is very similar on Android).

Danger: 

That's all there is to controlling Circuit Playground's NeoPixels with a Bluefruit LE module & Bluetooth Low Energy!


## Featured Products

### Circuit Playground Classic

[Circuit Playground Classic](https://www.adafruit.com/product/3000)
Would you like to learn electronics, with an all-in-one board that has sensors and LEDs built in? **Circuit Playground** is here - and it's the best way to practice programming on real hardware with no soldering or sewing required!

This is the **Classic**...

In Stock
[Buy Now](https://www.adafruit.com/product/3000)
[Related Guides to the Product](https://learn.adafruit.com/products/3000/guides)
### Flora Wearable Bluefruit LE Module

[Flora Wearable Bluefruit LE Module](https://www.adafruit.com/product/2487)
Would you like to add powerful and easy-to-use Bluetooth Low Energy to your wearable FLORA project? Heck yeah! With BLE now included in modern smart phones and tablets, its fun to add wireless connectivity. So what you really need is the new Adafruit Flora Bluefruit LE!

The Flora...

No Longer Stocked
[Buy Now](https://www.adafruit.com/product/2487)
[Related Guides to the Product](https://learn.adafruit.com/products/2487/guides)
### Short Wire Alligator Clip Test Lead (set of 12)

[Short Wire Alligator Clip Test Lead (set of 12)](https://www.adafruit.com/product/1592)
Connect this to that without soldering using these handy mini alligator clip test leads. Approximately 4.5" overall cables with alligator clip on each end, color coded. You get 12 pieces in 6 colors. Strong and grippy, these always come in handy! We often use these in conjunction with a...

In Stock
[Buy Now](https://www.adafruit.com/product/1592)
[Related Guides to the Product](https://learn.adafruit.com/products/1592/guides)
### Small Alligator Clip Test Lead (set of 12)

[Small Alligator Clip Test Lead (set of 12)](https://www.adafruit.com/product/1008)
Connect this to that without soldering using these handy mini alligator clip test leads. 15" cables with alligator clip on each end, color coded. You get 12 pieces in 6 colors. Strong and grippy, these always come in handy! We often use these in conjunction with a multimeter so we...

Out of Stock
[Buy Now](https://www.adafruit.com/product/1008)
[Related Guides to the Product](https://learn.adafruit.com/products/1008/guides)

## Related Guides

- [Introducing Circuit Playground](https://learn.adafruit.com/introducing-circuit-playground.md)
- [Dear Diary Alarm](https://learn.adafruit.com/dear-diary-alarm.md)
- [Circuit Playground Kaleidoscope](https://learn.adafruit.com/circuit-playground-kaleidoscope.md)
- [Circuit Playground Yoyo](https://learn.adafruit.com/circuit-playground-yoyo.md)
- [Glowing Smokey Skull ](https://learn.adafruit.com/glowing-smokey-skull.md)
- [Adalight for Circuit Playground](https://learn.adafruit.com/adalight-for-circuit-playground.md)
- [Sipping Power With NeoPixels](https://learn.adafruit.com/sipping-power-with-neopixels.md)
- [Sword & Wand Prop Effects with Circuit Playground](https://learn.adafruit.com/sword-and-wand-prop-effects-with-circuit-playground.md)
- [Circuit Playground PZ-1: Pizza Box DJ Controller](https://learn.adafruit.com/circuit-playground-pizza-box-dj-controller.md)
- [Circuit Playground Digital Input](https://learn.adafruit.com/circuit-playground-digital-input.md)
- [Circuit Playground Beep Beep](https://learn.adafruit.com/circuit-playground-beep-beep.md)
- [Circuit Playground & Fiber Optics](https://learn.adafruit.com/circuit-playground-light-pod.md)
- [Mystery Box: The Freefall Deck](https://learn.adafruit.com/mystery-box-freefall-deck.md)
- [Circuit Playground or Hallowing Jack-o'-Lantern](https://learn.adafruit.com/circuit-playground-jack-o-lantern.md)
- [Circuit Playground Sound and Music](https://learn.adafruit.com/circuit-playground-music.md)
- [NeoPix Arcade Kit - 1D Arcade Game System - Circuit Playground](https://learn.adafruit.com/neopix-arcade-kit-1d-arcade-game-system-circuit-playground.md)
