Drumming Teaching and feedback device Using Atmega1284
For our ECE 4760 final project, we designed and built a drum trainer that can be attached to most Japanese drum surface and will detect and wirelessly transmit different drum hit types to other players’ drum trainers. The trainer is able to determine whether the user makes a “Loud Beat”, a “Soft Beat”, or a “Rim Shot”, and provides feedback in the form of LED’s to tell the user what type of beat they just made. This setup allows the use of several different applications; three such applications we came up with are:
1) Follow the Leader – One drum player is designated as the “leader”, and as the “leader” plays, the timing of each drum hit get transmitted to all of the “followers” playing along with him. The “followers” are then notified through LED’s whether they are performing the correct hit type, and whether they are playing at the right tempo.
2) Metronome – A player can set any tempo that they would like by hitting the drum a few times at a certain speed. The trainer averages the times between hits and then provides the player with a blinking LED with a constant tempo the player can then perform at.
3) Repeat After Me – For this mode, a player first records a pattern or beat that he would like to repeat. Once they are satisfied with the pattern they created they can begin to repeat the pattern, and the trainer will tell him whether they are playing the same type of notes at the same time.
In addition, we definitely foresee other software applications that can be developed to work with our Taiko Drum Trainer. It was important to us to develop a final project that could be greatly expanded and made more useful over time if necessary.
High Level Design
This idea was inspired by team member Gabriel Soares who is part of Cornell’s Taiko Drum Club (Yamatai). Through his practicing and performing with others, he recognized the opportunity to design a drum trainer that can help students better learn to perform their drumming when following the leader of the group and practicing with others. This device would provide them feedback of if they were performing the correct types of hits and whether they were staying at the correct tempo with everyone else.
The following video is the promotional trailer for Yamatai’s annual concert that the group performs every Spring semester. For those who are not familiar with the Taiko drumming, this video does a good job at demonstrating the technique and style that the performers use. Pay close attention to the different beat types, beat intensities, and the important role that timing plays in the drummers’ performance.
Overall User Interface
When designing the user interface, we needed to be able to make it easy for the user to switch between which mode/application they were using (as well as knowing which mode they were using), and we needed to be able to have them easily see whether they were beating too slowly or too quickly, and an indicator of what type of hit the trainer was detecting.
To solve these problems, we included several user friendly features. We included a simple push button to switch between applications, and included a seven segment display to display a single digit to clearly show the current mode to the user. The seven segment display key is as follows:
- 0 – Calibrate Mode
- 1 – Follow the Leader Mode
- 2 – Repeat After Me Mode
- 3 – Metronome Mode
- 4 – Free Play Mode
We also have a total of 8 different colored LEDs on the board that the user can see, grouped into a set of 5 and a set of 3. Depending on the mode the trainer is in, these LEDs serve special purposes. For most modes, the set of 5 LEDs tells the user the speed at which they are playing. If the middle LED is being lit, you are playing at the same exact speed as the other player, if the right LEDs are being lit (colored yellow) then you are playing too quickly, and if the left two LEDs are being lit (colored green), you are playing too slowly. The set of 3 LEDs usually tell you the type of hit that is being registered as you are playing the drum, with the exception of Metronome mode. The yellow LED indicates a Rim Shot, the red LED indicates a Loud Beat, and the green LED indicates a Soft Beat.
High Level Block Diagram
From a high level view of our project, our goal was to correctly determine the types of beats on each drum and transmit this data wirelessly over IR for use in various applications. We would first detect the beats on each drum using the piezo sensors. We put two piezos on each drum to better detect the difference between loud beats and rim shots. Once the beat types were detected on each drum that was active, we would use IR transceivers and receivers to send this data across the room to the other drums and be evaluated in very short, unnoticeable period of time. This project allowed drummers to communicate and play with one another, giving real time feedback on the drummer’s timing and performance.
The principal component used in our project is the Atmel ATmega1284P microcontroller. We have become very familiar and comfortable with the ATmega1284P since this is the specific microcontroller that we have been using in labs throughout the semester. This microcontroller has countless features and functions; however, the following list outlines the more important and pertinent functions that we found useful for our project.
- 128KB In-System Programming (ISP) flash memory
- 32 input/output lines
- 32 working registers
- 16KB Static Random-Access Memory (SRAM)
- 8-channel 10-bit Analog-to-Digital converter
- 6 power saving modes selected via software
- Real-time counter, PWM, and two USARTS
Since everything begins with the piezoelectric sensor, it can be argued that this is the most important subsystem of our whole project. With this in mind, we spent the majority of the first couple weeks just focusing on the sensor. From the beginning, we knew that we would be using a piezoelectric transducer to detect a beat. This was because we were already familiar with piezoelectric sensors from previous classes and we were able to obtain them for free from the lab. A piezoelectric transducer is a device that takes advantage of the piezoelectric effect in order to measure a force or strain by converting this mechanical energy into an electrical charge. The piezoelectric effect is the phenomenon that occurs when a mechanical deformation is applied to a piezoelectric crystal and a potential difference develops due to electric dipole and surface charge density generation.
Luckily, we were able to find about twenty piezoelectric transducers in the laboratory cabinet. These piezo transducers were simply speakers that must have been used in previous labs. Unfortunately, we were not able to find much information on these piezos (SHI-1130 by Shigma) because they appear to be discontinued. However, this did not prove to be a problem because these sensors were very simple to use – they simply contain one ground lead and one signal lead. Our first test involved just holding the sensor against the drum head and connecting the leads to the oscilloscope. This test revealed that the piezo sensor produced a very large negative voltage (about -50V) and a fairly large positive voltage (+12V) followed by a sinusoidal wave that dampened over time. We would not be able to input this very large negative signal into the microcontroller for fear of damaging the input. Furthermore, if every signal gets clipped by the microcontroller’s max input voltage, then we would be unable to decipher loud hits from soft hits.
Therefore, we searched the internet for a solution to this problem. We were able to find an extremely helpful webpage titled “Piezo transducer signal conditioning” at http://leucos.lstilde.org/wp/2009/06/piezo-transducer-signal-conditioning/. The author of this article provided helpful tips to accomplish everything we were trying to achieve: produce a positive voltage signal, restrict the bounds from 0 to Vcc, and produce a clean/predictable signal. By creating a half-wave rectifier from two Schottky diodes with forward voltage drops of 0.3V, we were able to make the whole signal positive. So we don’t fry the analog-to-digital converter of the microcontroller, we included a Zener diode to cap the maximum voltage of the signal. We used a 5.6V Zener diode (found in the lab cabinet) in order to make sure that the piezo’s signal voltage will never exceed the rating of the Zener diode. Finally, in order to filter the signal, we used a simple RC circuit. For our drumming application, we would like our signal to fade out in about 100 milliseconds. Since we know that the voltage will drop to 90% of the initial voltage according to the following equation, we can solve for the desired resistor and capacitor values.
Therefore, choosing R = 1M ohms, we arrive at a capacitor value of 47 nanofarads. This decision to make the signal fade out within 100 milliseconds was a difficult decision that involved a major trade-off. The circuit did not filter the signal as cleanly for small values of R and C, however we did not want to use large component values because this means the signal would not die down as quickly. After testing with multiple R and C values, we decided that a decay of 100 milliseconds produced a cleanly filtered signal, yet was still fast enough for our application. Using these resistor/capacitor values and the Schottky and Zener diodes from lab, we constructed the following circuit based on the topology of the aforementioned website article.
After testing this signal conditioning filter circuit, it became clear that we would need to build another filter if we wanted to distinguish the different types of hits. One of our original goals was to distinguish between a loud hit, a soft hit, and a rim hit. With just the one filter, we were not able to differentiate between a soft hit and a loud hit. Therefore, we decided to build another filter based on the same topology and only changed the values of the resistor and capacitor. We made this a very strong filter by producing a large decay of approximately 10 seconds. From this desired decay time, we choose a resistor value of 10M ohms and a capacitor value of 470 nanofarads. With this second filter, we also had to introduce a second piezoelectric sensor that we placed right next to the original sensor. One of the sensor is connected to the weak filter and the other sensor is connected to the strong filter. The idea is for the weak filter to distinguish between rim hits and loud hits based on the time the signal takes to decay since a rim shot will decay much more rapidly. The strong filter is used to distinguish between a soft hit and a hard hit by the voltage and does not take into account the time decay aspect of the signal. The software section (filter sampling) goes into more detail as to how our code samples and uses the data from the two filters. The following circuit is the strong filter that we used for our piezoelectric sensor.
|Part||Source||Unit Price||Quantity||Total Price|
|1 MOhm Resistor||DigiKey||$0.17||1||$0.17|
|10 MOhm Resistor||DigiKey||$0.09||1||$0.09|
|100 kOhm Resistor||DigiKey||$0.07||2||$0.14|
|1 kOhm Resistor||DigiKey||$0.07||1||$0.07|
|4.3 kOhm Resistor||DigiKey||$0.07||1||$0.07|
|1.5 kOhm Resistors||DigiKey||$0.07||2||$0.07|
|330 Ohm Resistors||DigiKey||$0.01||22||$0.22|
|100 Ohm Resistor||DigiKey||$0.15||1||$0.15|
|68 Ohm Resistor||DigiKey||$0.15||1||$0.15|
|47 nanoF Capacitor||DigiKey||$0.03||1||$0.03|
|470 nanoF Capacitor||DigiKey||$0.05||1||$0.05|
|100 microF Capacitor||Digikey||$0.06||1||$0.06|
|Seven Segment Display||Lab||free||1||$0.00|
|Seven Segment Display Driver||DigiKey||$0.56||1||$0.56|
|LM358 Op Amp chip||Lab||free||1||$0.00|
|IR (TSOP34156) Receiver||Bruce Land||free||1||$0.00|
|NPN (2N3904) Transistors||Lab||free||2||$0.00|
|Switch – DIP4||DigiKey||$0.73||1||$0.73|
|Piezzo Speaker Sensors||Lab||free||3||$0.00|
|Piezzo rubber||Home Depot||$0.75||1||$2.25|
|ATmega1284p Microcontroller||Atmel||Free Sample||1||$0.00|
|Target Board Pins||Lab||$0.05||36||$1.80|
|Total Price||(per board)||$25.39|
For more detail: Drumming Teaching and feedback device Using Atmega1284
Leave a Comment
You must be logged in to post a comment.