Overview

This project will guide you through the process of animating and illuminating your own version of Van Gogh's famous Starry Night painting.

This project uses readily available household materials, and also serves as a fun introduction to CircuitPython.

Materials

1 x Adafruit CRICKIT for Circuit Playground Express
Creative Robotics and Interactive Construction Kit is an add-on to our popular Circuit Playground Express that lets you #MakeRobotFriend using CircuitPython
1 x Circuit Playground Express
Circuit Playground Express is the perfect introduction to electronics and programming
1 x USB cable - A/MicroB - 3ft
Standard A to micro-B USB cable
1 x DC Gearbox Motor - "TT Motor" - 200RPM - 3 to 6VDC
TT DC Gearbox Motor with a gear ratio of 1:48 and 2 x 200mm wires with breadboard-friendly 0.1" male connectors
1 x Wire Light LED Strand - 12 Cool White LEDs + Coin Cell Holder
Silver wire strand of 12 epoxy coated 1000mcd LEDs
1 x Hakko Professsional Quality 20-30 AWG Wire Strippers
Professional quality wire strippers with precision ground notches to strip wires cleanly and quickly every time
1 x 5V 2A (2000mA) switching power supply
Power supply that gives a clean regulated 5V output at up to 2000mA, 110 or 240 input

In addition, this project uses:

  • Scrap cardboard (~10"x10" square)
  • Double sided tape
  • Scissors
  • Hot glue (optional)

Getting to know CircuitPython

CircuitPython is a programming language based on Python, one of the fastest growing programming languages in the world. It is specifically designed to simplify experimenting and learning to code on low-cost microcontroller boards.

To run CircuitPython we recommend using Mu. If this is your first time using Mu, this guide is a good introduction to get you up and running.

Mu is a simple code editor that works with all Adafruit CircuitPython boards. 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!

Once you have Mu installed you're ready to rock with CircuitPython.

Let's get started!

Prepare the Painting

First things first: print out two copies of Starry Night

Cut out the Moon

From one copy of Starry Night, cut out the moon. Set the moon aside for use later.

Take your second copy of Starry Night and glue it to a piece of cardboard. It's ok if they aren't exactly the same size, as long as the paper fits on the cardboard.

Apply glue to both sides.

Make sure you glue all the way to the edges of the paper!

 

After glue has been applied, lay your painting on the cardboard. Use a piece of scrap cardboard to press and smooth out the painting.

 

Cut away any excess cardboard.

Once the cardboard has been trimmed, do a second pass with a small piece of cardboard, smoothing and pressing the two pieces together.

Prepare your moon

Glue both sides

Give it legs (optional)

WARNING! BURN HAZARD! Hot glue is very sticky and it's easy to accidentally burn your fingertips. Be careful when using it.

If you'd like your painting to stand on its own, now is a good time to add some legs.

 

To make the legs: cut out two rectangles of cardboard and trim one corner off each end.

 

Hold each leg in place against the back of the painting and add a line of hot glue along its edge. Wait for about 20-30 seconds after adding the glue to let it cool down.

Uploading Code with Mu

But first...

To use Circuit Playground Express and CRICKIT together, you'll first need to install the special 'seesaw' version of the CPX firmware. This guide will take you through how to install CRICKIT support onto your circuit playground express.

Adafruit recommends the Mu editor to easily craft and load your code to your CircuitPython projects. You can learn more about Mu by reading this guide.

Once you have completed these steps, you're ready to move on.

Get Ready!

  1. Connect the MicroUSB for coding from the Circuit Playground Express to your computer
  2. Put 3 AA batteries in a battery pack and connect to the Crickit, or use a wall adapter
  3. Turn on the Crickit, check that the switch next to the DC power plug is ON

Connect Motor

Now it's time to test the code and make sure the DC motor runs. 

First, connect your motor to the CRICKIT as pictured, using a small screwdriver to tighten down the screws.

Copy and paste the code below into your Mu editor.

Save this code to your CIRCUITPY drive as code.py

import time
from adafruit_crickit import crickit

# Create one motor on seesaw motor port #1
motor = crickit.dc_motor_1
motor.throttle = 0.5  # half speed forward

# Create drive (PWM) object for the lights on Drive 1
lights = crickit.drive_1
lights.frequency = 1000 # Our default frequency is 1KHz

while True:
    lights.fraction = 0.5  # half on
    time.sleep(0.8)

    lights.fraction = 0.2  # dim
    time.sleep(0.1)

    # and repeat!
Make sure the file saved to CIRCUITPY is named "code.py", this will allow it to run automatically when your CPX is powered on.
If you're motor doesn't spin at first, make sure the Crickit is powered with the battery pack and the slide switch on your Crickit is in the "ON" position. Look for the green LED next to the HAPPY FACE icon.

Troubleshooting

Problem: My motor still won't spin!

Solution: Check that you have a 5V power supply attached to the DC jack on your CRICKIT board.

 

Problem: My Circuit Playground Express isn't recognized by Mu!

Solution: Make sure your board is set up as a CIRCUITPY device. If it is showing up at "CPLAYBOOT" on your computer, you can follow the steps in this guide to get it back into CIRCUITPY mode.

 

Motorize the Moon!

Attach Motor

If your motor spins, it's time to mount it to the painting!

Use something pointy to make a large hole in the center of the moon. This is where the motor will go. 

Add a piece of double sided tape to your motor.

 

Stick it to the back of the painting with the white axle poking through.

 

Stick a small circle of double sided tape to the back of your moon. Carefully stick this to the axle of the motor poking through the painting.

Putting Stars in the Sky

Let's add some lights to the painting! 

First, you'll need to prepare your strand of LEDs.

Use a wire cutter to snip the LED strand from its battery pack. Where we're going, we won't need batteries.

 

Pull the two wires apart, separating about about an inch of length.

 

Use the 0.5mm gauge on your wire stripper to strip off some insulation from the tips of these wires.

 

Pro Tip: gently twist the insulation as you pull it off the wire. This will help keep all the wire strands together.

Screw these wires firmly into the terminal blocks on the CRICKIT. 

Use the 5V and D1 terminal blocks.

Use something pointy to poke small holes through the front of the painting in the center of each star

 

Flip it over and widen the holes from the back. This will create an impression deep enough to push out LEDs into.

 

Now let's add lights! Use tape to hold each LED in place. Gently bend the wire to route each consecutive LED to the next closest hole.

Turn on power to your device, and voila! Behold your starry night.

Troubleshooting

Problem: My LEDs don't light up!

Solution: Swap the position of the wires in their terminal blocks (LEDs are polarized, so they won't work if they're backwards).

Exploring Further

If you'd like to change the brightness of your stars, look no further than Mu. Changes are reflected as soon as you save your new code!

The LEDs are by default set to half-brightness. You can change this setting in the while True: loop.

For example, changing the value of my_drive.duty_cycle from 32768 to 16384 will dim the lights by half. What's great about programming in this way is you can see the change occur as soon as you hit save!

Alternative Versions

Rather than lighting up the stars with LEDs, it can be fun to make multiple stars spin together.

Let your imagination run wild!

In this version, the LEDs are removed and the holes are widened.

 

Some bamboo skewers poke through the painting and attach to the star cutouts in front. Cardboard discs are attached in back to act as pulleys.

 

A rubber band serves as a drive belt to transfer the spinning motion from one motor to multiple stars at once.

More projects!

If you enjoy CircuitPython and want to continue learning you can find lots more CircuitPython projects on the Adafruit Learn System.

This guide was first published on May 18, 2018. It was last updated on May 18, 2018.