Feeling bored and need something to jumpstart the creative engine?

Sometimes the desire to create just needs a spark – some sort of seed to grow from. This quick, solder-free project turns your Adafruit CLUE into a randomized project generator. It's simple to use and easy to customize by adding your own activities & subjects.

This project takes inspiration from Oblique Strategies, but updates the idea for flexibility and more of an all-ages appeal.

What you'll need

In addition to a computer, you'll need an Adafruit CLUE, USB cable. You can also use a battery to make your CLUE portable.

Adafruit CLUE - nRF52840 Express with Bluetooth LE

PRODUCT ID: 4500
Do you feel like you just don't have a CLUE? Well, we can help with that - get a CLUE here at Adafruit by picking up this sensor-packed development board. We wanted to build some...
$39.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

Optional

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

What you'll need to do

To get things up & running, this guide will show you how to:

  1. Install CircuitPython on CLUE
  2. Install necessary code libraries on CLUE
  3. Upload project code

Let's get started!

CircuitPython is a derivative of MicroPython designed to simplify experimentation and education on low-cost microcontrollers. It makes it easier than ever to get prototyping by requiring no upfront desktop software downloads. Simply copy and edit files on the CIRCUITPY flash drive to iterate.

The following instructions will show you how to install CircuitPython. If you've already installed CircuitPython but are looking to update it or reinstall it, the same steps work for that as well!

Set up CircuitPython Quick Start!

Follow this quick step-by-step for super-fast Python power :)

Click the link above to download the latest version of CircuitPython for the CLUE.

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

Plug your CLUE into your computer using a known-good 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 Reset button on the top (magenta arrow) on your board, and you will see the NeoPixel RGB LED (green arrow) turn green. If it turns red, check the USB cable, try another USB port, etc. Note: The little red LED next to the USB connector will pulse red. That's ok!

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

You will see a new disk drive appear called CLUEBOOT.

Drag the adafruit-circuitpython-clue-etc.uf2 file to CLUEBOOT.

The LED will flash. Then, the CLUEBOOT drive will disappear and a new disk drive called CIRCUITPY will appear.

If this is the first time you're installing CircuitPython or you're doing a completely fresh install after erasing the filesystem, you will have two files - boot_out.txt, and code.py, and one folder - lib on your CIRCUITPY drive.

If CircuitPython was already installed, the files present before reloading CircuitPython should still be present on your CIRCUITPY drive. Loading CircuitPython will not create new files if there was already a CircuitPython filesystem present.

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

The CLUE is packed full of features like a display and a ton of sensors. Now that you have CircuitPython installed on your CLUE, you'll need to install a base set of CircuitPython libraries to use the features of the board with CircuitPython.

Follow these steps to get the necessary libraries installed.

Installing CircuitPython Libraries on your CLUE

If you do not already have a lib folder on your CIRCUITPY drive, create one now.

Then, download the CircuitPython library bundle that matches your version of CircuitPython from CircuitPython.org.

The bundle downloads as a .zip file. Extract the file. Open the resulting folder.

Open the lib folder found within.

Once inside, you'll find a lengthy list of folders and .mpy files. To install a CircuitPython library, you drag the file or folder from the bundle lib folder to the lib folder on your CIRCUITPY drive.

Copy the following folders and files from the bundle lib folder to the lib folder on your CIRCUITPY drive:

  • adafruit_apds9960
  • adafruit_bmp280.mpy
  • adafruit_bus_device
  • adafruit_clue.mpy
  • adafruit_display_shapes
  • adafruit_display_text
  • adafruit_lis3mdl.mpy
  • adafruit_lsm6ds.mpy
  • adafruit_register
  • adafruit_sht31d.mpy
  • adafruit_slideshow.mpy
  • neopixel.mpy

Your lib folder should look like the image on the left. These libraries will let you run the demos in the CLUE guide.

Now that CircuitPython & libraries are installed on your CLUE, all you need is the project code.

Download code

Click the Download Project Zip link at the top of the code below. 

"""ACTIVITY GENERATOR for Adafruit CLUE"""

import time
import random
from adafruit_clue import clue
from things import activities
from things import subjects

screen = clue.simple_text_display(text_scale=4, colors=(clue.WHITE,))

screen[1].text = "ACTIVITY"
screen[2].text = "GENERATOR"
screen.show()
time.sleep(1.5)

screen[0].text = "make a"
screen[2].text = "about"
screen[1].color = clue.RED
screen[3].color = clue.GREEN
screen[4].color = clue.BLUE

activity = "???"
subject_a = "???"
subject_b = "???"
two_subjects = True

def random_pick(items):
    index = random.randint(0, len(items)-1)
    return items[index]

while True:

    if clue.button_a:
        activity = random_pick(activities)
        subject_a = random_pick(subjects)
        subject_b = random_pick(subjects)
        time.sleep(0.25)
    if clue.button_b:
        two_subjects = not two_subjects
        time.sleep(0.5)

    screen[1].text = activity
    screen[3].text = subject_a

    if two_subjects:
        screen[4].text = subject_b
    else:
        screen[4].text = ""

    screen.show()

Unzip the downloaded file and open the resulting folder named Activity_Generator.

Inside the Activity_Generator folder, you'll find two files named code.py & things.py – that's our project code.

Upload to CLUE

Connect the CLUE to your computer via USB cable. A drive named CIRCUITPY will appear on your desktop.

Copy the code.py & things.py files onto to the CIRCUITPY drive.

At this point, your CIRCUITPY drive contents should look like the image below.

When the files are finished copying, your CLUE will restart and begin running the project code.

After booting up, press the A button to generate a new project idea.

If you'd like simpler suggestions, press the B button to remove the second item from the proposed subject.

Generally, the generated project ideas work best as starting points or suggestions. For example: "make a VIDEO about METAL SINGING" could be a video about a heavy metal band, or someone playing the saw, or a crooning fork, etc. 

Customize it

You can easily add or remove words used by the generator by editing a single file.

For editing the CircuitPython code, we recommend using the Mu editor. Info for downloading and installing Mu can be found here.

Connect CLUE to your computer and open the CIRCUITPY drive.

Open the file named things.py in the Mu editor.

You can delete or add items to the list, just remember to:

  • Indent each item with four spaces
  • Enclose each item in quotation marks
  • Follow each item with a single comma
  • Each item must have a length of 8 characters or less
This guide was first published on Apr 08, 2020. It was last updated on Apr 08, 2020.