Metronome Gong

What’s an orchestra without a percussion section? This little robot bangs a gong with aplomb, filling the air with an irritating ring.

The XBee Chat exercise in class was, for me, an opportunity for play. Being able to communicate directly, free of the constraints of networking via the internet, felt like discovering the magic of chatting with a friend over walkie-talkie. Omid and I goofed around like kids, sending jokes and ASCII images back and forth through the XBees.

The freedom of being able to communicate relatively code-free, without having to worry about packets or JSON (which I must admit are a concept I still have trouble wrapping my head around) is relevatory and I’m excited to explore.

The Metronome Receiver device was an opportunity to explore an idea I’ve had since early in the first semester. I had an idea for exploring sensor-controlled percussion instruments way back in the This + That experiment of Creation & Computation that I had to shelve at the time. I had conceived of an Arduino-powered device that struck a  singing bowl when certain criteria were met. When we were given this assignment, I was excited for the chance to try it out.

I started by considering exactly what I wanted to make: a small arm that would bang a gong. Having worked with solenoids last semester I felt comfortable with their coding and operation. I bought a cheap one and tested it out.

Here was my first pass on the code, for testing the solenoid:

int incomingByte; // variable for incoming serial data
int solenoidPin = 2; //control the solenoid
void setup() {
    Serial.begin(9600);
    pinMode(solenoidPin, OUTPUT);
    }
void loop() {
    digitalWrite(solenoidPin,HIGH);
    if (Serial.available() > 0) {
       incomingByte = Serial.read();
       if (incomingByte == 'H') {
//strike the gong then recede
           digitalWrite(solenoidPin, LOW);
           delay(100);
           digitalWrite(solenoidPin, HIGH);
            }
        }
    }
}

Animated GIF - Find & Share on GIPHY

This worked nicely, though I was alarmed at how hot the solenoid got as it was required to stay engaged at HIGH for the majority of the time the circuit was active. I checked my wiring repeatedly and found no mistakes. I looked it up and found multiple sources reporting that this was normal, as long as the heat stayed uniform and did not continually increase. I resolved to keep an eye on it and not keep the circuit engaged for extended periods.

Rather than seek out a drum or gong, I decided to use the singing bowl I own. However, I noticed that the bowl had a high-pitched and long ringing peal, which I thought might be irritating. So I rewrote the code so the solenoid only fired on the third beat:

int incomingByte; // variable for incoming serial data
int solenoidPin = 2; //control the solenoid
int beat = 0; //an integer for monitoring the beat
void setup() {
   Serial.begin(9600);
   pinMode(solenoidPin, OUTPUT);
   }

void loop() {
   digitalWrite(solenoidPin,HIGH);
   if (beat >= 4) {
     beat = 0;
     }

   if (Serial.available() > 0) {
     incomingByte = Serial.read();
     if (incomingByte == 'H') {
       beat++;
     if (beat == 3){
//strike the gong then recede
       digitalWrite(solenoidPin, LOW);
       delay(100);
       digitalWrite(solenoidPin, HIGH);
       }
     }
   }
}

ubiqgong-fritz_bb

Finally, to keep the solenoid in place, I made a little stand out of a coffee cup.

Some issues still to explore and solve:

The XBee only gets reliable reception when it is physically close to the transmitter.

Even when close, it seems to miss or drop beats occasionally.

Parts:

  • Arduino Micro
  • XBee and XBee Breakout Board
  • Barrel Jack
  • 12V 2A AC/DC Adaptor
  • TIP120 Darlington Transistor
  • 1K Ohm Resistor
  • IN4001 Diode
  • Solenoid
  • Alligator clips x2
  • Wiring

Leave a Reply