#i am COMPLETELY going overboard but i love crafting supplies
Explore tagged Tumblr posts
youjustwaitsunshine · 2 years ago
Text
bought some craft supplies from etsy for a ✨project✨
4 notes · View notes
narobnika · 8 years ago
Photo
Tumblr media
The Do-It-Yourself Drum Kit
 Aim:
The aim in this project was to construct a mock drum kit with percussion sensitive piezoelectric triggers attached to circular pads, each representing an element of a real drum kit, and to play the appropriate sounds through a PIC-controlled sound module when the drums are hit with sticks.
Circuit Behavior/ Explanation:
The circuit is centered around the DFR0299 sound module, which is a small MP3 module that can be used with a PIC sending it commands in serial mode via the TX and RX (transmitter and receiver) pins, and it can also be used with analogue triggering by programming the module. The module is essentially a PIC with an SD card slot and MP3 playing capabilities, however at very simple levels. On this project , the initial plan was to use a PIC with a code that would first analyse the signal coming to the analog terminals from piezo elements, which would send a short voltage impulse generally ranging between 0 to 1.5Vdc, varying with the intensity of the vibrations the piezos are subjected to. As a note, the codes are all included further down this report.  
 Used Hardware Elements, Devices and Programs:
DFR0299 Sound Module
Piezoelectric elements (and later relays)
Various resistors and pot combinations for variable triggering
ICM7555 Timer Chip used in a schmitt trigger
ATmega328p PIC
EasyEDA for planning of the circuit (diagrams and simulations)
5V 1A output makeshift voltage supply adapter crafted from old playstation portable charger
4 Small size relays, 3.3-5V operation on the coil side
 Choosing the Components
Playing drums is one of the most enjoyable things to do for me, so I decided that my final project should involve something I love, so that I would be able to work better and put my best effort into it. I decided to build a mock drum kit out of wood and trigger the drums with an electronic circuit that would play the sounds. For this, I first made drawings of the kit, which I wanted to build out of wood since I am quite familiar with woodworking and have the chance of working in a carpenter’s shop which belongs to a family friend. It took a lot of trial and error to find the right materials and shape for the kit, but after many, many enjoyable hours of trying and cutting and sanding and drilling, I managed to put together the kit. The circular drum pads were actually pizza plates I found in Migros, and I picked them up for their perfect size. I used a camping/yoga mat for the soft lining of the pads to reduce the noise of the sticks hitting them. Then came the electronic part of the kit, which was the real challenge.
 After many hours of reading and good amounts of research on piezoelectric theory and ways of triggering sounds with electric signals, I understood that a sound playing module of some sort was essential, unless I was to opt for simple analogous buzzers for each drum, which would have been quite unpleasant sonically. I researched the possible sound modules for this project and chose the DFR0299, which seemed the most reliable out of these small and hard to use PICs. However, there were still many difficulties and troubles with these components, but I decided to keep at it and try to do the best job possible within the scope of my abilities and circumstances, because electronic drums are an enjoyable and challenging project, and thought that this would teach me more things than a simple, proven project with mostly known instructions and parts. I was unable to find any similar project on the internet, so this further encouraged me to try this idea. I will further elaborate on the difficulties and problems I encountered and the design process.
Tumblr media
 Circuit Diagram and Explanation
The diagram (first diagram with the sound module) shows the final, as-presented version of the circuit, with the inputs and outputs of the DFR0299 shown. I adjusted the plan and wrote a code for the sound chip to work in AD button control mode, which is a resistance-dependent means of activation. This code can trigger up to 14 different sound files with a single, momentary completion of the circuit going from either one of the ADKEY1 or ADKEY2 pins to ground with a predetermined resistor on the way to ground. For example, in this setup, activating switch K7 will complete the circuit through 9k Ohms, and a snare drum sound is played by the module as a result. This way, I was able to completely omit the PIC and simplify the circuit to at least a partially functioning state, the reasons for which will be explained later. The circuit is powered by a makeshift power supply that I crafted from a PSP(playstation portable) adapter, after problems with voltage regulator IC7805’s, even though the adapter brought its own share of problems. The DAC_R and DAC_L pins of the DFR0299 are the right and left channels of the stereo output of the sound module, and I soldered a standard 3.5mm headphone jack to them and grounded the jack to avoid static etc. humming.
The VCC and GND pins of the module are, obviously, connected to the power supply. I wanted the drum kit to be versatile, so instead of adding a basic, sub- 3 Watt speaker directly to the sound module DFR0299, I opted for the 3.5mm output, which enables the kit to even be connected to a full size amp and mixer system or a PA system in a venue. For now, the speaker used is a UE Boom 2 portable speaker with its integrated digital amplification circuit, and it seems to work quite well with the programmed module, with minimal buzzing and humming.
 Design Procedure, Further Explanations, Challenges and Solutions
●      One of the earliest problems I had was with the LM7805 IC voltage regulator, which was, for some reason, unable to sustain the circuit while using 9V batteries. Trying to do so resulted either in the extreme overheating of the 7805IC and/or the battery, and quickly drained the battery. The batteries I used were not regular alkaline 9V batteries however. I instead opted to use rechargeable Ni-Mh 9V (8.4V actually) batteries I had at hand for a bass guitar pre-amp, which are much more green. This could be a possible cause. However these rechargeable batteries are a drop in replacement for the regular 9V batteries we used throughout the year. I tried multiple 7805 IC’s, but got similar results so I quickly changed plans, fearing that the sound module would get damaged. Then I figured that since this is a drum kit, it would not be a concern if it used a power supply instead, so I went looking for one. However I was unable to find a suitable one, as the available adapters either had too high a voltage, (9V+ when 5V is needed), or they were 5V but had very low amp ratings, which wouldn’t suffice for the current draw of the circuit. By luck, I found an old playstation charger with 5Vdc, 1A output and went right at it, took it apart, made the necessary changes to the fuse and soldered a connector to power the breadboard and it worked flawlessly. However, there is a weakness in any type of system, and there was some humming introduced when I switched from battery power to the adapter. The problem is probably with the AC “60 cycle” hum, which seemed to affect the speaker output because it was difficult to ground them. I tried to shield the 3.5mm jack and the connector with aluminium foil to reduce the noise and soldered another wire to the jack itself that goes to ground from the grounding pin of the jack. The shielding aluminium was also connected to ground. This application helped a lot and there was very little humming left, which can be heard only when the drum kit is idle, and the amplification of the speaker is turned up to high levels.
 ●      An improvement would be to use midi triggering for faster operating speeds since the mp3 logic of the DFR0299 module does not allow polyphony. This was a key flaw of the system, and it was almost impossible to fix without going overboard with complicated chips and interfaces which would not be meaningful for our course. We are trying to do things ourselves as much as we can because this is for learning, problem solving and creativity. However, the available components and PIC’s do not allow MIDI usage, which means that the drum kit is actually operating as an MP3 player of some kind, that plays a different 1-second long song for every zone of the drum. The current sound cuts out as soon as another pad is hit, so the drum can only be played very slowly. The circuit can only manage 2-3 hits per second due to processor speed limitations (I also tried a 16Khz external crystal oscillator, but decided to go with the internal 8Khz operation of the module because of the unreliability of the external crystal), while a drummer can hit the drums more than 30 times per second!
 ●      At first, I had actually coded to trigger the sounds of the module via a PIC that received and analysed signals from the piezos. The piezo signal would be printed to the terminal of the PIC, ranging from 0 to 250 milivolts depending on the strength of the vibration of the hits. I set 3 thresholds for the four drums on the kit. Threshold one was at 50mV, two at 120mV, and three at 220mV. These threshold levels correspond to “SOFT”, “MEDIUM” and “HARD” in the code, and thus the PIC triggers the appropriate sound of, say the snare drum, according to the force of the hit. However, it did not work out so well. There were many errors and triggering would be random, and also would pick up parasitic vibration from movement within the room that the kit is housed it etc. The codes are all at the end, and there is also video footage of this system working on my desk, although not on the kit.
 ●      As a result of the problems with the piezo system, I opted to use small relays that operate with 3.3-5v for magnetic actuation. I stripped the casing and removed the protector housing around the thin metal terminal that would normally be attracted by the energized coil. I sanded, bent and adjusted the terminal so that it would momentarily complete the circuit when the relay receives vibrations. I made four identical copies of this modified relay device, but sadly it was not successful. It was perhaps a good effort as a last measure, but the kit would have been amazing if the piezo system was working properly.
 ●      For improving the accuracy of the piezo system, as an alternative to the PIC controlled sound module setup, it would have been possible to use a 555 IC timer operating as a schmitt trigger, (explained below) triggered by the current pulses from the piezoelectric elements to trigger the sounds. This would be an analog alternative to the PIC, and would be easier to set up. This would take advantage of the possibility of extremely high switching speeds when a solid state IC is operating as a single pole single throw or SPST solid state switch (similarly to a bipolar transistor used as a switch, being either OFF or FULLY ON, as we studied in our course). The completion of the circuit could then be used to trigger the sounds instead of the current, unreliable array of relays mounted under the pads. However, this setup would not allow multiple sound levels, as it would simply turn on and off when the piezo was hit hard enough.
About Schmitt Triggers, and using  555IC (diagram from source):
Tumblr media
●      Short Explanation About Schmitt Triggers, and using 555IC
 The most important behaviour of any Schmitt Trigger is the hysteresis. In this case it’s 1/3 and 2/3 of the voltage supply going to pin 2 and 6, defined by the built in resistor voltage divider on the 555 that lies between these two pins. The built in comparators C1 and C2 compare the input voltage to the references provided by the voltage divider and use the comparison to trip the built in flip flop, which drives the output driver, another nice feature of the 555.
 The aforementioned “Comparators” are basically devices which measure the two input voltages and choose whether one is higher than the other. In a Schmitt Trigger, these comparators work by comparing the incoming voltage to two predetermined voltage points and give an output accordingly. This enables the Schmitt trigger to provide a Square or Rectangular wave output no matter what shape the input has. Schmitt triggers are useful for:
 ●      To convert slow edges (like in a triangular wave) into fast edges (like a square wave)
 ●      Convert sine wave to square wave
 The main, defining behaviour of the Schmitt trigger is Hysteresis. The Schmitt trigger’s output will be high if the incoming voltage is above the threshold value, and the trigger’s output will be low if the incoming voltage is below the threshold. However, the state, or the value of the output is retained when the incoming voltage is in the middle of the two threshold values. This presence of two threshold points creates the Hysteresis and lets the schmitt trigger function like a bistable multivibrator flip-flop. According to the thresholds which are ⅓ and ⅔ of input voltage, the system will set or reset the value of the output, determining its state, which will either be high or low.
 What have I learned?
 I have learned so many things about both theoretical and practical aspects of a whole design process. The theory included piezoelectricity, relay action, schmitt triggering, power requirements of circuits (voltage and current regulation). There was also coding involved so I had to learn C on top of some Java knowledge I had, since most of these small devices run on C. I learned about product design, since I had to build the wooden drum kit from scratch. I learned many factors in audio engineering that are important when setting up any kind of audio system, such as interference, noise, shielding, 60 cycle hum and so on. This work helped me better understand some of my weaknesses with organization, which I was often able to luckily solve by improvising from my parts bins at home, or from the messy cupboards of a friendly, local electrician to replace parts or add elements that I had foolishly forgotten to acquire beforehand, had damaged etc. I wish I had managed time better so that it would have been possible to get the more complex piezo and PIC system working, but the fundamental latency issue of the module remains. I cannot express how much I enjoyed working and learning about these topics because seeing how every field connects with one another was fascinating.
  ***As a post-scriptum side note, using an actual aftermarket electric drum "brain", which could directly process the signals from the piezoeletric elements with connections via 1/4 inch jacks, would be much easier to setup but would not be meaningful for learning at all. I’m happy that the more bare-bones path had many challenges. (*I might do this in the summer-get a drum brain and actually play the kit!)
    Code for the ATmega328p PIC:
Be wary that this was my planned setup, but it unfortunately did not function properly once installed on the kit. See video.
This is the code, which accomplished the triggering of sounds by sensing electric signals created by the piezoelectric elements responding to vibrations. The three threshold correspond to 50mV, 120mV and 220mV signals from the Piezo, which are the levels that I found through experimentation; by hitting the drums and observing the voltage values printed to the terminal, and connecting the PIC to my laptop and watching the values live from the console of the PIC’s programming kit.
******************************BEGINNING OF CODE*********************** 
#define DRUM1 0      
#define THRESHOLD1 50
#define THRESHOLD2 120
#define THRESHOLD3 220
 byte val = 0;    
 void setup()
{
 Serial.begin(9600);
}
 void loop()
{
 val = analogRead(DRUM1);
 Serial.println(val, DEC); \
   val = analogRead(DRUM1);
   if(val > THRESHOLD1) { Serial.println("SOFT"); }
 if(val > THRESHOLD2) { Serial.println("MEDIUM"); }
 if(val > THRESHOLD3) { Serial.println("HARD"); }
 else if(val > THRESHOLD1) { Serial.println("NOTREGISTERED"); }
}
 **************************END OF CODE***********************************
 Various Pictures of the Building Process  
Making the pads.                                          
Tumblr media
In the carpenter’s workshop.
Tumblr media
Building the kit piece by piece, measurements, mistakes and practical solutions.
Tumblr media
Finished kit, brought it home.
Tumblr media
 Rigging up the relays. (failed)
Tumblr media
 Working on the circuitry and soldering
Tumblr media
Work In Progress…
Tumblr media
Finished kit.
Tumblr media
 Works Cited:
"DFPlayer Mini SKU:DFR0299." DFPlayer Mini SKU:DFR0299 - DFRobot Electronic Product Wiki and Tutorial: Arduino and Robot Wiki-DFRobot.com. N.p., n.d. Web. 30 May 2017.
 Administrator, and Arvind Says. "555 Timer as Schmitt Trigger." Electronics Hub. N.p., 19 June 2015. Web. 30 May 2017.
 Woodford, Chris. "Piezoelectricity - How Does It Work? | What Is It Used For?" Explain That Stuff. N.p., 20 July 2016. Web. 30 May 2017.
 Tarun Agarwal. "A Brief Introduction to Piezoelectric Sensor Switch And Its Working Procedure." EdgeFX. N.p., n.d. Web. 30 May 2017.
 Jacobi, Jon L. "How to Get Rid of Hum and Eliminate Other Noises from Your Audio and Video Systems." TechHive. TechHive, 16 May 2016. Web. 08 June 2017.
 "Electrical Relay." Electronics Tutorials. N.p., n.d. Web. 30 May 2017.
0 notes