# Metronome CLUE

## Overview

https://youtu.be/dz6Jz0MeEU4

Practice makes perfect when it comes to learning a musical instrument -- and sometimes you need a metronome to really drive home the tempo. In this project you'll learn how to make a metronome using the CLUE board and CircuitPython.

As a bonus, you can 3D print a classic metronome style stand for your CLUE!

## Parts

These are the parts you'll need:

### Adafruit CLUE - nRF52840 Express with Bluetooth® LE

[Adafruit CLUE - nRF52840 Express with Bluetooth® LE](https://www.adafruit.com/product/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 projects that have a small screen and a lot of sensors. To make it compatible with existing projects, we made...

In Stock
[Buy Now](https://www.adafruit.com/product/4500)
[Related Guides to the Product](https://learn.adafruit.com/products/4500/guides)
![Animated GIF showing CLUE board  displaying data from the many on-board sensors.](https://cdn-shop.adafruit.com/product-videos/640x480/4500-04.jpg)

### USB Cable - Standard A-B

[USB Cable - Standard A-B](https://www.adafruit.com/product/62)
This here is your standard A-B USB cable, for USB 1.1 or 2.0. Perfect for connecting a PC to your Arduino, USBtinyISP (among other things).  
  
3 feet / 1 meter long  
  
Color may vary!

In Stock
[Buy Now](https://www.adafruit.com/product/62)
[Related Guides to the Product](https://learn.adafruit.com/products/62/guides)
![Angled shot of coiled USB-A to USB-B cable.](https://cdn-shop.adafruit.com/640x480/62-00.jpg)

## Optional
### Little Rubber Bumper Feet - Pack of 4

[Little Rubber Bumper Feet - Pack of 4](https://www.adafruit.com/product/550)
Keep your electronics from going barefoot, give them little rubber feet! These small sticky bumpers are our favorite accessory for any electronic kit or device. They are sticky, but not impossible to remove. They're small enough to fit onto any board, and have just enough height to give...

In Stock
[Buy Now](https://www.adafruit.com/product/550)
[Related Guides to the Product](https://learn.adafruit.com/products/550/guides)
![Angled Shot of the Little Rubber Bumper Feet - Pack of 4](https://cdn-shop.adafruit.com/640x480/550-06.jpg)

Looking for a PyBadge metronome? Check this one out: [https://github.com/gmeader/pybadge/blob/master/metronome.py](https://github.com/gmeader/pybadge/blob/master/metronome.py)

# Metronome CLUE

## CircuitPython on CLUE

[CircuitPython](https://github.com/adafruit/circuitpython) is a derivative of [MicroPython](https://micropython.org) 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** &nbsp;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 :)

[Download the latest version of CircuitPython for CLUE from circuitpython.org](https://circuitpython.org/board/clue_nrf52840_express/)
 **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).

![adafruit_products_CLUE_UF2_Downloaded.png](https://cdn-learn.adafruit.com/assets/assets/000/088/037/medium640/adafruit_products_CLUE_UF2_Downloaded.png?1580840077)

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!

![adafruit_products_Clue_Reset_NeoPixel_bootloader.png](https://cdn-learn.adafruit.com/assets/assets/000/087/919/medium640/adafruit_products_Clue_Reset_NeoPixel_bootloader.png?1580496467)

You will see a new disk drive appear called **CLUEBOOT**.

Drag the **adafruit-circuitpython-clue-etc.uf2** file to **CLUE**** BOOT.**

![adafruit_products_CLUE_CLUEBOOT.png](https://cdn-learn.adafruit.com/assets/assets/000/088/042/medium640/adafruit_products_CLUE_CLUEBOOT.png?1580841287)

![adafruit_products_CLUE_drag_UF2.png](https://cdn-learn.adafruit.com/assets/assets/000/088/043/medium640/adafruit_products_CLUE_drag_UF2.png?1580841295)

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! :)

![adafruit_products_CLUE_CIRCUITPY.png](https://cdn-learn.adafruit.com/assets/assets/000/088/044/medium640/adafruit_products_CLUE_CIRCUITPY.png?1580841453)

# Metronome CLUE

## CLUE CircuitPython Libraries

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.

[Download the latest library bundle from circuitpython.org](https://circuitpython.org/libraries)
The bundle downloads as a .zip file. Extract the file. Open the resulting folder.

![adafruit_products_CPB_Download_extract_bundle.png](https://cdn-learn.adafruit.com/assets/assets/000/088/148/medium640/adafruit_products_CPB_Download_extract_bundle.png?1581019463)

Open the **lib** folder found within.

![adafruit_products_CPB_open_lib_folder_in_bundle.png](https://cdn-learn.adafruit.com/assets/assets/000/088/147/medium640/adafruit_products_CPB_open_lib_folder_in_bundle.png?1581019436)

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**.

![adafruit_products_CPB_bundle_lib_folder_contents.png](https://cdn-learn.adafruit.com/assets/assets/000/088/146/medium640/adafruit_products_CPB_bundle_lib_folder_contents.png?1581019409)

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**
- **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.

![adafruit_products_clue_project_libs.png](https://cdn-learn.adafruit.com/assets/assets/000/095/196/medium640/adafruit_products_clue_project_libs.png?1601346972)

# Metronome CLUE

## Code the Metronome

## Libraries

We'll need to make sure we have these libraries installed. (Check out this [link](https://learn.adafruit.com/welcome-to-circuitpython/circuitpython-libraries) on installing libraries if needed.)

- **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**
- **neopixel.mpy**
- **simpleio.mpy**

![circuitpython_metlibs.jpg](https://cdn-learn.adafruit.com/assets/assets/000/090/949/medium640/circuitpython_metlibs.jpg?1588976351)

## Text Editor

Adafruit recommends using the Mu editor for editing your CircuitPython code. You can get more info in [this guide](https://learn.adafruit.com/welcome-to-circuitpython/installing-mu-editor).

Alternatively, you can use any text editor that saves files.

## Code

Copy the code from the code-block below and paste it into the Mu editor and save it to your CLUE as **code.py** (or copy **code.py** from the zip file and place on the **CIRCUITPY** drive).

https://github.com/adafruit/Adafruit_Learning_System_Guides/blob/main/CLUE/CLUE_Metronome/code.py

## How to Use the CLUE Metronome

- Press **B** button to **play/pause**
- Press **A** button to switch time signatures
- Press touch pad **#0** to switch BPM adjustment **increments**
- Press touch pads **#1** or **#2** to **decrease** or **increase** tempo

https://youtu.be/dz6Jz0MeEU4

# Metronome CLUE

## 3D Print the Metronome Stand

![](https://cdn-learn.adafruit.com/assets/assets/000/090/941/medium800/circuitpython_metronome-2118.jpg?1588973865)

Download the .stl files and print the parts using PLE at 0.2mm layer height, no support needed.

The bottom cover won't be necessary.

[STL Files](https://www.thingiverse.com/thing:4347834/zip)
## Assembly

Place the CLUE into the case back and then snap-fit the front cover into place.

![circuitpython_metronome-2120.jpg](https://cdn-learn.adafruit.com/assets/assets/000/090/942/medium640/circuitpython_metronome-2120.jpg?1588973877)

Push the CLUE in its case into the stand face until the front plate is just proud of the surface.

![circuitpython_metronome-2121.jpg](https://cdn-learn.adafruit.com/assets/assets/000/090/943/medium640/circuitpython_metronome-2121.jpg?1588973930)

You can optionally add a bead of CA glue along the back edges for a more secure fit.

![circuitpython_metronome-2134.jpg](https://cdn-learn.adafruit.com/assets/assets/000/090/944/medium640/circuitpython_metronome-2134.jpg?1588973978)

To prevent sliding, adhere three rubber bumper feet to the underside of the base.

![circuitpython_metronome-2136.jpg](https://cdn-learn.adafruit.com/assets/assets/000/090/945/medium640/circuitpython_metronome-2136.jpg?1588974024)

![circuitpython_metronome-2138.jpg](https://cdn-learn.adafruit.com/assets/assets/000/090/946/medium640/circuitpython_metronome-2138.jpg?1588974033)

Set the face plate and CLUE into the base as shown.

![circuitpython_metronome-2127.jpg](https://cdn-learn.adafruit.com/assets/assets/000/090/947/medium640/circuitpython_metronome-2127.jpg?1588974087)

![](https://cdn-learn.adafruit.com/assets/assets/000/090/948/medium800/circuitpython_metronome-2126.jpg?1588974176)


## Featured Products

### Adafruit CLUE - nRF52840 Express with Bluetooth® LE

[Adafruit CLUE - nRF52840 Express with Bluetooth® LE](https://www.adafruit.com/product/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 projects that have a small screen and a lot of sensors. To make it compatible with existing projects, we made...

In Stock
[Buy Now](https://www.adafruit.com/product/4500)
[Related Guides to the Product](https://learn.adafruit.com/products/4500/guides)

## Related Guides

- [Introducing Adafruit CLUE](https://learn.adafruit.com/adafruit-clue.md)
- [CLUE Slim Case](https://learn.adafruit.com/clue-slim-case.md)
- [ulab: Crunch Numbers fast in CircuitPython](https://learn.adafruit.com/ulab-crunch-numbers-fast-with-circuitpython.md)
- [Clue And MagTag Pep Talk Generator](https://learn.adafruit.com/clue-and-magtag-pep-talk-generator.md)
- [CLUE Text Telephone Transmitter](https://learn.adafruit.com/clue-teletype-transmitter.md)
- [Digital Egg Drop Experiment with CLUE](https://learn.adafruit.com/egg-drop-clue.md)
- [No-Touch Hand Wash Timer for Circuit Playground Express and CLUE](https://learn.adafruit.com/no-touch-hand-wash-timer-for-cpx-and-clue.md)
- [CircuitPython CLUE I Ching Caster](https://learn.adafruit.com/clue-i-ching-caster.md)
- [¡Bienvenido a CircuitPython!](https://learn.adafruit.com/bienvenido-a-circuitpython-2.md)
- [PyLeap CLUE Sensor Plotter](https://learn.adafruit.com/pyleap-clue-sensor-plotter.md)
- [Frozen-Inspired Animated Pendant with Temperature Sensing](https://learn.adafruit.com/frozen-gizmo-pendant-with-temperature-sensing.md)
- [PyBadger Event Badge](https://learn.adafruit.com/pybadger-event-badge.md)
- [Yoga Pose Chime](https://learn.adafruit.com/yoga-pose-chime.md)
- [CircuitPython BLE Morse Code Chat](https://learn.adafruit.com/circuitpython-ble-wireless-morse-code-chat.md)
- [Welcome to CircuitPython!](https://learn.adafruit.com/welcome-to-circuitpython.md)
- [CLUE Dice Roller](https://learn.adafruit.com/clue-dice-roller.md)
