Overview

Hold this heart in your hand and it automatically detects your touch and begins to glow, pulsing like a beating heart.

A Circuit Playground Express tucked away inside a 3D printed anatomical heart model uses its capacitive touch pad to detect when it's being held and pulse its onboard neopixels in response.

Circuit Playground Express

PRODUCT ID: 3333
Circuit Playground Express is the next step towards a perfect introduction to electronics and programming. We've taken the original Circuit Playground Classic and...
$24.95
IN STOCK

Lithium Ion Polymer Battery Ideal For Feathers - 3.7V 400mAh

PRODUCT ID: 3898
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...
$6.95
IN STOCK

USB cable - USB A to Micro-B

PRODUCT ID: 592
This here is your standard A to micro-B USB cable, for USB 1.1 or 2.0. Perfect for connecting a PC to your Metro, Feather, Raspberry Pi or other dev-board or...
$2.95
IN STOCK

Conductive Nylon Fabric Tape - 5mm Wide x 10 meters long

PRODUCT ID: 3961
With our fun assortment of conductive materials, 
$2.95
IN STOCK

White Nylon Screw and Stand-off Set – M2.5 Thread

PRODUCT ID: 3658
Totaling 420 pieces, this White Nylon M2.5 Screw Set is a must-have smörgåsbord for your workstation. You'll have more than enough...
OUT OF 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...
$0.95
IN STOCK

Silicone Cover Stranded-Core Wire - 2m 26AWG Red

PRODUCT ID: 1877
Silicone-sheathing wire is super-flexible and soft, and its also strong! Able to handle up to 200°C and up to 600V, it will do when PVC covered wire wimps out. We like this wire...
$0.95
IN STOCK

Materials

In addition to the materials listed above, for this project you will also need:

  • Access to a 3D printer
  • White or Red filament
  • A piece of sandpaper
  • Soldering iron (optional)

Read on to learn how to build your own!

MakeCode

Getting familiar with MakeCode

This project runs a simple MakeCode sketch and is easy to play with if you want to make changes.

Microsoft MakeCode for Adafruit is a web-based code editor that provides a block editor, similar to Scratch or Code.org, and also a JavaScript editor for more advanced users.

If you've never used the Circuit Playground Express with MakeCode before, this guide is a good place to start.

The Code

The code is shown below. For browser viewing, you may need to enable content. For example, in Chrome, click "Show Embedded Content" as the material is fed not from Adafruit but from Microsoft's MakeCode site.

To download the code, click the download link at the bottom of the window. To edit the code in MakeCode, click the box with arrow icon in the upper right corner of the window.

How to Upload Code

To upload code to Circuit Playground Express, follow these instructions:

1) Connect your Circuit Playground Express to your computer using a known, good data+power micro USB cable and press the small reset button in the center of the board. All the LEDs will flash red briefly, then turn green. Your computer should now show a removable drive called CPLAYBOOT. 

2) Click the Download button in the code window below to download the .UF2 file to your computer.

3) Now drag and drop the .UF2 file onto the CPLAYBOOT drive in your computer's file explorer or finder.

Once the file is dragged onto CPLAYBOOT, the drive will automatically eject itself (your computer may give you a "failed to eject drive correctly" error, you can ignore this). The code is now on your Circuit Playground Express and ready to run!

Note: If you get a drive named CIRCUITPY, no worries! Press the reset button twice to get a flash drive named CPLAYBOOT. The project will not run if copied onto the CIRCUITPY drive as it is for CircuitPython.

Making Changes

In the on start loop, we set all pixels to red and start with the brightness 0, and set the sensitivity threshold to 200.

The pixels are set to illuminate whenever the value of analog read pin A2 goes over200, which can be done by touching it, resulting in an increase in the capacitance. 

If you find your heart isn't sensitive to touch, or is too sensitive, you can change this value from 200 down to 150 or up to 800(max 1023).

Troubleshooting

Problem: My Circuit Playground Express doesn't show up as CPLAYBOOT

Solutions:

  1. Be sure you have a Circuit Playground Express.  The Circuit Playground Classic will not work with MakeCode.
  2. If you get a drive named CIRCUITPY instead, press the reset button twice in succession to get to CPLAYBOOT.
  3. Some USB cables are "charge-only" and won't pass data. Try using a different USB cable and try using a different USB port on your computer.  
  4. With the Circuit Playground Express plugged into your computer with a micro USB cable, click the small reset button in the center of the board. The lights should all turn green. If they don't, try double-clicking the reset button.

If things still aren't working, head over to the Intro to Circuit Playground Express guide for more suggestions.

3D Printing

The 3D files for this project can be downloaded by clicking the button below.

This heart prints in two pieces that snap fit together. The back piece has two standoffs sticking out of it that the Circuit Playground Express can be screwed into. Note: the board must be tilted to get it to fit into the heart, so raising it up on some nylon screw standoffs is very helpful.

This design for this project is based on the hollow anatomical heart model created by Brian Locicero.

Print Settings

Each of these quadrants requires some support. This project prints well with the following settings:

  • 0.2mm Layer Height / 0.4mm nozzle
  • 80mm/s printing speed
  • 20% infill
  • Supports: Yes

Because of the limitations of 3d printing, your piece may not fit together perfectly right off the printer.

If the fit is too tight, use a small piece of sandpaper to smooth the edges of the parts, allowing them to fit together snugly.

Assemble

Tilt and rotate the back so that the Circuit Playground Express can fit into the opening.

Press the back piece so that it snaps into place.

Optional: Power Switch

If you prefer a way to turn the circuit on and off without popping off the back of the heart, you can easily solder together a small switch for this purpose.

Power Circuit

Create a small power switch for the battery.

Solder two wires to the slide switch. Insert these wires into the heart through the aorta.

Cut the ends off a JST extension cable. Strip the tips and solder the black (GND) wires together.

Solder the switch so that it connects the red wires together. You now have a small and effective power switch!

With an external switch you can now turn on/off power without having to unplug the battery.

Explore Further

Translucent Red

If you want an arguably more arresting object, printing this heart with translucent red filament creates a heart that glows brighter (due to the reduced opacity of the plastic), and has a blood-red look. 

Advanced Adaptations

If you really want to take this project to the next level (and increase your heart rate in the process), you could adapt the heart to use a Pulse Sensor that would read your heart rate and use that data to have the 3D printed heart beat in time with your own. 

Some examples that have used this same idea can be found in Collin Cunningham's "Pulse Room" project (below), or this NeoPixel pulse display by Mike Barela, for any ambitious makers out there.

More MakeCode!

If you enjoy MakeCode and want to continue exploring you can check out lots more MakeCode projects on the Adafruit Learn System.

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