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.
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);

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

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)

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:

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.

Relay Module

Here is my relay module with 8 possible connections. From what I hear, Arduino can only power up to 4 of them at a time. Can anyone confirm?

Monday, May 16, 2016

Crispy Actuator

Okay, so I learned that car door lock actuators hate to have constant power applied to them for too long (accidentally)! Ahhh.....the sweet smell of burning plastic.... Anyone bring marshmallows? (sigh)

Using a relay module to control the actuators. What I believed was setting the pin to LOW actually read as HIGH on the relay (on the N.O. side). Hmmm..  More actuators.

Sketching out the idea

My very rough sketch for this project.

Arduino-Controlled Drum

Yet another project that I want to bring to life. An Arduino-controlled drum! I have been inspired by various online posts and wanted to give it a try.

A colleague loaned me an old tom-drum. I plan to outfit this with drumsticks pivoted with door lock actuators (the ones they use for cars). A slightly higher-current DC power supply will be necessary being these little guys are fairly power hungry (something like 3.5A each).

I will program the Arduino with various drum beats which will be user-selectable via a potentiometer.

How about some good old analog user interaction added in? Nearby, I will place found items such as pots/pans to be used as "instruments" with a separate set of drumsticks for the viewer to jam along with the electronic drum.

Okay, this is my initial plan. Let's see how it pans out! (did I just say that?)