(x1) Arduino Uno (Duemilanove is fine, but make sure it is ATMEL328P) Radioshack #276-128
(x1) Arduino ProtoShield Radioshack #276-140
(x1) PC Board with Copper Radioshack #276-147
(x9) High Tact Switch Radioshack #275-002 (I really liked the feel of these buttons, but they only come in a surface mount version, which makes them fairly difficult to solder because of the small leads. Additionally, since these buttons are square it is harder to drill a hole for them in an enclosure. If you are a beginner, you might want to use a different type of button, any of these momentary switches will work)
(x1) 10KOhm Audio Control Potentiometer with SPST Switch Radioshack #271-215 (this will be used to control volume and turn the device on/off)
(x1) 50K-Ohm Linear-Taper Potentiometer Radioshack #271-1716
(x2) 220µF 35V 20% Radial-lead Electrolytic Capacitor (or anything between 200 and 300 uF) Radioshack #272-1029
(x2) SPST PC-Mountable Submini Toggle Switch Radioshack #275-645
(x2) Silver Tone Knurled Knob (or any knob with 0.25″ inner diameter) Radioshack #274-424
(x9) 1N914/4148-Type Diode (two packages) Radioshack #276-1122
(x3) 2K ohm 1/2W 5% Carbon Film Resistor (1 package)
(x10) 10K Ohm 1/4-Watt Carbon Film Resistor (2 packages) Radioshack #271-1335
(x8) 20K Ohm 1/4-Watt Carbon Film Resistor (2 packages)
(x1) 4.7K Ohm 1/4-Watt Carbon Film Resistor Radioshack #271-1330
(x1) 1K Ohm 1/4-Watt Carbon Film Resistor Radioshack #271-1321
(x1) 5K Ohm 1/4-Watt Carbon Film Resistor
(x1) 9V Alkaline Battery Radioshack #23-853
(x1) Heavy-Duty 9V Snap Connectors Radioshack #270-324
(x1) Amber Super-bright LED Indicator Radioshack #55050630
(x1) White Super-bright LED Indicator Radioshack #55050633
(x1) 1/8″ Stereo In-Line Audio Jack Radioshack #274-274
(x1) LM386 Low Voltage Audio Power Amplifier (8-Pin DIP) Radioshack 276-1731
(1x) 8 Pin Socket 276-1995 Radioshack 276-1995
22 Gauge Wire Radioshack #278-1224
Solder Radioshack #64-013
four wood screws
Heat Shrink Wrap Radioshack #278-1610
Electrical Tape Radioshack #64-2375
I’ve included fritzing breadboard diagrams (divided into a few parts) and schematics for this project as well as all firmware. You can find these documents throughout the body of this instructable or download them all in one zip file below.
Step 1: Build enclosure
I wanted to sand off the scorched ends of the laser cut pieces so that the outside of the box had a consistent finish, so I also made a set of eps files with some extra length on the ends for sanding (“enclosure long”).
I glued the pieces together with wood glue and cut a piece of acrylic for the front panel.
Step 2: Wire buttons
As shown in figures 11 and 12, multiplexed buttons are wired such that each button shares a common lead with all the buttons in its row, and it shares the other lead with all the buttons in its column. This way we can use the arduino to ground one row of buttons at a time (Arduino D8, D9, D10) and check to see if any of the columns are grounded by measuring the voltage of A0, A1, and A2. Essentially, we will be measuring the states of the buttons row by row. Since the Arduino is very fast, we will not be able to tell a difference in the response time of the buttons when they are multiplexed vs if we had dedicated one input pin to each button.
Multiplexing buttons does bring some complications. Since current can flow in both directions through a button, if two buttons are depressed at the same time, current can flow through the circuit in ways we did not intend and make us think that four buttons are depressed. In order to prevent this, each button is attached to a diode, ensuring current always flows through the buttons in one direction.
Buttons work in the same way as switches, they close an open circuit. Most buttons have two leads (figure 9), but some (like the ones I used) have four leads because each side of the switch is split into two separate leads. By comparing figures 9 and 10, you can see that both types of buttons are essentially the same, but if you use the four lead buttons, be sure to check the specs to locate two leads that are not connected to each other.
Solder a diode to one side of each switch, be sure that the “-” end (usually indicated with a stripe) is facing away from the switch. Solder a (preferably black) wire to the other end of the diode and a (preferably red) wire to the other side of the switch. Do this for all nine switches. You may find it necessary to use hot glue, electrical tape, or heat shrink to reinforce/protect these connections.
Once soldered, mount each button in your project enclosure.
You can find the fritzing files for 2-lead button and 4-lead button multiplexing below.
Step 3: Prepare arduino shield
Step 4: Wire buttons on arduino shield – part 1
Step 5: Wire buttons on arduino shield – part 2
Again, I’ve provided the circuit diagrams and fritzing documents for both 2-lead and 4-lead buttons.
Step 6: Wire buttons on arduino shield – part 3
2-lead and 4-lead diagrams and fritzing are provided here, again.
Step 8: Mount and wire LEDs
Attach the shorter leads of both LEDs to each other (grounds) and connect to the ground pin of the arduino protoshield. Attach a current limiting resistor to each of the longer leads of both LEDs. The optimum resistor value can be calculated as follows:
R is resistance across the resistor measures in ohms
V is forward voltage in volts from LED specs
I is continuous forward current measured in amps from LED specs
For most through hole LEDs the forward voltage will be about 2-3.5V and the current will be 15-25mA. You can check the datasheet of the LEDs you bought to calculate the lowest possible resistor values for your LEDs. I chose to use resistors that were much higher than I needed, beacuse I didn’t want the LEDs to be blindingly bright. I ended up using a 1k resistor for the amber LED and a 4.7k resistor for the white LED, these values may be different depending on what type of LEDs you use and how bright you want them, but 1k is a good place to start.
I’ve attached the fritzing document which includes the LED wiring below.
Step 9: Tempo pot
Step 10: DAC
The resistor ladder for this project is an 8-bit DAC. As you can see in the schematic, Arduino PORT D (digital pins 0-7) output 8 pieces of data (one from each pin) which are sent to each junction of the DAC. I soldered these resistors on a piece of copper plated protoboard I cut down to size.
I added two 0.1uF capacitors to the end of the resistor ladder to act as a low pass filter. This type of filter will remove the higher frequencies caused by the low (8khz) sampling rate of the audio and smooth out the waveform. You may choose to change the values of these capacitors depending on what you like.
There are 10 connections to the DAC, 8 digital input pins from the arduino, ground, and audio out. The green wire in figure 6 is audio out, this wire will connect to the amplifier in the next step. You can find the fritzing file below.
EasyEDA: Ideas for Circuit Design, Innovation for Electronics Access
Free Circuit Design: Schematic – Simulation – PCB Layout – Gerber Viewer
Cheapest PCB Prototype: Only $2 for 10pcs 10×10cm PCBs, 24 hours Quick Turn, DHL Delivery in 3 Days
This Post / Project can also be found using search terms:
- arduino rgb led beat detection audio in