Air Drums Using Atmega32

Introduction

One Sentence Sound Bite

Air Drums is an electronic drum kit played in the air that eliminates the need for tactile drum pads.

Summary

We created an electronic percussion set with three upright percussion sounds and a floor bass drum sound. The upright instruments require one/two modified drumsticks to play, while the floor drum requires an electronic bass pedal. The important difference between our drum kit and store bought drum kits is the lack of drum pads. Instead, our drum kit can be played entirely in the air, eliminating the distracting tapping noise that comes from the drum pads. This means you can play the Air Drums in your room with a set of headphones without annoying your next-door neighbor!
Air Drums Using Atmega32

High Level Design

Rationale

The inspiration for our project came from multiple occasions of being scolded by our roommates for playing the Rock Band drums too loudly (all while wearing headphones). The rationale behind our project was to create a drum kit that would not make any noise when played. While ordinary electronic drum kits claim to be silent since the noise they produce can simply be filtered through headphones, this is not the whole truth. The loud rap of the drum sticks hitting the drum pads carries a great distance. The loud beat has been known to be just as annoying to roommates and apartment mates as the sound of actual drums. For this reason we wanted to eliminate the drum pads and therefore the loud rapping noise. The idea was wireless drum sticks with a speaker component that can be plugged into headphones. This will eliminate all ambient noise as there is no actual contact with a surface of any kind. In addition, Air Jam, the air guitar project from the 476 project page, inspired the idea to create an entire air band.

Background Math

The background math for this project was required for the drum sound synthesis. Instead of using direct digital synthesis recorded sound playback, as we did in previous labs, we chose to use the Karplus-Strong digital signal processing algorithm to create accurate drum sounds. The Karplus-Strong algorithm is a digital approximation of the way a wave decays in a string or on a drum. Using a shift register, when the instrument is struck the register is filled with random noise which is the same as the fourier transform of an impulse of energy to the instrument. For drums this shift register is band passed using a butterworth band pass filter, for cymbals we use a low pass filter after subtracting the delayed version of the signal from itself. The frequency of the sound is given by the sampling frequency over the length of the shift register.

Logical Structure

The structure of this project is broken down into three separate tasks: Bluetooth communication, drum sound synthesis, and IR position parsing. The first step, Bluetooth communication, consists of a Wiimote, and a Bluetooth dongle connected to a laptop with Blue Soleil Bluetooth software installed. The Wiimote is used for its CMOS camera technology which can determine the positions of multiple IR LEDs. We have two such IR LEDs which are connected to the tips of drumsticks so we can determine drum tip position. The Bluetooth dongle and Blue Soleil connect to the Wiimote through a Bluetooth connection. From this connection we use the open source Wiimote Lib, written in C#, to query the Wiimote for the position values of up to four IR LEDs in the reference frame of the Wiimotes CMOS camera. After receiving this data we open a serial port and transmit this data to the Atmega32 on the STK500 board through the serial connection.
This leads us to the next step, IR position parsing. In this portion of the code, written on the Atmega32, we receive the serial data transmitted from the laptop software. This information is sent out in packets of information that include the number of the LED whose data is being transmitted, and whether it is the x or y position of the IR LED. This is followed by the actual data. Knowing the format of these packets, we parse these packets in a large switch statement, update the x or y position variable for one of the IR LEDs, and request another packet. From this data we determine which drum is being hit depending on its relative location on the CMOS sensors scope. The scope is simply divided into three equal widths on the x axis. When the y position in each of these scopes is lower than the half way mark and changes from down to up, we play the corresponding drum sound. In addition we play the bass drum noise everytime the bass pedal is hit. This requires no serial communication however since it is connected directly to an input on the Atmega32.
The final task we accomplished in this project was drum sound synthesis. We created four separate drum sounds, a bongo, a mid Tom, a crash cymbal and a bass drum. Each sound we generated using some variation of the Karplus-Strong algorithm which uses different filters on random noise to create sounds. This essentially simulates different instruments and produces a fairly accurate synthesized tone. The algorithm uses different shift registers initialized to hold random noise. When our drum is hit we perform some type of filter on the random noise in the shift register a number of times until the sound decays, based on a decay factor that we introduce. The length of the registers determines the frequency of the sound which is actually produced using a PWM signal from the microcontroller. The calculations for the sound are actually performed in an interrupt that runs at an eighth of the clock frequency. This is necessary since we have a limited amount of space to store variables and the larger the initial interrupt frequency, a longer shift register is required to produce different frequency tones. Finally, as the drum sound is created it is sent from the microcontroller to a set of speakers via the PWM signal.

Hardware/Software Tradeoffs

Our initial plan was to use two Nintendo Wiimotes as the drum sticks in our project. When we realized the amount of added C# code this would have required (plus our very limited experience with C#) this seemed less possible. Furthermore when we began testing by holding a single Wiimote and using multiple IR LEDs for position detection, we noticed that the range of the Wiimotes position was very limited. Because of the very directional IR LEDs, when we changed the yaw of the Wiimote, the camera was facing the IR emission from a different angle and this decreased the position range even further. Instead, we decided to use the Wiimote for its CMOS camera and detect the LEDs as drumsticks. This dramatically increased the position range that we could measure, since we could rotate the LEDs from side to side and the Wiimote could still detect the IR dot in the same x,y position.
Another design tradeoff in our project was the limited amount of memory space on the Atmega32. This space issue significantly limited the size of our shift register arrays, and required us to decrease the frequency of our output sound interrupt by one eighth. This allowed us to reduce the size of the shift registers and produce accurate frequencies despite the size limitations.

Relationship of Design to Standards

The standards relevant to this project include both IEEE standards for Bluetooth as well as ANSI standards pertaining to safety with radio frequencies in hand held wireless communication devices.
IEEE Standard 802.15.1-2005: Bluetooth 1.2 became an IEEE standard in 2005 and defines specifications for wireless connectivity in the Personal Operating Space. We operate the Bluetooth connection within the 10 meter space and used a store bought Bluetooth dongle to interface the Wiimote to the PC. We followed this standard by leaving the Bluetooth connection unmodified by us, and instead we simply received the data.
62209-1 Ed. 1.0 b:2005: This standard assures safety in hand held wireless devices that utilize radio frequencies. We comply with this standard since our projects radiation falls well below the maximum absorption rate limit required for safe human use of handheld wireless devices.
ISO/IEEE 11073-30300:2004: This standard provides a structure for using Infrared communication in hand held devices. The most important part of this standard is adherence to the eye safety clause. We do not exceed the power limit for hazardous operating ranges and therefore meet the Class 1 AEL limit. This means we do not require a warning label on our device.

Patent Discussion

US Pat. 4753146 – Portable Electronic Drum Set
Though this patent certainly relates to our project there are several important differences. First off, we make no claim that our drum set be portable. Secondly, the means for creating drum sticks are completely different than those alluded to in this patent. There would be no way to use IR communication in the schema they devised.
There are other patents pertaining to electronic drums, but other than the above, drumless drums seem to be relatively unique.

Program/Hardware Design

Hardware

There are numerous aspects to the hardware design including the sound output, the Wiimote interface, the drumstick assembly, and the bass pedal interface.

Sound Output

Sound output was handled by PWM outputting through pin B.3. Using a 10-pin header we connected port B to the white board, and filtered the signal using low pass RC circuit. We then connected the filtered sound to the TRS adapter to send to our speakers.

Wiimote Interface

The Wiimote operates wirelessly via the 2.4 GHz Bluetooth communications protocol. Using a Bluetooth adapter on a laptop and the WiimoteLib library provided by Brian Peek we can interface with the Wiimote through the computer. Using serial communication over UART we send the raw data from the Wiimote, specifically the IR LED coordinates to the Mega32. The Mega32 can then analyze the position of the IR LED tipped drum sticks and determine whether an instrument has been struck or not.

Drumsticks

To simulate playing a real drum kit we decided to mount our IR LEDs on the tips of real drum sticks. The assemble was simple: the IR LED was soldered to a 330 ohm resistor and then soldered to a battery clip attached to a standard 9V battery. The whole assembly was then tapped to the drumstick as can be seen in the picture above. The battery clip allowed us to disconnect the LED when not in use to prevent draining the battery power. Finally the addition of the electronics did not change the feel of the sticks much and so the system provides for a relatively natural playing feel.

Air Drums Using Atmega32

Bass Pedal

The bass pedal was taken from a Rock Band drum kit. It is essentially a push button operating using a reed switch and a strong magnet. A reed switch is a switch that is operated by magnetic fields. Inside the reed switch are two magnetic and conducting reeds which are separated. When a magnetic field is applied by pressing down on the pedal, the reeds are pulled together and complete the circuit. When the magnetic field is removed, the reeds pull apart. The bass pedal was used to emulate a push button on the STK500 board since it provides a much more authentic feel. It is connected via a mono 1/8″ TRS audio cable to a ciruit that active low as seen in the schematic in appendix B.

 Parts List:

Part
Quantity
Unit Cost
Total Cost
Drum Stick
2
$2.50
$5.00
IR LEDs
2
$0.50
$1.00
9V Battery
2
$2.00
$4.00
9V Battery Clip
2
$0.75
$1.50
STK500 Prototype Board
1
$15.00
$15.00
Atmel Mega32
1
$8.00
$8.00
White Board
1
$6.00
$6.00
2 Pin Flat Jumper Cable
1
$1.00
$1.00
1 Pin header
1
$0.05
$0.05
10 Pin header
1
$0.50
$0.50
USB to Serial Cable
1
Provided
$0.00
Serial Cable
1
Provided
$0.00
STK500 Power Supply
1
$5.00
$5.00
1/8″ TRS to separated pin adapter
2
Provided
$0.00
1/8″ Male to Male TRS cable
1
Prior ownership
$0.00
Powered Speakers
1
Prior ownership
$0.00
Rock Band Drum Pedal
1
Prior ownership
$0.00
USB Bluetooth module
1
Prior ownership
$0.00
Laptop
1
Prior ownership
$0.00
Wiimote
1
Borrowed from friend
$0.00
Final Project Cost:
$47.05

For more detail: Air Drums Using Atmega32


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top