CPB PWM Jam Buddy (Blues Jam Track/Metronome)

by scordos in Circuits > Microcontrollers

173 Views, 1 Favorites, 0 Comments

CPB PWM Jam Buddy (Blues Jam Track/Metronome)

IMG_0955.jpeg
CPB Jam Buddy

Do you ever find yourself without a buddy to play the blues with? Well look no further! I'll teach you how to build one!


The controls are simple. The box has two potentiometers: one to pick the song, and one to control the tempo of the song. The tempo ranges from 60 to 160 BPM. My project contains three songs (Two 12-bar blues melodies and a metronome), but code can be modified to make any song you would like.

Supplies

4333-11.jpeg

Adafruit Circuit Playground Bluefruit

2 x Potentiometers

3 x Alligator clip wires

CPB Power Supply

A Box

Circuit Python

Write a Circuit Python Program!

Screen Shot 2022-03-29 at 3.52.57 PM.png

Write a Circuit Python program that plays music. I used the pwmio library to play through the built in speaker, and used slide potentiometers to control tempo and select songs.

The code works as follows:

A "play" function requires a note as a parameter and a duration as an input from a potentiometer, which ranges from 60-160 bpm.

"Song" functions play notes in a predetermined order, and the melody is repeated within a for-loop of another function. The blues function, for example, plays a blues melody 12 times, and inputs key changes.

The code can be modified to incorporate the ability to shift keys, but I ran out of room on my CPB. Maybe the next time around, an Arduino Nano may be a better choice.

Lastly, the second potentiometer is split into 4 sections: Off, Blues Melody 1, Blues Melody 2, and Metronome. Each section has a designated Neopixel color (Red, Purple, Blue, Green) and changes at the end of every measure due to the "check" functions".

I've attached my code to this step, or you can view it on Github here: https://github.com/scordos/CPB-PWM-Jam-Buddy

Downloads

Make a Box!

IMG_7546.jpeg
IMG_7549.jpeg

I made my box out of foam poster board. The front of my box has the potentiometer interface, with a drawing of my jam buddy on it. The drawing has its eyes cut out, for an indicator light, but your design is up to you. Get creative!

Assembly!

IMG_0951.jpeg

Once you have your box, now it's time to put your circuit playground in the box, along with the power supply. Install the potentiometers in the top of the box, and connect them to your CPB with your alligator clip wires. I soldered mine in, but thats entirely optional.

Close It Up!

IMG_0955.jpeg

Close up the box and pray that it works. Mine took some finicking, but I got it to work just fine. Have fun jamming!