Introduction: Beat Making Machine

The inspiration for this project is the drum machine, a type of device that can often be used by amateur producers to create beats for their music. On these machines, you can experiment with a variety of different sounds. Producers can then choose sounds, notes, and rhythms that they like and continuously build their beats.

I didn't have the capacity to create industry-standard drum machines, but I did have access to a solenoid, Arduino, and various household objects that made unique sounds. This was enough to create my own version of this device that had three different sound options, and five different tempo options to choose from. With some clever programming, a user can record their own sounds in the same way a producer would and play back their tunes.

Supplies

Arduino Uno

Solenoid

MOSFET Driver Module

Resistors

Potentiometer

Buttons

Cardboard

Glue

Zip Ties

Various Household Trinkets

Step 1: Solenoid

The primary way in which I generated sound is with a solenoid. I took advantage of the back and forth motion provided by the solenoid to hit various objects to produce different sounds.

To get the solenoid to work, I used a MOSFET driver module. I arranged this all in the form of the circuit shown above.

I used "blink," one of the default Arduino tutorial scripts to test this setup. I use digitalWrite to push the solenoid forward and backward.

Step 2: Servo Motor

To rotate between different types of sounds, I used the help of a servo motor. The advantage this type of motor provides is that you can prescribe an exact location for the motor to be in, allowing us to precisely switch between our sound sources.

I also added a potentiometer as an input device. While this will later be used to determine the speed of the solenoid, I wrote a script relating potentiometer input to servo motor positioning to demonstrate how each input and output device works.

The circuit diagram I provided is to be built in conjunction with the MOSFET and solenoid in Step 1.

Step 3: Buttons

I rounded off the hardware portion by adding another input device: buttons. I lined up three buttons whose uses will be defined later.

Step 4: Structure

To make use of the hardware we built thus far, I used cardboard and various items to build out the beat making machine.

I started by securing the Arduino, MOSFET module, and breadboard to a large sheet of cardboard. I then glued the servo motor to the sheet with its axle facing up.

Next, I glued the solenoid to a thin piece of cardboard that I attached perpendicularly to the axle. With this, the servo motor now controlled the positioning of the solenoid.

Finally, I attached various items such as a magnet and a keychain around the servo motor. The goal is to write a script such that the servo motor spins around, allowing the beating solenoid to make different sounds against these different items.

Step 5: Code

Writing the code for this project was surprisingly simple. The code is well documented and easy to follow along. The general logic is as follows:

In the setup, each of the pins in which we use for solenoids, motors, potentiometers, and buttons are initialized.

In our loop function:

  1. We check if the third button has been pressed. If so, we run a playback of whatever notes have been recorded thus far.
  2. We check if the first button has been pressed. If so, we rotate the servo motor such that the solenoid now points at a different instrument.
  3. We read potentiometer input and adjust the note speed (amount of delay between solenoid usage) accordingly.
  4. We play the note at the current location and current note speed.
  5. We check if the second button has been pressed. If so, we record the current position and current note speed in a list to be used in the first step of the loop function.