ANDI - Random Rhythm Generator - Electronics

7,259

123

7

Published

Introduction: ANDI - Random Rhythm Generator - Electronics

About: ANDinstruments makes ANDI which is a machine that generates a random rhythm at the push of a button. Each beat is unique and can be tweaked with five knobs.

ANDI is a machine that generates a random rhythm at the push of a button. Each beat is unique and can be tweaked with five knobs. ANDI is the result of a university project that was about inspiring musicians and examining new ways to work with drum beats. More information about the project can be found at andinstruments.com

During the design phase of ANDI a lot of inspiration was taken from the maker community and especially from exciting projects here at Instructables. To return the favor I have written this Instructable on how to design the electrical circuit for the ANDI beat generator. It is a simple circuit with five rotary knobs that controls the playback of short drum sounds stored on a micro-SD card via an Arduino Nano.

This Instructable covers the making of the electronic circuit and the code programmed on the Arduino and the drum sounds used are found here. The code is explained with comments in the code-file and I will not go in depth in the code in this tutorial.

ANDI has an outside of sheet aluminum and plywood and I have not included the making of the outside in this Instructable.

If there is an interest in a thorough explanation of the code or how to make the enclosure this it will be added in the future.

Otherwise this gives you the freedom to design your own enclosure for your ANDI-beat generator.

Follow my ANDinstruments project on instagram for media updates of the project: @and_instruments

Step 1: How to Follow the Tutorial

I have tried to make this Instructable as detailed as possible to give people of all skill levels access to it.

This means that it might feel over-detailed and slow sometimes so please speed through the steps that you already feel comfortable with.

For deeper understanding of some key-parts of the circuit I have added links to other Instructables, tutorials and wikipedia-pages that help you understand whats going on.

Feel free to redesign the circuit and rewrite the code as you see fit and if you do please link back to andinstruments.com and credit the source.

Please comment or send me an email at contact@andinstruments.com if you have any questions about the Instructable or any ideas on how to improve the circuit or the tutorial!

Step 2: Gather Components

I have used the following components for the design of the circuit:

  • 39x30 holes of 3 island stripboard
  • Arduino nano compatible V3.0 ATMEGA328 16M
  • (2x) 15x1 male pin header for Arduino
  • MicroSD breakout with level shifter (SparkFun Shifting μSD Breakout)
  • 7x1 male pin header for MicroSD Breakout
  • Micro SDHC-Card (Intenso 4 GB Micro SDHC-Card Class 4)
  • (4x) 10k Ohm potentiometers (Alps 9mm Size Metal Shaft Snap RK09L114001T)
  • (4x) 0.1uF Ceramic Capacitors (Vishay K104K15X7RF53L2)
  • 1k Ohm resistor (Metal Film Resistor 0.6W 1%)
  • 3.5mm panel mount audio jack (Kycon STPX-3501-3C)
  • Rotary encoder with push switch (Bourns Encoders PEC11R-4025F-S0012)
  • Toggle switch (1-pole solder tabs on-on MTS-102)
  • 9 volt battery strap (Keystone shielded 9 volt 'I' type battery strap)
  • 9 volt battery
  • Solid core wire with different colors

I will try to explain my choice of components throughout the Instructable. During the design process of the circuit I was mainly aiming for making this project as cheap and small as possible. Therefore I have tried to keep all the components mounted on the stripboard, so the wires connecting them can run along the board.

If you have any suggestions on how to improve the circuit please comment or send me an email.

Step 3: Find Some Tools

I use the following tools and equipment for this project:

  • Breadboard for testing components before soldering them to the stripboard
  • A small pair of pliers for cutting wires
  • Automatic wire stripper
  • A pair of pliers for bending solid core wires and legs of components
  • Soldering iron with adjustable temperature
  • "Helping hands" to hold the stripboard while soldering
  • A small amplified speaker and a 3.5mm audio cable to test the circuits audio outpu

Step 4: Follow the Schematic

This schematic is made with Fritzing and I recommend double checking with it throughout the process to see that you haven't missed any component or connection.

The components on the schematic doesn't look exactly like the ones I have used in my circuit but it shows how to connect the wires and the pins are in the same places as on my components.

Step 5: Connect the Arduino to the MicroSD-card Breakout Board

I recommend starting the project by testing the two most important components of the circuit: the Arduino Nano and the MicroSD-card breakout board. I do this on a breadboard and when it works fine I solder the components on a stripboard which makes it permanent.

If you want to learn more about how the MicroSD-breakout board works I recommend reading this tutorial from Adafruit: Micro SD Card Breakout Board Tutorial.

Solder pin headers onto the Arduino board and MicroSD breakout board. I use a breadboard to hold the male pin headers in place while soldering. It can be hard to make a good solder joint and you will some some faulty ones in my example images. I recommend watching some soldering tutorials before starting out if it is your first time with a soldering iron.

Hookup the MicroSD breakout board to the Arduino on the breadboard in the following order:

  • Arduino pin GND -> MicroSD GND
  • Arduino pin 5V -> MicroSD VCC
  • Arduino pin D10 -> MicroSD CS
  • Arduino pin D11 -> MicroSD DI
  • Arduino pin D12 -> MicroSD D0
  • Arduino pin D13 -> MicroSD SCK (I have also seen it called CLK)

The CD-pin of the MicroSD breakout board is not used in this project.

Step 6: Prepare the MicroSD-card

Connect the MicroSD-card to a computer with an adapter. I use a MicroSD-card to SD-card adapter. Format the MicroSD-card with the software SD Formatter from the SD Association: https://www.sdcard.org/downloads/formatter_4/

I use the setting “Overwrite Format” which erases everything on the MicroSD-card even though my card is brand new and already empty. I do this because it is recommended in many tutorials about using SD-cards with Arduino. Specify the name of the card and press “Format”. This usually takes about 5 minutes for me and ends with the message “Card Format complete !”. Close SDFormatter.

Upload all of the compressed sound clip .wav-files to the root directory of the MicroSD-card found here. Eject the MicroSD-card after the upload is finished and put it back into the MicroSD breakout board.

If you know your way around audio software you can add your own sound clips instead of mine if you name them the same way as in my example-files. The files should be 8bit .wav-files with a sampling frequency of 44 100Hz.

Step 7: Test the MicroSD-card

Upload the “CardInfoTest10”-code to the Arduino to test the connection to the MicroSD-card. This code was created by Limor Fried 2011 and modified by Tom Igoe 2012 and is found and explained on the Arduino-website here.

Open the serial monitor on 9600 baud and confirm that you get the following message:

“Initializing SD card... Wiring is correct and a card is present.

Card type: SDHC

Volume type is FAT32”

Then follows many lines of text which is not important to us now.

If you want to learn how the serial monitor works check out this lesson from Adafruit: Serial monitor arduino.

Step 8: Solder the Arduino and the MicroSD-breakout Board to the Stripboard

Disconnect the Arduino from the computer and gently pry the Arduino and the MicroSD breakout board from the breadboard. I use a small “flat-head” screwdriver and wiggle it between the plastic part of the male pin headers and the breadboard in several places until the components are loose enough to be lifted up by hand.

Put away the breadboard and flip the stripboard so the copper islands face downwards. Now it is time to solder the Arduino and the MicroSD breakout board onto the stripboard to make these parts of the project permanent. Remember that it is really hard to remove the components after soldering them onto the stripboard so make sure they are placed correctly in the right positions and that they are pushed as tight to the stripboard as possible to give them good mechanical strength after soldering.

I use insulating tape to hold the components while soldering because when you solder you need to turn the stripboard upside down so you see the copper islands and the male pin headers where the soldering is to be done.

I use “helping hands” while soldering to avoid laying the stripboard and the loose components on the table. If they lay down the loose components might move around a bit and the tight fit to the stripboard might be lost.

Repeat the process for the MicroSD breakout board. First put it tightly in the right place and fasten it with insulating tape.

Because the MicroSD breakout board only have male pin headers on one side it will be fastened in a tilting position. I don’t see any problem with this so I fasten it with an angle with insulating tape and it sits tightly after soldering.

I then turn the stripboard upside down and use my “helping hands” while soldering.

Step 9: Connect the Volume Control Knob and the Low-pass Filter to the Stripboard

Now it is time to add components to the stripboard for sound output and volume control. The components will be connected to each other by colored solid core wire.

The potentiometer acts as a volume control, when turned it increases its resistance and that lowers the volume of the sound output. If you want to learn more about potentiometers you can check out this wikipedia page: en.wikipedia.org/wiki/Potentiometer.

The resistor of 1k Ohm and the ceramic capacitor of 0,1 uF act as a low pass filter to remove high pitch noise. If you want to learn more about low-pass filters you can check out this wikipedia page: en.wikipedia.org/wiki/Low-pass_filter

I solder these components to the stripboard before soldering the wires between the MicroSD breakout board and the Arduino. I do this because I want the wires for the sound output lie close to the stripboard.

Start by flattening the metal legs of the potentiometer if they are bent like mine in the example. By doing this you can put the legs through the stripboard holes to increase the strength that holds the potentiometer in place on the stripboard.

Push the potentiometer through the holes of the stripboard according to the fritzing schematic.

Use pliers to bend the supporting legs of the potentiometer towards the stripboard.

Now it is time to connect the potentiometer to the Arduino. Cut the solid core wire to the right length.

Use a cable strip tool to remove about 5mm of plastic at each end of the wire to expose the metal inside.

Use the pliers to bend the wire so it fits to the stripboard.

Push the wire through the holes in the stripboard connecting it to the right pin of the potentiometer and the Arduino pin D9. Bend the wire at the backside of the stripboard to hold the wire in place while more components are added. Don’t solder yet.

Repeat the process by adding a wire to the middle pin of the potentiometer and an empty pin to the right of the potentiometer according to the fritzing schematics.

Add the 1k Ohm resistor to a hole next to the wire from the middle pin of the potentiometer.

Use the pliers to bend one leg of the capacitor twice to make it fit into two holes in the stripboard according to the fritzing schematic.

Push the capacitor through the holes in the stripboard so one leg share a hole with the resistor and one leg goes through a hole on an empty 3-hole-island to the right of the resistor.

Push down the capacitor far enough so that it is not higher from the stripboard than the shelf of the potentiometer below the threads. This is because the metal top of the casing will rest against the shelf on the potentiometer and therefore the capacitor should not be in the way of the top.

Add two more wires to connect the arduino ground to the left pin of the potentiometer and continue from there to a hole connected to the capacitor.

Step 10: Solder the Volume Control Knob and the Low-pass Filter to the Stripboard

After bending all the wires on the backside of the stripboard so the components and wires don’t fall off you can turn the stripboard upside down. I use my “helping hands” to hold the stripboard upside down. Make sure that the bent legs of the components and wires don’t interfere with any other. Sometimes the bent legs can be used to bridge the gap between different islands of copper. Usually this is good to do with the ground and the 5V pins of the Arduino because many components are often connected with these two. I use this technique on the Arduino ground pin in this case.

After soldering I use a sharp plier to cut the legs and wires where they are too long.

Step 11: Connect the MicroSD Breakout Board to the Arduino

Now it is time to connect the MicroSD breakout board to the Arduino. Start by connecting a wire between the ground of the Arduino to ground of the MicroSD breakout board. I now use the extension of the Arduino ground pin which I created by soldering the end of the wire that goes between the Arduino and the left pin of the potentiometer to the adjacent copper island next to the ground pin of the Arduino.

Continue bending the end of the wire on the backside of the stripboard to hold the wire in place and wait with soldering until all the wires between the Arduino and the MicroSD breakout board are in place.

Add a wire between the CS-pin of the MicroSD breakout board and the D10-pin of the Arduino.

Continue with a wire between the DI-pin of the MicroSD breakout board and the D11-pin of the Arduino.

Connect the DO of the MicroSD breakout board with the D12-pin of the Arduino.

Connect the SCK-pin of the MicroSD breakout board (on another MicroSD breakout board I have used before this pin has been called CLK instead of SCK) with the D13-pin of the Arduino.

The last wire connected is between the VCC-pin of the MicroSD breakout board and the 5V-pin of the Arduino.

The wires can be a little cramped but make sure the metal parts of the wires don’t touch each other.

Turn the stripboard around and make sure the wires are still in place.

Step 12: Solder the MicroSD Breakout Board to the Stripboard

Apply solder and cut the leftover wire ends.

Step 13: Connect & Solder the Audio Jack to the Stripboard

Now it is time to connect the audio jack to the stripboard. Start by fastening wires to the audio jack and bend the wires around the audio jack pins to make them stay in place.

It can be hard to hold the wire in place while soldering. I use my “helping hands” once more for this.

Connect the audio jack wires to the stripboard according to the fritzing schematic and bend the wires on the backside of the stripboard to hold them in place.

Turn the stripboard upside down and apply solder to the audio jack wires. Then cut the leftover wires with a pair of pliers.

Step 14: Test the Audio Jack

Now it is time to test the audio output. Connect the Arduino to the computer and upload the “andi_testsound”-code found here.

Connect the audio jack with an 3.5mm audio cable (the same kind of connector normal earphones use) to an amplified speaker. In this video I connect the audio jack to a small bluetooth-speaker that also has an 3.5mm “Audio In”-input on the backside. This circuit will not work with earphones connected because it lacks amplification of the sound output. The Arduino still needs to be connected to the computer to get power. The “andi_testsound”-code plays different sound clips from the MicroSD-card and if everything works you will now hear a random beat through your speaker. You can also turn the potentiometer to increase or decrease the volume of the output.

Step 15: Connect & Solder the Potentiometers to the Stripboard

Now it is time to add the rest of the potentiometers that are used as knobs to control the generated beat. Read more about using potentiometers as analog inputs with an Arduino on the Arduino-website: Reading a Potentiometer (analog input).

Use a plier to straighten the legs of the potentiometers that have no electrical function just like which was done with the first potentiometer.

Put the potentiometers at the right location according to the Fritzing-schematic with all the five legs of the components through the holes.

Bend the two side legs on the backside of the stripboard to give it some mechanical strength while soldering.

Solder all the five legs even if the side legs don’t have any electrical function. This gives the potentiometers a little extra mechanical strength.

Step 16: Connect & Solder the Capacitors to the Stripboard

Capacitors are added between the signal output-pin and the ground-pin of the potentiometers to make the signal more stable. Read more about input smoothing in this Instructable: Smooth Potentiometer Input.

Add the capacitors to the stripboard according to the Fritzing-schematic. Push them down as close to the stripboard so that the top of them are not above the shelf of the potentiometers.

Bend the legs of the capacitors on the backside of the stripboard to hold them in place while soldering.

Solder the legs and cut away the leftover length.

Step 17: Connect & Solder the Rotary Encoder to the Stripboard

Straighten the two side legs of the rotary encoder so that they lie flat against the stripboard. I do this because my rotary encoders have side legs that are too big to push through a stripboard hole.

Push the rotary encoder through the stripboard at the right place according to the Fritzing-schematic.

I then use some insulating tape to hold the rotary encoder in place while soldering because the pins of the encoder doesn’t hold it in place good enough.

Solder the rotary encoder and remove the tape.

Step 18: Connect & Solder Wires Connecting the Potentiometers to the Arduino (1/2)

Add the signal cables from the middle-pins of every potentiometer to the right Arduino pin according to the Fritzing-schematic.

Do the same with the 5V-wires connecting the potentiometers right pins in series with the VCC-pin of the MicroSD breakout board.

Bend the wires on the backside of the stripboard.

Solder the wires and cut the leftover metal part of the wires.

Step 19: Connect & Solder Wires Connecting the Potentiometers to the Arduino (2/2)

It starts to get crowded on the front of the stripboard so we want to add the last wires to the backside to connect the last pins of the components. Now that the potentiometers and the rotary encoder are in place the stripboard can stand by itself upside down which helps during the soldering of wires straight on the backside.

Start by measuring three wires of equal length that will connect the ground-pins of the potentiometers. These wires will not go through the holes but instead be soldered while lying next to the right pin according to the Fritzing-schematic.

This is harder than to solder a wire that has gone through a hole and being bent so start with one wire at a time and be careful to not overlap the solder of different pins.

Step 20: Connect & Solder Wires Connecting the Rotary Encoder to the Arduino

Now continue by adding two shorter wires to connect the ground-wires of the potentiometers to the rotary encoder.

Solder the wires while letting the stripboard stand on its own on the potentiometers.

Add three wires connecting the rotary encoder to the arduino according to the Fritzing-schematic and finally add a short wire connecting the ground-pin of the MicroSD breakout to the ground-pin of the closest potentiometer. Solder the wires one at a time.

Step 21: Test the Full ANDI-code

Now it is time to test the full version of the code that's found here. Connect the Arduino to the computer and upload the ANDI-code.

Then connect the speaker cable to the audio output and test try out the potentiometers and the rotary encoder. If you hear a lot of high pitch noises don’t worry, this has for me been due to powering the Arduino with the USB-cable. In the next step you are going to solder a battery connector and a power switch to the stripboard and then the Arduino doesn’t have to be powered by the computer anymore.

Step 22: Connect & Solder the Battery Connector to the Stripboard

The battery connector connects a 9V-battery as a power source to the stripboard. The toggle switch will switch on or off the project by bridging or breaking the red wire of the battery connector.

Cut the red wire about 10cm from the battery connector holder and bend the end of the wire around the middle-pin of the toggle switch. Then connect another wire of about 20cm to one of the outer pins of the toggle switch.

Solder both of the red wires to the toggle switch using the “helping hands” to hold the wires in place.

Connect the end of the red wire to the Vin-pin of the Arduino and the black wire to the ground-pin at the locations according to the Fritzing-schematic.

Bend the wires on the backside of the stripboard and turn the board around to solder it in place.

Use the toggle switch to turn on the Arduino and see if the LEDs on the micro-controller turns on.

Step 23: Test the Circuit

Turn the leftmost potentiometer all the way counterclockwise to lower the volume and then plug in the speaker cable to the audio connector. The speaker should also be on minimum volume while connecting the stripboard to avoid any high noises that can sometimes occur while pushing the speaker cable into the audio connector.

Step 24: Enclose It Your Way

Great work, you are done!

Now it's up to you to enclose the circuit anyway you like. I chose to put my circuit inside an enclosure made of sheet aluminum and birch plywood painted dark but feel free to do it anyway you like.

Please leave a comment or send me an email at contact@andinstruments.com with your circuits or if you have any questions or improvements to share!

First Time Author Contest 2018

Second Prize in the
First Time Author Contest 2018

Epilog Challenge 9

Runner Up in the
Epilog Challenge 9

Arduino Contest 2017

Runner Up in the
Arduino Contest 2017

2 People Made This Project!

Recommendations

  • Clocks Contest

    Clocks Contest
  • Woodworking Contest

    Woodworking Contest
  • Casting Contest

    Casting Contest
user

We have a be nice policy.
Please be positive and constructive.

Tips

1 Questions

Does anyone have a schematic for this circuit? The freaking Fritzing diagram is killing me!!

Thanks, apologies for allowing my frustrations to seep into my question.

1 more answer

Hi BlackMaya! Right now there's no schematic for the circuit. Hopefully the Instructable-steps could help you understand how to connect the components.

7 Comments

Fun to build, and a very fun FUNction!