Friday, May 20, 2016

Drum on Public Display




A fun uniting of digital (Arduino) and analog (human) output. Kitchen pots were placed upside-down to the right of the drum. An extra pair of drumsticks were marked as "Human Input "A" and "Human Input "B". A user-controlled potentiometer supplied analog voltage readings to the Arduino, which were then judged by IF statements in the code. The resulting data determined which of three drum rhythms to play (with a 4th IF statement for "off"). Each drum rhythm was just a series of 1's and 0's in an array. After the strikes, I would recommend a delay of about 20 miliseconds. Also, play with a delay at the end of the rhythm loop (depending on desired tempo.)


// A little example code for one rhythm
// "val" is the pot reading. My code has this value remapped from 0-4000.

val = analogRead(pot);                        // read the pot to determine current value
val = map(val, 0, 1023, 0, 4000);    // you do not have to remap like I did,
                                                             // but if not, adjust code accordingly

//Note: when val<500, I have it sit in a WHILE statement until the value breaches
//          that threshold. This is a static "off" position.
                                                         
//////////////////////////////
//////////////////////////////
/// POT IS SET FOR BEAT 1
//////////////////////////////
//////////////////////////////
if (val>500 && val<=2400){               // potentiometer reading in this range???
 
  tempo=120;    // this is just a delay value, not tempo in the traditional sense
 
for (int i=0; i < 64; i++){                     // 64 values in my rhythm array
  if (drum1[i]==1){                              // drum1 (stick 1) array value == 1, hit the stick
    digitalWrite(drum1Pin, LOW);       // NOTE: LOW for my setup. Yours may be different.
                  }
  if (drum2[i]==1){                              // drum2 (stick 2) array value == 1, hit the stick
    digitalWrite(drum2Pin, LOW);
  }

    delay(20);
    digitalWrite(drum1Pin, HIGH);      // reset pins for next hit
    digitalWrite(drum2Pin, HIGH);
    delay(tempo); 

val = analogRead(pot);                        // after any strikes, read pot again for next action
val = map(val, 167, 1023, 0, 4000);
                                                         

  if (val<=500 || val>2400){                // IF POT OUT OF RANGE,  BREAK LOOP
                                                            // (resume main loop)
    break;
                          }
  }
}

Tuesday, May 17, 2016

Testing the Drum

After a little Arduino coding, I have both drumsticks drumming at the same time (success)! This is after:

- Burned up an actuator
- Sent 2 more actuators to electronic heaven

Ultimately, I will add new Arduino code which alters the beat and which drum stick hits. Other than "beautifying" it, this project is complete! I'll just add a few kitchen pans and extra drumsticks which an observer can walk up to and start jamming with the electronic drummer! Analog meet Digital! Oh, I forgot to mention the use of a potentiometer to change to different drum beats. When I have time, I'll get that coded. This bare-bones rhythm is just for testing that both sticks work. I'll be coding some better ones.





Power Supply

I found a Dell D220P 12V 18A power supply second hand for $5.00! In order to "wake" this thing up from hibernation mode, you need to wire it differently. Really not difficult. Just gathering wires and connecting them together. Here is a link to more info to help with the wiring:

http://helifreak.com/showthread.php?t=188279

Attaching to Drum

The whole thing gets attached to the drum by use of a 3/4" steel strap (commonly used for hanging pipes.)


Connecting the Drumsticks

I drilled 1/4" holes through the drumsticks. One accepts a bolt while the other gets zip-tied to the actuator (this one needs to be tightened further).


Motors are in the assembly

Motor placed in the assembly. 5" bolts were used to secure the pair of motor holders.


Wood for motor housing

Using wood of approximately 1/4" thickness.