NeoPixel Heart

In this project we’re building an LED heart with NeoPixels. This uses Black LED acrylic to diffuse the NeoPixels inside a 3D printed case. The heart is made from pieces of strips that are daisy chained to create a custom matrix.

3D Printed Case

The ItsyBitsy nRF52840 and 500mah lipo battery are housed in a separate 3D printed case. With a lipo backpack, you can recharge the battery over USB. We think this case will work nicely for your next wearable project. A button lets you trigger a reset, so you can easily update the firmware.

BLE with ItsyBitsy

You can change the colors of the LEDs using the Adafruit BLE Connect app for iOS or Android. You can also trigger LED animations like the classic Paint your Dragon rainbow swirl. With the ItsyBitsy nRF52840, you can easily add BLE to your wearable projects.

Parts List

Adafruit ItsyBitsy nRF52840 Express - Bluetooth LE

PRODUCT ID: 4481
What's smaller than a Feather but larger than a Trinket? It's an Adafruit ItsyBitsy nRF52840 Express featuring the Nordic nRF52840 Bluetooth LE...
OUT OF STOCK

Adafruit Mini Skinny NeoPixel Digital RGB LED Strip - 144 LED/m

PRODUCT ID: 2970
So thin. So mini. So teeeeeeny-tiny. It's the 'skinny' version of our classic NeoPixel strips!These NeoPixel strips have 144 digitally-addressable pixel Mini LEDs...
$64.95
IN STOCK

Adafruit LiIon/LiPoly Backpack Add-On for Pro Trinket/ItsyBitsy

PRODUCT ID: 2124
If you have an ItsyBitsy or Pro Trinket you probably know it's the perfect little size for a portable project. This LiPoly backpack makes it really easy to do! Instead of wiring 2...
$4.95
IN STOCK

Lithium Ion Polymer Battery - 3.7v 500mAh

PRODUCT ID: 1578
Lithium ion polymer (also known as 'lipo' or 'lipoly') batteries are thin, light and powerful. The output ranges from 4.2V when completely charged to 3.7V. This battery...
$7.95
IN STOCK

Breadboard-friendly SPDT Slide Switch

PRODUCT ID: 805
These nice switches are perfect for use with breadboard and perfboard projects. They have 0.1" spacing and snap in nicely into a solderless breadboard. They're easy to switch...
OUT OF STOCK

Silicone Cover Stranded-Core Ribbon Cable - 10 Wire 1 Meter Long

PRODUCT ID: 3890
For those who are fans of our silicone-covered wires, but are always looking to up their wiring game. We now have Silicone Cover Ribbon cables! These may look...
$3.95
IN STOCK

Fully Reversible Pink/Purple USB A to micro B Cable - 1m long

PRODUCT ID: 4111
This cable is not only super-fashionable, with a woven pink and purple Blinka-like pattern, it's also fully reversible! That's right, you will save seconds a day by...
$3.95
IN STOCK
1 x Black LED Acrylic
100mm x 100mm - 1/8in thickness
1 x 1/8in Flat End Mill
Single Flute Upcut
1 x Bantam Tools CNC
Desktop CNC Milling Machine

Inspirational Source:

This project was inspired by Charlyn Gonda's Ring project. Check it out on her website:

https://charlyn.codes/magic-acrylic-stays-opaque-until-light-shines-through/

3D Printing

3D Printed Parts

STL files for 3D printing are oriented to print "as-is" on FDM style machines. Original design source may be downloaded using the links below.

  • heart-case.stl
  • itsy-reset.stl
  • itsy-cover.stl
  • itsy-case.stl

CAD Explode

The ItsyBitsy and Lipo backpack snap fit into the case. The ItsyBitsy board is secured with mounting taps. The slide switch is inserted into a little holder built into the case. A small button fits over the reset button. A 500mAh lipo battery is placed over the components. The cover is fitted over the case and snap fits. 

Slicing Parts

No supports are required. Slice with setting for PLA material. 

The parts were sliced using CURA using the slice settings below.

  • PLA filament 220c extruder
  • 0.2 layer height
  • 10% gyroid infill
  • 60mm/s print speed
  • 60c heated bed

Design Source Files

The project assembly was designed in Fusion 360. This can be downloaded in different formats like STEP, STL and more. Electronic components like Adafruit's board, displays, connectors and more can be downloaded from the Adafruit CAD parts GitHub Repo.

Circuit Diagram

The diagram below provides a visual reference for wiring of the components. This diagram was created using the software package Fritzing.

Adafruit Library for Fritzing

Use Adafruit's Fritzing parts library to create circuit diagrams for your projects. Download the library or just grab individual parts. Get the library and parts from GitHub - Adafruit Fritzing Parts.

Wired Connections

The ItsyBitsy nRF52840 is powered by 500mAh battery via the Lipo Backpack. This allows the USB port from the ItsyBitsy nRF52840 to charge the 500mAh battery. A slide switch is connected to the two switch pin on the Lipo Backpack. 

  • BAT from Lipo Backpack to BAT on ItsyBitsy nRF52840
  • Ground from Lipo Backpack to GND on ItsyBitsy nRF52840
  • 5V from Lipo Backpack to USB on ItsyBitsy nRF52840

Slide Switch

A 2-pin slide switch is wired to the switch pins on the Trinket/ItsyBitsy Lipo Backpack as shown in the diagram above.

Heart with NeoPixel Strips

The heart is made of up several strips of NeoPixels. The separate pieces will be wired together in a "daisy chain". Reference the labels on each strip to ensure polarity is correct. The diagram features labels for referencing the pixel number and the flow of data in and data out. The pixels are wired from top to bottom, left to right. The neopixel at the end of each row will need to flow into the far left neopixel on the subsequent row. 

  • 5V+ from NeoPixel Strip to Vhi on ItsyBitsy nRF52840
  • G from NeoPixel Strip to G on ItsyBitsy nRF52840
  • DIN from NeoPixel Strip to Pin #5 on ItsyBitsy nRF52840

CircuitPython

Setup the ItsyBitsy nRF52840 with CircuitPython

We'll need to get our board setup so we can run the CircuitPython code. Let's walk through these steps to get the latest version of CircuitPython onto your board. 

The Mu Python Editor

Mu is a simple Python editor that works with Adafruit CircuitPython hardware. It's written in Python and works on Windows, MacOS, Linux and Raspberry Pi. The serial console is built right in, so you get immediate feedback from your board's serial output! While you can use any text editor with your code, Mu makes it super simple. Instructions for Mu are available here.

Installing or upgrading CircuitPython

You should ensure you have CircuitPython 4.0 or greater on your board. Plug your board in with a known good data + power cable (not the cheesy USB cable that comes with USB power packs, they are power only). You should see a new flash drive pop up.

If the drive is CIRCUITPY, then open the boot_out.txt file to ensure the version number is 4.0 or greater. 

Download: file
Adafruit CircuitPython 5.0.0-beta.3 on 2020-01-08; Adafruit ItsyBitsy nRF52840 Express with nRF52840

If you do not have CircuitPython on your board, you can add it or upgrade via this page on the ItsyBitsy guide.

Download the Adafruit CircuitPython Library Bundle

In order to run the code, we'll need to download a few libraries. Libraries contain code to help interface with hardware a lot easier for us.

Use the ItsyBitsy nRF52840 page on Installing Libraries to get the library that matches the major version of CircuitPython you are using noted above, i.e. 4.x for the versions starting with 4, 5.x for the versions starting with 5, etc.

To run the code for this project, we need the three libraries in the Required Libraries list below. Unzip the library bundle and search for the libraries. Drag and drop the files into a folder named lib on the CIRCUITPY drive (which appears when your board is plugged into your computer via a known good USB cable) if the directory is not already on the ItsyBitsy nRF52840).

Required Libraries 

  • neopixel.mpy
  • adafruit_bluefruit_connect
  • adafruit_ble

Once we have all the files we need, a directory listing will look similar to above as far as files and directories.

Upload Code

Click on the download link below to grab the main code directly from GitHub. Ensure the file is named code.py and drop it onto the CIRCUITPY drive main (root) directory that appears when your ItsyBitsy nRF52840 is plugged into your computer via a known good USB data cable. The code will run properly when all of the files have been uploaded including libraries.

Use any text editor or favorite IDE to modify the code. We suggest using Mu as noted above.

import time
import board
import neopixel
from adafruit_ble import BLERadio
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.nordic import UARTService
from adafruit_bluefruit_connect.packet import Packet
from adafruit_bluefruit_connect.button_packet import ButtonPacket
from adafruit_bluefruit_connect.color_packet import ColorPacket

# NeoPixel strip data pin
pixel_pin = board.D5

# The number of NeoPixels
num_pixels = 46

# Increase or decrease between 0 and 1 to increase or decrease the brightness of the LEDs
brightness = 0.1

# The order of the pixel colors - RGB or GRB. Some NeoPixels have red and green reversed!
ORDER = neopixel.GRB

pixels = neopixel.NeoPixel(pixel_pin, num_pixels, brightness=brightness, auto_write=False,
                           pixel_order=ORDER)
# BLE Setup
ble = BLERadio()
uart_service = UARTService()
advertisement = ProvideServicesAdvertisement(uart_service)

#Wheel function for rainbows
def wheel(pos):
    # Input a value 0 to 255 to get a color value.
    # The colours are a transition r - g - b - back to r.
    if pos < 0 or pos > 255:
        r = g = b = 0
    elif pos < 85:
        r = int(pos * 3)
        g = int(255 - pos * 3)
        b = 0
    elif pos < 170:
        pos -= 85
        r = int(255 - pos * 3)
        g = 0
        b = int(pos * 3)
    else:
        pos -= 170
        r = 0
        g = int(pos * 3)
        b = int(255 - pos * 3)
    return (r, g, b) if ORDER in (neopixel.RGB, neopixel.GRB) else (r, g, b, 0)

#Rainbow Swirl Animation
def rainbow_swirl(wait):
    for j in range(255):
        for i in range(num_pixels):
            pixel_index = (i * 256 // num_pixels) + j
            pixels[i] = wheel(pixel_index & 255)
        pixels.show()
        time.sleep(wait)

#Rainbow Fill Animation
def rainbow_fill(wait):
    for j in range(255):
        for i in range(num_pixels):
            pixel_index = int(i + j)
            pixels[i] = wheel(pixel_index & 255)
        pixels.show()
        time.sleep(wait)

# List of colors
RED = (255, 0, 0)
ORANGE = (255, 50, 0)
BLACK = (0, 0, 0)
GREEN = (0, 255, 0)
PURPLE = (100, 0, 255)
YELLOW = (255,230, 0)
BLUE = (0, 0, 255)

while True:
    while ble.connected:
        if uart_service.in_waiting:
            if uart_service.in_waiting:
                packet = Packet.from_stream(uart_service)
            if isinstance(packet, ColorPacket):
                # Set all the pixels to one color and stay there.
                pixels.fill(packet.color)
                pixels.show()
            elif isinstance(packet, ButtonPacket):
                if packet.pressed:
                    if packet.button == ButtonPacket.BUTTON_1:
                        pixels.fill(BLUE)
                        pixels.show()
                    elif packet.button == ButtonPacket.BUTTON_2:
                        pixels.fill(RED)
                        pixels.show()
                    elif packet.button == ButtonPacket.BUTTON_3:
                        rainbow_swirl(0.01)
                        pixels.show()
                    elif packet.button == ButtonPacket.BUTTON_4:
                        rainbow_fill(0.001)
                    elif packet.button == ButtonPacket.DOWN:
                        pixels.fill(BLACK)
                        pixels.show()

Double Check

See the directory listing above and double check that you have all the files listed to make this project function. If any are missing or in an incorrect directory, move them so they're in the right places.

Bluefruit LE Connect App

Bluetooth App

This project uses the Adafruit Bluefruit LE connect app (available free for Android and iOS) to trigger the LEDs. It uses the control pad to trigger up to 8 different colors. If you haven't downloaded the app yet, use the button below to install it on your mobile device.

Connect to ItsyBitsy nRF52840

Power on the ItsyBitsy nRF52840 by connecting it via USB to your computer.

Using Bluefruit LE Connect App

Open the Bluefruit LE Connect app and locate the device named CIRCUITPY and tap the connect button. Locate and tap on Controller. Under module, tab on Control Pad

Use the 1-4 buttons to cycle between the two preset colors and rainbow animations.

Color Picker

You can change the color of the animations by using the Color Picker. Tap connect, select Controller. Under module, tap on Color Picker. Use the color wheel to select a color and the slider to adjust the brightness. Tap the send color button to trigger the color.

Apple Watch

If you have an Apple Watch, you can use the Bluefruit LE Connect App just like the mobile app. The Apple Watch app is included with the iOS app download. 

Milling Acrylic

Black LED Acrylic

Pre cut sheets of Chemcast Black LED acrylic can be purchased from TAP Plastics. This acrylic allows the colors of the LEDs to shine through and features a nice matte finish. 

Acrylic Sheet Size:

  • width: 100mm
  • height: 100mm
  • thickness: 1/8in (~2.8mm)

Bantam Tools CNC

In this project, we're using the Bantam Tools desktop CNC milling machine to cut out the heart cover. An 1/8in single flute upcut endmill is used to cut the acrylic.

Generate Toolpath

The acrylic heart cover was designed in Fusion 360. A 2D contour is used to create the outline using an 1/8in flat end mill. The stock acrylic measures roughly ~2.8mm thick and 100mm x 100mm. Max roughing stepdown of 0.2mm is used for cutting multiple depths.

Feeds & Speeds

  • Spindle: 16400 RPM
  • Cutting feedrate: 1500 mm/min
  • Plunge feedrate: 46 mm/min

Download GCode 

The toolpath was generated using the Othermill(otherplan) post processor and exported from the manufacturing workspace in Fusion 360. Download the zip file below and make sure the gcode's file extension uses .nc

Bantam Tools Setup

Set the material to generic using the dropdown menu. Enter in the width, height and thickness so they match our stock material.

  • width: 100mm
  • height: 100mm
  • thickness: 2.8mm

The material placement is set to be aligned at left of the spoilboard origin.

Plan Setup

Open the gcode .nc file using the open file button in the plans section. Set the XYZ placement and enter the values below:

  • X: 2mm
  • Y: 2mm
  • X: 0mm

Milling Tools

Select the 1/8in Flat End Mill from the dropdown menu in the milling tools section.

Install & Probe End Mill

Change the tool using the change tool button in the bantam tool software. Install the 1/8in end mill and select it from the dropdown menu when it's prompt. The tool will slowly plunge and touch the spoilboard to probe the tool.

Secure Stock to Spoilboard

Use the shiny side of the black LED acrylic to adhere to the spoildboard. Strips of double-sided tape is used to adhere the acrylic stock to the spoilboard. The acrylic is placed at the lower left corner of the spoilboard.

Start Milling

Once the end mill and stock has been installed, it's time to start milling! The cutting job takes around 7-8 minutes to complete.

Vacuum Snow

Once the cutting job is complete, you'll want to clean up the acrylic swarf shavings. A tiny tube style attachment can be quite helpful as it can get into all of the nooks and crannies. 

Remove Acrylic Heart

Use alcohol to soften the adhesive from the tape. A palette knife or spatula can be used to get underneath the stock to pop it free.

Heart Shape Acrylic Cover

Use paper towel with a bit of alcohol to wipe the acrylic piece clean. Now it's ready to use in our project! Go ahead and try press fitting it into the 3D printed heart case.

Cut Strip

Measure a strip of NeoPixels 46 pixels long and then cut each to fit the heart shape in a 8x9 grid.

Add Tape

Use packing tape to hold the strips in shape. Add additional tape strips to fit the last pixel.

 

Trim Tape

Cut off the excess tape from the sides. 

Strip pads

Use a hobby knife to carefully cut away the tape from the pads on each strip.

 

Trim wires

Measure each pad length and cut all wires to reach.

Tin pads

Carefully tin each pad on the strips. Use additional strips of tape if the tape melts from tinning the pads.  

 

Solder pads

Use third helping hands to hold the strips and solder each wires to the pads.

Tin and solder ItsyBitsy

Tin and solder the Vin, 5! and G pins on the ItsyBitsy to Power, Data and Ground wire to the pads on each strip.

 

Prep Backpack

To enable the slide switch, we'll need to cut the trace close to the mounting holes. Use flush cutters to cut the trace by using the mounting hole as an anchor. The lipo backpack is wired to the BAT, Ground and USB pins on the ItsyBitsy board. 

Solder Slide Switch

Two wires are soldered to the switch pins on the lipo backpack.  You’ll want to tin the leads on the slide switch with a bit of solder. Solder the wires to the middle pin and either the far left or right.

 

Mount boards

The ItsyBitsy board snap fits into the case and is held in place with tabs. Align the USB port to the cutout on the case and press fit into place.

The Lipo backpack is pressed into place and the slide switch fits into a little built-in holder.

Attach NinjaFlex 

A piece of ninjaflex can be used to create the second strap to form our necklace.

The wiring and filament are inserted into the slits on the side of the case.

 

Place battery

This 500mah lipo battery can then be connected to the JST connector on the Lipo backpack.

Reset button

A little button is placed over the reset and then the cover can be pressed on top. 

Fit Acrylic cover

The LED matrix is fitted inside the heart case with the wiring and filament fitted through the slits.

After that, the acrylic can then be fitted on top and there you have it!

 

This guide was first published on Feb 12, 2020. It was last updated on 2020-02-12 06:52:02 -0500.