Basys 3 Synthesizer and Metronome

by clayton0915 in Circuits > Tools

1382 Views, 3 Favorites, 0 Comments

Basys 3 Synthesizer and Metronome

pmodamp2-1.png
Digilent_Basys-3_30044247-01.jpg

In this tutorial we will be demonstrating how to program your Basys 3 FPGA to create a synthesizer and metronome. This can be done using only a Basys 3 FPGA and an attachment called the PMod AMP2 Audio Amplifier. The way this equipment functions is it drives a speaker either high or low at 3.3V. By driving it high or low at certain intervals or frequencies, you can create a square wave sound. The materials we used are the Basys 3 board, the PMod AMP2, and a random set of earphones. Any speakers should work, although they will be full blast the entire time. As a result, you should be advised that some headphones or speakers may be damaged by the full voltage. To mitigate this, you could use a resistor or potentiometer to reduce some of the 3.3V current.

Function Overview

blackBox.png

This black box diagram describes the function of the project. There are several inputs:

  • 8 switches (sw)
  • 3 buttons (btnC, btnU, btnD)
  • 1 clock (clk)
  • 2 control switches (mode, kill)

There are several outputs:

  • 1 seven segment display (an, seg)
  • 1 output control signal (output)
  • 1 output enable signal (enable)

The switches control what note is being played. btnC controls the octave using a finite state machine. btnU and btnD control the BPM that the metronome mode operates at. The clock is a 100 MHz clock that controls the entire circuit and is divided appropriately to create the necessary timings. The two control switches change from constant tone mode to metronome mode as well as controlling whether or not the device makes any sound.

The seven segment display shows the current beats per minute. The output control signal is driven high or low at an appropriate frequency to create a sound, and the enable signal simply turns the output on or off.

Credits and Files

All code written by Clayton Lipping and Ben Dahlgren except:

  • SSEG_DEC written by Bryan Mealy
  • CLK_DIV written by Bryan Mealy

Although all other code is original, credit to

https://www.instructables.com/id/Basys-3-Keyboard-Synthesizer/

for providing reference and guidance.