Circuit Playground Bluefruit is our third board in the Circuit Playground series, another step towards a perfect introduction to electronics and programming. We've taken the popular Circuit Playground Express and made it even better! Now the main chip is an nRF52840 microcontroller which is not only more powerful, but also comes with Bluetooth Low Energy support for wireless connectivity.

The board is round and has alligator-clip pads around it so you don't have to solder or sew to make it work. You can power it from USB, a AAA battery pack, or with a Lipoly battery (for advanced users). Circuit Playground Bluefruit has built-in USB support. Built in USB means you plug it in to program it and it just shows up, no special cable or adapter required. Just program your code into the board then take it on the go!

You can also use MakeCode's block-based GUI coding environment on this board.

Here's some of the great goodies baked in to each Circuit Playground Bluefruit:

  • 1 x nRF52840 Cortex M4 processor with Bluetooth Low Energy support
  • 10 x mini NeoPixels, each one can display any color
  • 1 x Motion sensor (LIS3DH triple-axis accelerometer with tap detection, free-fall detection)
  • 1 x Temperature sensor (thermistor)
  • 1 x Light sensor (phototransistor). Can also act as a color sensor and pulse sensor.
  • 1 x Sound sensor (MEMS microphone)
  • 1 x Mini speaker with class D amplifier (7.5mm magnetic speaker/buzzer)
  • 2 x Push buttons, labeled A and B
  • 1 x Slide switch
  • 8 x alligator-clip friendly input/output pins
  • Includes I2C, UART, 6 pins that can do analog inputs, multiple PWM outputs
  • Green "ON" LED so you know its powered
  • Red "#13" LED for basic blinking
  • Reset button
  • 2 MB of SPI Flash storage, used primarily with CircuitPython to store code and libraries.
  • MicroUSB port for programming and debugging
  • USB port can act like serial port, keyboard, mouse, joystick or MIDI!

Guided Tour

Let us take you on a tour of your Circuit Playground Bluefruit, which we'll shorten to CPB.

Power and Data

Micro B USB connector

This is at the top of the board. We went with the tried and true micro-B USB connector for power and/or USB communication (bootloader, serial, HID, etc). Use with any computer with a standard data/sync cable.

JST Battery Input

This is at the bottom of the board. You can take your CPB anywhere and power it from an external battery. This pin can take up 6V DC input, and has reverse-polarity, over-current and thermal protections. The circuitry inside will use either the battery input power or USB power, safely switching from one to the other. If both are connected, it will use whichever has the higher voltage. Works great with a Lithium Polymer battery or our 3xAAA battery packs with a JST connector on the end. There is no built in battery charging (so that you can use Alkaline or Lithium batteries safely)

Alligator/Croc Clip Pads

To make it super-easy to connect to the microcontroller, we have 14 connection pads. You can solder to them, use alligator/croc clips, sew with conductive thread, even use small metal screws!

Of the 14 pads, you get a wide range of power pins, I2C, UART, Analog In, Digital In/Out, PWM, and Analog Out.

Some of them can even sense the touch of your finger!

See the next pinouts page for more details!

Microchips

The brains of the operation is the nRF52840 Cortex M4 processor with Bluetooth Low Energy support. It sits at the top center and is what allows you to run CircuitPython or Arduino!

The Bluetooth antenna for the nRF52840 Bluetooth functionality is located in the center of the board. If you run into issues with Bluetooth range, make sure there's nothing near the antenna that might interfere, such as metallic surfaces!

We have added a storage chip, called SPI Flash. This is a very, very small disk drive, only 2 MB large. You can use this in Arduino or CircuitPython to store files. In CircuitPython this is where all your code lives, and what you see when you use the CIRCUITPY drive on your computer.

LEDs

Green ON LED

To the left of the USB connector. This LED lets you know that the CPB is powered on. If it's lit, power is good! If it's dim, flickering or off, there's a power problem and you will have problems. You can't disable this light, but you can cover it with electrical tape if you want to make it black.

Red #13 LED

To the right of the USB connector. This LED does double duty. Its connected with a series resistor to the digital #13 GPIO pin. It pulses nicely when the CPB is in bootloader mode, and its also handy for when you want an indicator LED. Many first projects blink this LED to prove that programming worked.

10 x Color NeoPixel LED

The ten LEDs surrounding the outer edge of the boards are all full color, RGB LEDs, each one can be set to any color in the rainbow. Great for beautiful lighting effects! The NeoPixels will also help you know when the bootloader is running (they will turn green) or if it failed to initialize USB when connected to a computer (they will turn red).

Speaker

The CPB includes a speaker. It's not going to compete with your HiFi stereo, but it can play simple songs and tones.

The speaker is the squarish gray chunk on the bottom left of the board. There is a small class D amplifier connected to the speaker so it can get quite loud! Note: it won't sound good if too loud, so some experimentation may be necessary

The amplifier is connected to the PWM output AUDIO pin -- this pin is also available on one of the connection pads in the lower right.

If you do not want the internal speaker to make noise, you can turn it off using the shutdown control on pin #11

Sensors

The Circuit Playground Bluefruit has a large number of sensor inputs that let you add all sorts of interactivity to your project.

Light Sensor

There is an analog light sensor, part number ALS-PT19, in the top left part of the board. This can be used to detect ambient light, with similar spectral response to the human eye.

This sensor is connect to analog pin A8 and will read between 0 and 1023 with higher values corresponding to higher light levels. A reading of about 300 is common for most indoor light levels.

With some clever code, you can use this as a color sensor or even a pulse sensor!

Temperature Sensor

There is an NTC thermistor (Murata NCP15XH103F03RC) that we use for temperature sensing. While it isn't an all-in-one temperature sensor, with linear output, it's easy to calculate the temperature based on the analog voltage on analog pin A9. There's a 10K resistor connected to it as a pull down.

Microphone Audio Sensor

A MEMS microphone can be used to detect audio levels and even perform basic FFT functions. Instead of an analog microphone, that requires an external op-amp and level management, we've decided to go with a PDM microphone. This is a digital mic, and is a lot smaller and less expensive! You will have to use the CircuitPython/Arduino support libraries to read the audio volume, you cannot read it like an analog voltage

Motion Sensor

We can sense motion with an accelerometer. This sensor detects acceleration which means it can be used to detect when its being moved around, as well as gravitational pull in order to detect orientation.

The LIS3DH 3-axis XYZ accelerometer is in the dead center of the board and you can use it to detect tilt, gravity, motion, as well as 'tap' and 'double tap' strikes on the board. The LIS3DH is connected to an internal I2C pinset (not the same as the ones on the pads) and has an optional interrupt output on digital pin D24.

Capacitive Touch

The CBP has capacitive touch capabilities. This is a great way to sense human touch without additional components. Even animals will work if it's directly touching their skin!

On the Bluefruit you get seven capacitive touch pads: A1 - A6 and TX. Capacitive touch is supported in both CircuitPython and Arduino!

Switches & Buttons

There are two large A and B buttons, connected to digital D4 (Left) and D5 (Right) each. These are unconnected when not pressed, and connected to 3.3V when pressed, so they read HIGH. Set the pins D4 (BUTTON_A in CircuitPython) and D5 (BUTTON_B in CircuitPython) to use an internal pull-down resistor when reading these pins so they will read LOW when not pressed.

This small button in the center of the board is for Resetting the board. You can use this button to restart or reset the CPB.

If using Arduino or CircuitPython, press this button once to reset, double-click to enter the bootloader manually.

There is a single slide switch near the center bottom of the Circuit Playground Bluefruit. It is connected to digital D7. The switch is unconnected when slid to the left and connected to ground when slid to the right. We set pin D7 to use an internal pull-up resistor so that the switch will read HIGH when slid to the left and LOW when slid to the right.

This is not an on-off switch, but you can use code to have this switch control how you want your project to behave

Note that you need to use an internal pull-up for the slide switch, but an internal pull-down for the push-buttons.

Despite having only 14 pads with 8 general purpose I/O pins available, there are a lot of possibilities with Circuit Playground Bluefruit. We went over all the internals in the last page. On this page we'll go through each pin/pad to explain what you can do with it.

Other than the Audio pad, no external I/O pads are shared with internal sensors/devices, so you do not need to worry about 'conflicting' pins or interactions!

Power Pads

There are 6 power pads available, equally spaced around the perimeter.

  • GND - there are 3 x Ground pads. They are all connected together, and are all the signal/power ground connections
  • 3.3V - there are two 3.3 Volt output pads. They are connected to the output of the onboard regulator. The regulator can provide about 500mA max, but that includes all the built in parts too! So you should roughly budget about 300mA available for your usage (450mA if you are not using the onboard NeoPixels)
  • Vout - there is one Voltage Output pad. This is a special power pad, it will be connected to either  the USB power or the battery input, whichever has the higher voltage. This output does not connect to the regulator so you can draw as much current as your USB port / Battery can provide. There is a resettable fuse on this pin, so you can draw about 500mA continuous, and 1 Amp peak before it will trip. If the fuse trips, just wait a minute and it will automatically reset

If you want to connect chips, sensors, and low power electronics that requires 3.3V clean power, use the 3.3V pads.

If you want to connect servos, NeoPixels, DotStars or other high power electronics that are OK up to 5V, use the Vout pad.

Input/Output Pads

Next we will cover the 8 GPIO (General Purpose Input Ouput) pins! For reference you may want to also check out the datasheet-reference in the downloads section for the core nRF52840. We picked pins that have a lot of capabilities.

Common to all pads

All the GPIO pads can be used as digital inputs, digital outputs, for LEDs, buttons and switches. In addition, A1-A6 can be used as analog inputs (12-bit ADC) (TX and Audio can not!). All but Audio can be used for  capacitive touch. All pads can also be used as hardware interrupt inputs.

Each pad can provide up to ~20mA of current. Don't connect a motor or other high-power component directly to the pins! Instead, use a transistor to power the DC motor on/off

All of the GPIO pads are 3.3V output level, and should not be used with 5V inputs. In general, most 5V devices are OK with 3.3V output though.

Other than Audio, which is shared with the speaker, all of the pads are completely 'free' pins, they are not used by the USB connection, LEDs, sensors, etc so you never have to worry about interfering with them when programming.

Each Pin!

Let's start with Audio which is in the bottom right corner, and work our way counter-clockwise. Because the nRF52840 is flexible with PWM pins, you can make any of the pins PWM outputs

  • Audio (a.k.a D12) - This is a designated pin that is OK with high speed PWM signal, so it's great for playing basic audio clips - it's also connected to the little speaker on board. In can be digital I/O, but if you do that it will interfere with the built-in speaker. This is the one pin that cannot be used for capacitive touch.
  • A1 / D6 - This pin can be digital I/O, or analog input and can be capacitive touch sensor
  • A2 / D9 - This pin can be digital I/O, or analog input and can be capacitive touch sensor
  • A3 / D10 - This pin can be digital I/O, or analog input and can be capacitive touch sensor
  • A4 / SCL / D3 - This pin can be digital I/O, or analog input. This pin is also the designated I2C SCL pin, and can be capacitive touch sensor
  • A5 / SDA / D2 - This pin can be digital I/O, or analog input. This pin is also the designated I2C SDA pin, and can be capacitive touch sensor
  • A6 / RX / D0 - This pin can be digital I/O, or analog Input. This pin has PWM output, Serial Receive, and can be capacitive touch sensor
  • TX / D1 - This pin can be digital I/O. This pin has PWM output, Serial Transmit, and can be capacitive touch sensor

Internally Used Pins!

These are the names of the pins that are used for built in sensors and such! CircuitPython has more user friendly names available as well for some pins with things like buttons and LEDs on them - these are included in parentheses where applicable. Both names will work in CircuitPython!

  • D4 (BUTTON_A) - Left Button A
  • D5 (BUTTON_B) - Right Button B
  • D7 (SLIDE_SWITCH)- Slide Switch
  • D8 (NEOPIXEL) - Built-in 10 NeoPixels
  • D12 / AUDIO (SPEAKER) - Speaker analog output
  • D13 - Red LED
  • A8 (LIGHT) - Light Sensor
  • A9 (TEMPERATURE) - Temperature Sensor
  • D24 - PDM mic data
  • D25 - PDM mic clock
  • D26 - Internal I2C SCL for accelerometer
  • D27 - Accelerometer interrupt
  • D28 - Internal I2C SDA for accelerometer
  • D29 ~ D34 - QSPI FLASH chip pins

What is CircuitPython?

CircuitPython is a programming language designed to simplify experimenting and learning to program on low-cost microcontroller boards. It makes getting started easier than ever with no upfront desktop downloads needed. Once you get your board set up, open any text editor, and get started editing code. It's that simple.

CircuitPython is based on Python

Python is the fastest growing programming language. It's taught in schools and universities. It's a high-level programming language which means it's designed to be easier to read, write and maintain. It supports modules and packages which means it's easy to reuse your code for other projects. It has a built in interpreter which means there are no extra steps, like compiling, to get your code to work. And of course, Python is Open Source Software which means it's free for anyone to use, modify or improve upon.

CircuitPython adds hardware support to all of these amazing features. If you already have Python knowledge, you can easily apply that to using CircuitPython. If you have no previous experience, it's really simple to get started!

Why would I use CircuitPython?

CircuitPython is designed to run on microcontroller boards. A microcontroller board is a board with a microcontroller chip that's essentially an itty-bitty all-in-one computer. The board you're holding is a microcontroller board! CircuitPython is easy to use because all you need is that little board, a USB cable, and a computer with a USB connection. But that's only the beginning.

Other reasons to use CircuitPython include:

  • You want to get up and running quickly. Create a file, edit your code, save the file, and it runs immediately. There is no compiling, no downloading and no uploading needed.
  • You're new to programming. CircuitPython is designed with education in mind. It's easy to start learning how to program and you get immediate feedback from the board.
  • Easily update your code. Since your code lives on the disk drive, you can edit it whenever you like, you can also keep multiple files around for easy experimentation.
  • The serial console and REPL. These allow for live feedback from your code and interactive programming.
  • File storage. The internal storage for CircuitPython makes it great for data-logging, playing audio clips, and otherwise interacting with files.
  • Strong hardware support. There are many libraries and drivers for sensors, breakout boards and other external components.
  • It's Python! Python is the fastest-growing programming language. It's taught in schools and universities. CircuitPython is almost-completely compatible with Python. It simply adds hardware support.

This is just the beginning. CircuitPython continues to evolve, and is constantly being updated. We welcome and encourage feedback from the community, and we incorporate this into how we are developing CircuitPython. That's the core of the open source concept. This makes CircuitPython better for you and everyone who uses it!

CircuitPython on Circuit Playground Bluefruit

Install or Update CircuitPython

Follow this quick step-by-step to install or update CircuitPython on your Circuit Playground Bluefruit.

Click the link above and download the latest UF2 file

Download and save it to your Desktop (or wherever is handy)

Plug your Circuit Playground Bluefruit into your computer using a known-good data-capable USB cable.

A lot of people end up using charge-only USB cables and it is very frustrating! So make sure you have a USB cable you know is good for data sync.

Double-click the small Reset button in the middle of the CPB (indicated by the red arrow in the image). The ten NeoPixel LEDs will all turn red, and then will all turn green. If they turn all red and stay red, check the USB cable, try another USB port, etc. The little red LED next to the USB connector will pulse red - this is ok!

If double-clicking doesn't work the first time, try again. Sometimes it can take a few tries to get the rhythm right!

(If double-clicking doesn't do it, try a single-click!)

You will see a new disk drive appear called CPLAYBTBOOT.

 

 

 

Drag the adafruit_circuitpython_etc.uf2 file to CPLAYBTBOOT.

The LEDs will turn red. Then, the CPLAYBTBOOT drive will disappear and a new disk drive called CIRCUITPY will appear.

That's it, you're done! :)

CircuitPython Playground

Here are examples of some of the many things you can do with the Circuit Playground Bluefruit with CircuitPython!

Many of the following examples are shown using Circuit Playground Express. The code works exactly the same way on the Circuit Playground Bluefruit. Simply copy the code and follow along with your Circuit Playground Bluefruit!

Arduino Support Setup

You can install the Adafruit Bluefruit nRF52 BSP (Board Support Package) in two steps:

nRF52 support requires at least Arduino IDE version 1.8.6! Please make sure you have an up to date version before proceeding with this guide!
Please consult the FAQ section at the bottom of this page if you run into any problems installing or using this BSP!

1. BSP Installation

Recommended: Installing the BSP via the Board Manager

  • Download and install the Arduino IDE (At least v1.8)
  • Start the Arduino IDE
  • Go into Preferences
  • Add https://www.adafruit.com/package_adafruit_index.json as an 'Additional Board Manager URL' (see image below)
  • Restart the Arduino IDE
  • Open the Boards Manager option from the Tools -> Board menu and install 'Adafruit nRF52 by Adafruit' (see image below)

It will take up to a few minutes to finish installing the cross-compiling toolchain and tools associated with this BSP.

The delay during the installation stage shown in the image below is normal, please be patient and let the installation terminate normally:

  • Once the BSP is installed, select 'Adafruit Bluefruit nRF52832 Feather' (for the nRF52 Feathger) of 'Adafruit Bluefruit nRF52840 Feather Express' (for the nRF52840 Feather) from the Tools -> Board menu, which will update your system config to use the right compiler and settings for the nRF52:

2. LINUX ONLY: adafruit-nrfutil Tool Installation

adafruit-nrfutil is a modified version of Nordic's nrfutil, which is used to flash boards using the built in serial bootloader. It is originally written for python2, but have been migrated to python3 and renamed to adafruit-nrfutil since BSP version 0.8.5.

This step is only required on Linux, pre-built binaries of adafruit-nrfutil for Windows and MacOS are already included in the BSP. That should work out of the box for most setups.

Install python3 if it is not installed in your system already

Download: file
$ sudo apt-get install python3

Then run the following command to install the tool from PyPi

Download: file
$ pip3 install --user adafruit-nrfutil

Add pip3 installation dir to your PATH if it is not added already. Make sure adafruit-nrfutil can be executed in terminal by running

Download: file
$ adafruit-nrfutil version
adafruit-nrfutil version 0.5.3.post12

3. Update the bootloader (nRF52832 ONLY)

To keep up with Nordic's SoftDevice advances, you will likely need to update your bootloader if you are using the original nRF52832 based Bluefruit nRF52 Feather boards.

Follow this link for instructions on how to do that

This step ISN'T required for the newer nRF52840 Feather Express, which has a different bootloader entirely!

Advanced Option: Manually Install the BSP via 'git'

If you wish to do any development against the core codebase (generate pull requests, etc.), you can also optionally install the Adafruit nRF52 BSP manually using 'git', as decribed below:

Adafruit nRF52 BSP via git (for core development and PRs only)

  1. Install BSP via Board Manager as above to install compiler & tools.
  2. Delete the core folder nrf52 installed by Board Manager in Adruino15, depending on your OS. It could be
    macOS~/Library/Arduino15/packages/adafruit/hardware/nrf52
    Linux~/.arduino15/packages/adafruit/hardware/nrf52
    Windows%APPDATA%\Local\Arduino15\packages\adafruit\hardware\nrf52
  3. Go to the sketchbook folder on your command line, which should be one of the following:
    macOS: ~/Documents/Arduino
    Linux: ~/Arduino
    Windows: ~/Documents/Arduino
  4. Create a folder named hardware/Adafruit, if it does not exist, and change directories into it.
  5. Clone the Adafruit_nRF52_Arduino repo in the folder described in step 2:
    git clone [email protected]:adafruit/Adafruit_nRF52_Arduino.git
  6. This should result in a final folder name like ~/Documents/Arduino/hardware/Adafruit/Adafruit_nRF52_Arduino (macOS).

  7. Restart the Arduino IDE

Arduino BLE Examples

There are numerous examples available for the Bluefruit nRF52/nRF52840 Feathers in the Examples menu of the nRF52 BSP, and these are always up to date. You're first stop looking for example code should be there:

Example Source Code

The latest example source code is always available and visible on Github, and the public git repository should be considered the definitive source of example code for this board.

Documented Examples

To help explain some common use cases for the nRF52 BLE API, feel free to consult the example documentation in this section of the learning guide:

  • Advertising: Beacon - Shows how to use the BLEBeacon helper class to configure your Bleufruit nRF52 Feather as a beacon
  • BLE UART: Controller - Shows how to use the Controller utility in our Bluefruit LE Connect apps to send basic data between your peripheral and your phone or tablet.
  • Custom: HRM - Shows how to defined and work with a custom GATT Service and Characteristic, using the officially adopted Heart Rate Monitor (HRM) service as an example.
  • BLE Pin I/O (StandardFirmataBLE) Shows how to control Pin I/O of nRF52 with Firmata protocol

Bluefruit LE Connect

The Bluefruit LE Connect app provides iOS devices with a variety of tools to communicate with Bluefruit LE devices, such as the Circuit Playground Bluefruit! These tools cover basic communication and info reporting as well as more project specific uses such as remote button control and a NeoPixel color picker.

The iOS app is a free download from Apple's App Store. As of this writing, it requires iOS 11.3 or later and works on the iPhone, iPad, and iPod Touch.

Install Bluefruit LE

The first step is to install the app on your device.

Enable Bluetooth

If Bluetooth is disabled on your device, enable it by going to Setting > Bluetooth on your iOS device and then turning it on.

Enable Location Services

If you plan to use the app to send location/GPS data to Bluefruit LE, enable Location Services. Enable it on iOS using Settings->Privacy->Location Services.

Scan for Devices

Launch the app now -- it will automatically begin to scan the airwaves for Bluetooth LE devices. These are presented in a list at the bottom of the page.

Notice, you can use the Must have UART Service filter to prevent BLE devices from showing up that can't work with the app.

  • To refresh the list and start a new scan, simply swipe down on the current list.
  • Each device's signal strength is displayed in the left side of its row.

If you tap on the device entry (not on Connect), you'll see more detail about a particular device:

Connect

Tap the Connect button on the UART capable device you wish to use. The app will connect to the Circuit Playground Bluefruit! Now, you'll be presented with the Device name and signal strength, and a number of different Modules you can use.

 

Controller Module

Click on the Controller module. You'll see a number of different sensor data streaming options. Enabling these will allow you to send data from your phone, such as the Accelerometer data or Location data, directly to your Circuit Playground Bluefruit!

The two modules on this page that can send data to the Circuit Playground Bluefruit are the Control Pad and Color Picker.

Color Picker

Click on the Color Picker. Now, you can dial in the hue, saturation, and value of a color using the color wheel and value slider.

Follow this page for setting up the CPB with the color picker code.

Press the Send selected color button and your color values will be sent to the Circuit Playground Bluefruit to adjust its NeoPixels!

The app provides many other features with the additional modules. Have a look at the Bluefruit LE Connect for iOS and Android standalone guide for an explanation of each feature.

Downloads

This guide was first published on Sep 12, 2019. It was last updated on Sep 12, 2019.