neopixel led heart necklace - adafruit industries · ble with itsybitsy you can change the colors...
TRANSCRIPT
NeoPixel LED Heart NecklaceCreated by Ruiz Brothers
Last updated on 2020-05-05 02:35:07 PM EDT
Overview
NeoPixel Heart
In this project we’re building an LED heart with NeoPixels. This uses Black LED acrylic to diffuse the NeoPixels inside a3D printed case. The heart is made from pieces of strips that are daisy chained to create a custom matrix.
3D Printed CaseThe 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.
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 4 of 32
BLE with ItsyBitsyYou 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
List of parts used to build this project.
Adafruit ItsyBitsy nRF52840 (https://adafru.it/IsE)
Mini Skinny NeoPixel Strip (https://adafru.it/lXb)
Trinket/ItsyBitsy Lipo
Backpack (https://adafru.it/e0w)
500mAh battery (https://adafru.it/drL)
Slide Switch (https://adafru.it/drN)
10-wire ribbon cable (https://adafru.it/CJj)
Fully reversible USB cable (https://adafru.it/GWF)
Black LED Acrylic (https://adafru.it/IVf)
Adafruit ItsyBitsy nRF52840 Express - Bluetooth LE
$17.95IN STOCK
Add To Cart
Your browser does not support the video tag. Adafruit Mini Skinny NeoPixel Digital RGB LED Strip - 144LED/m
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 5 of 32
$64.95IN STOCK
Add To Cart
Adafruit LiIon/LiPoly Backpack Add-On for ProTrinket/ItsyBitsy
$4.95IN STOCK
Add To Cart
Lithium Ion Polymer Battery - 3.7v 500mAh
$7.95IN STOCK
Add To Cart
Breadboard-friendly SPDT Slide Switch
OUT OF STOCK
Out Of Stock
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 6 of 32
1 x Black LED Acrylic100mm x 100mm - 1/8in thickness
BUY NOW
1 x 1/8in Flat End MillSingle Flute Upcut
BUY NOW
1 x Bantam Tools CNCDesktop CNC Milling Machine
BUY NOW
Silicone Cover Stranded-Core Ribbon Cable - 10 Wire 1Meter Long
$3.95IN STOCK
Add To Cart
Fully Reversible Pink/Purple USB A to micro B Cable - 1mlong
$3.95IN STOCK
Add To Cart
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 7 of 32
Inspirational Source:This project was inspired by Charlyn
Gonda (https://adafru.it/IVD)'s Ring project. Check it out
on her website:
https://charlyn.codes/magic-acrylic-stays-opaque-until-
light-shines-through/ (https://adafru.it/IVE)
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 8 of 32
3D Printing
3D Printed PartsSTL 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
https://adafru.it/IWa
https://adafru.it/IWa
https://adafru.it/IWb
https://adafru.it/IWb
CAD ExplodeThe 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.
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 9 of 32
Slicing PartsNo 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 FilesThe 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 (https://adafru.it/AW8).
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 10 of 32
Circuit Diagram
The diagram below provides a visual reference for wiring of the components. This diagram was created using thesoftware package Fritzing (https://adafru.it/oEP).
Adafruit Library for Fritzing
Use Adafruit's Fritzing parts library to create circuit diagrams for your projects. Download the library or just grabindividual parts. Get the library and parts from GitHub - Adafruit Fritzing Parts (https://adafru.it/AYZ).
Wired Connections
The ItsyBitsy nRF52840 is powered by 500mAh battery via the Lipo Backpack. This allows the USB port from theItsyBitsy nRF52840 to charge the 500mAh battery. A slide switch is connected to the two switch pin on the LipoBackpack.
BAT from Lipo Backpack to BAT on ItsyBitsy nRF52840Ground from Lipo Backpack to GND on ItsyBitsy nRF528405V 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.
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 11 of 32
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 pixelnumber and the flow of data in and data out. The pixels are wired from top to bottom, left to right. The neopixel at theend of each row will need to flow into the far left neopixel on the subsequent row.
5V+ from NeoPixel Strip to Vhi on ItsyBitsy nRF52840G from NeoPixel Strip to G on ItsyBitsy nRF52840DIN from NeoPixel Strip to Pin #5 on ItsyBitsy nRF52840
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 12 of 32
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 thelatest 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 onWindows, MacOS, Linux and Raspberry Pi. The serial console is built right in, so you get immediate feedback from yourboard's serial output! While you can use any text editor with your code, Mu makes it super simple. Instructions for Muare available here (https://adafru.it/ANO).
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 anew 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.
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 ItsyBitsyguide (https://adafru.it/IXe).
Download the Adafruit CircuitPython Library Bundle
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 13 of 32
In order to run the code, we'll need to download a few libraries. Libraries contain code to help interface with hardwarea lot easier for us.
Use the ItsyBitsy nRF52840 page on Installing Libraries (https://adafru.it/Ie7) to get the library that matches the majorversion of CircuitPython you are using noted above, i.e. 4.x for the versions starting with 4, 5.x for the versions startingwith 5, etc.
To run the code for this project, we need the three libraries in the Required Libraries list below. Unzip the librarybundle and search for the libraries. Drag and drop the files into a folder named lib on the CIRCUITPY drive (whichappears when your board is plugged into your computer via a known good USB cable) if the directory is not already onthe ItsyBitsy nRF52840).
Required Libraries
neopixel.mpyadafruit_bluefruit_connectadafruit_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 anddrop it onto the CIRCUITPY drive main (root) directory that appears when your ItsyBitsy nRF52840 is plugged into yourcomputer via a known good USB data cable. The code will run properly when all of the files have been uploadedincluding libraries.
Use any text editor or favorite IDE to modify the code. We suggest using Mu as noted above.
import timeimport boardimport neopixelfrom adafruit_ble import BLERadiofrom adafruit_ble.advertising.standard import ProvideServicesAdvertisementfrom adafruit_ble.services.nordic import UARTServicefrom adafruit_bluefruit_connect.packet import Packetfrom adafruit_bluefruit_connect.button_packet import ButtonPacketfrom adafruit_bluefruit_connect.color_packet import ColorPacket
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 14 of 32
from adafruit_bluefruit_connect.color_packet import ColorPacket
# NeoPixel strip data pinpixel_pin = board.D5
# The number of NeoPixelsnum_pixels = 46
# Increase or decrease between 0 and 1 to increase or decrease the brightness of the LEDsbrightness = 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 Setupble = BLERadio()uart_service = UARTService()advertisement = ProvideServicesAdvertisement(uart_service)
#Wheel function for rainbowsdef 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 Animationdef 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 Animationdef 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)
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 15 of 32
time.sleep(wait)
# List of colorsRED = (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 anyare missing or in an incorrect directory, move them so they're in the right places.
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 16 of 32
Bluefruit LE ConnectApp
Bluetooth AppThis 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.
https://adafru.it/ddu
https://adafru.it/ddu
https://adafru.it/f4G
https://adafru.it/f4G
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 andtap 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 colorbutton 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 appis included with the iOS app download.
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 17 of 32
Milling Acrylic
Black LED AcrylicPre cut sheets of Chemcast Black LED
acrylic (https://adafru.it/IVf) 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 CNCIn this project, we're using the Bantam Tools desktop
CNC milling machine (https://adafru.it/Cg-) to cut out the
heart cover. An 1/8in single flute upcut endmill is used to
cut the acrylic.
1/8in Single FLute Upcut End
Mill (https://adafru.it/IVA)
Generate ToolpathThe 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
https://adafru.it/IVB
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 18 of 32
https://adafru.it/IVB
Download GCode
The toolpath was generated using the Othermill(otherplan) post processor and exported from the manufacturingworkspace in Fusion 360. Download the zip file below and make sure the gcode's file extension uses .nc
https://adafru.it/IVC
https://adafru.it/IVC
Bantam Tools SetupSet 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.
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 19 of 32
Plan SetupOpen 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 ToolsSelect the 1/8in Flat End Mill from the dropdown menu
in the milling tools section.
Install & Probe End MillChange 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.
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 20 of 32
Secure Stock to SpoilboardUse 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 MillingOnce the end mill and stock has been installed, it's time
to start milling! The cutting job takes around 7-8 minutes
to complete.
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 21 of 32
Vacuum SnowOnce 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 HeartUse 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.
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 22 of 32
Heart Shape Acrylic CoverUse 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.
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 23 of 32
Assembly
Cut StripMeasure a strip of NeoPixels 46 pixels long and then cut
each to fit the heart shape in a 8x9 grid.
Add TapeUse packing tape to hold the strips in shape. Add
additional tape strips to fit the last pixel.
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 24 of 32
Trim TapeCut off the excess tape from the sides.
Strip padsUse a hobby knife to carefully cut away the tape from
the pads on each strip.
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 25 of 32
Trim wiresMeasure each pad length and cut all wires to reach.
Tin padsCarefully tin each pad on the strips. Use additional strips
of tape if the tape melts from tinning the pads.
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 26 of 32
Solder padsUse third helping hands to hold the strips and solder
each wires to the pads.
Tin and solder ItsyBitsyTin and solder the Vin, 5! and G pins on the ItsyBitsy to
Power, Data and Ground wire to the pads on each strip.
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 27 of 32
Prep BackpackTo 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 SwitchTwo 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.
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 28 of 32
Mount boardsThe 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.
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 29 of 32
Place batteryThis 500mah lipo battery can then be connected to the
JST connector on the Lipo backpack.
Reset buttonA little button is placed over the reset and then the
cover can be pressed on top.
Fit Acrylic coverThe 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!
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 30 of 32
© Adafruit Industries https://learn.adafruit.com/neopixel-led-heart-necklace Page 31 of 32
© Adafruit Industries Last Updated: 2020-05-05 02:35:07 PM EDT Page 32 of 32