| Musical beat detector PCB V1 with mods | 9 LED sequencer PCB V1 with Arudino Nano |
musical beat detector schematic
Arduino Nano 9 LED Sequencer schematic
This project involves a beat detector circuit and an accompanying LED sequencer circuit. The beat detector circuit can be used for synchronizing a variety of different LED displays to music and other sources of sound. It picks up the sounds with a small electret condenser microphone, processes the audio information and isolates changes in the sound which correlate to the rhythm of the music. It is designed to be sensitive to drum beats, bass lines and periodic changes in loudness.
The beat detector circuit outputs a low-going pulse with every beat, this can be used to trigger a microprocessor or a discreet digital circuit such as the 9 LED sequencer shown below. The LED sequencer circuit steps through a variety of patterns on an LED display. An Arduino nano processor board and associated software is used as the platform for the LED sequencer. An older LED sequencer that runs on a Motorola 68HC05K1 microprocessor would also be usable with the beat detector. The code for both sequencers can be seen in the Resources section below.
The beat detector runs on regulated 12VDC power and the output uses an open-collector transistor circuit which is compatible with 3.3V, 5V and higher voltage CMOS logic circuitry. The 9 LED sequencer circuit runs on 5VDC power, this can be derived from the beat detectors power supply running through a 7805 voltage regulator or a switching regulator.
The beat detector is shown here running an LED light sequencer, it could also be used to sequence a higher power stage lighting system that is used for live music performances. There may be other non-musical applications for the circuit if you need to detect repetative thumping sounds.
This is a fairly complex analog and digital circuit with numerous stages. If you build the circuit, it is a good idea to observe the signal path by connecting an oscilloscope to the various test points shown in the schematic. Probing the test points can also be helpful for de-bugging the circuitry.
The beat detector runs on 12VDC power and the companion LED sequencer runs on 5VDC power. The beat detector will work with supply voltages between 8VDC and 15VDC. The 5VDC power can be derived from the 12VDC supply by using an inexpensive LM2596 DC-DC converter board. The beat detector's power supply section uses a 470uF electrolytic capacitor and a 100nF capacitor to filter and bypass the incoming 12VDC supply. A simple two resistor voltage divider and 22uF capacitor are used to produce 6VDC for biasing several of the op-amp stages.
Audio is picked up by a miniature electret microphone, the microphone's internal FET transistor is biased with a 39K resistor. Different resistor values may be used to optimize the sensitivity of diffent microphones. The microphone is fed to a variable-gain class-A audio amplifier that is built around a 2N3904 NPN transistor. The input and output transistors use 1uF feedthrough capacitors to insure good bass response.
The amplified audio signal is run through a constant-volume circuit (compressor). This circuit was found in a Nuts and Volts magazine article by author Ray Marston (see below).
The compressed audio circuit is fed into a two pole lowpass filter based around one of four sections of an LM324 quad op-amp IC. The filter attenuates much of the high frequency information from the audio signal in order to enhance the low frequency bass notes.
The lowpass filter feeds into an op-amp inverting amplifier and associated peak hold circuit. This circuit further filters the audio into a slow-moving waveform that tracks the loudness of the audio's bass information.
The peak hold circuit's output feeds a differentiator circuit. The differentiator is used to track and amplify small changes in the audio's bass information.
The differentiated bass signal is run through the final op-amp stage which is wired as a threshold comparator with positive feedback for hysteresis. The threshold circuit produces a low-going digital signal which turns on when the input signal pulses close to zero volts. This happens when louder bass notes make their way through the preceeding audio stages.
The threshold comparator output drives one stage of a CD4538 CMOS one-shot circuit to produce an approximately 50mS pulse on the output of the one-shot. The one-shot is re-triggerable, if other pulses arrive while the 50mS output pulse is active, the one-shot output will stay active and the output pulse will be longer than 50mS. The output of this one-shot turns on the red LED which indicates a detected beat. The one-shot also turn on the open-collector output transistor circuit which is used to trigger the external sequencer circuitry.
The second CD4538 one-shot circuit triggers when the first one-shot's output pulse ends. It produces a 50mS hold-off pulse which is wired to the reset line on the first one-shot to prevent extra trigger pulses from occuring during this time. The hold-off one-shot guarantees a 50mS or longer dead-time period between beat pulses. This limits the maximum speed of the beat pulses and produces a well-defined pulse waveform for driving the external sequencer circuitry. The hold-off one-shot also drives the (optional) green LED.
The Q! output on the CD4538 pin 7 is fed through a 1.5K current limiting resistor and across a 1N5231 5V Zener to produce a low-active beat detect output with 5V logic levels. The output is used to drive an interrupt pin on a microprocessor. The interrupt pin is defined to be active on the falling edge of the beat detect signal.
The Arduino nano processor and associated electronics are powered by 5VDC from a 78L05 regulator IC. The low-going output signal from the beat detector circuit is connected to the D1/Int0 pin on the Arduino Nano. The Arduino software advances the LED pattern when this signal triggers. If no triggers come in for a number of seconds, the software will automatically advance the pattern at a randomly chosen speed.
The eight differently colored LEDs are driven by a ULN2803A Darlington transistor array. The ULN2803A is driven by the Arduino ports D4-D11 and pulls the cathodes of the LEDs down through current limiting resistors. The resistors are adjusted in value for similar brightness levels on the various LEDs. The white LED is driven separately via a 2N3904 transistor connected to port D12.
Selecting the differently colored LEDs takes a bit of effort, many LEDs were sourced from several vendors in order to find a set of eight LEDs with a good spread of colors and similar brightness.
Two prototype versions of the beat detector have been built. The first version was built on a piece of bare copper circuit board material using the Dead Bug construction method. The grounded side of various components were soldered to the copper surface and the rest of the wiring was done between the parts.
The second prototype (shown above) was built on a home-made single-sided PC board using iron-on Press-N-Peel blue laser transfer film and FeCl etchant. This can be seen in the above photo. This is the first revision of the PC board. There are a number of bodges a.k.a. modifications that are visible on the board. The IC that is in a socket on its side is the MC4538 dual one-shot, this replaced a CD4001 (empty socket) that was used in an earlier version.
The Arduino Nano 9 LED sequencer was also built on a home-made PC board. The two boards were mounted in a small metal box with the LEDs facing a hole in the box. A piece of plastic lensing material was used to spread out the light from the bright LEDs and produce a more interesting pattern. A 78L05 voltage regulator and associated heat sink were added to the box to reduce the main 12VDC input power to 5VDC for driving the LED sequencer.
The 2K Mic Gain potentiometer on the beat detector circuit was mounted on the back of the box.
Alignment of the beat detector is straightforward, it helps if you have access to an oscilloscope. Connect the scope to ground and TP1. Put the microphone near a sound source such as a speaker from a stereo system. Play some music with a well defined beat through the stereo. Observe the audio waveform as the stereo's volume is turned up and down. Adjust the Mic Gain control so that clipping starts to happen when the stereo is turned up to a loud volume.
Next, connect the oscilloscope to ground and TP7 and put turn the volume on the stereo to a typical listening level. Play some music that has a well defined beat or bass line. Adjust the sensitivity control on the thresold comparater so that you see frequent negative pulses on the scope. This control can be further adjusted to make the beat detector more or less sensitive as you listen to your favorite music.
The beat detector can be placed in any location where you want to detect repetative sounds and control something. The most common use is to combine it with a LED sequencer to making a color organ for an audio system. For best results, the detector should be placed near a loudspeaker. Power up the circuitry and watch the will lights dance in sync with the music.
Back to FC's LED Circuits page.