Introduction: The Buzzer Glove

This is a super simple project using parts from the Lilypad Arduino Protosnap Development Board. Essentially, you touch different parts of the glove and the buzzer will make different noises. This project is great for beginners as the programming is straight-forward and the construction of the glove itself is pretty easy with a little patience.


Step 1: What You Need

A glove - I went to a party store and purchased a pair of costume gloves
Lilypad Arduino Protosnap Development Board (you won't need every part though!)
Conductive thread
Sewing needle(s) 

Step 2: Programming

So, my code was taken primarily from another instructable. I had to change some of the loops and the pins were different; this user also wasn't using a Lilypad Arduino Development Board but rather the original Lilypad Arduino. Here is the code:

int speakerPin = A5;
int switchPin11 = 11;
int switchPin10 = 10;
int switchPin9 = 9;
int switchPinA2 = A2;
int switchPin6 = 6;
int switchPinA3 = A3;
int switchPin5 = 5;
int switchPinA4 = A4;
int ledPin = A4;
int switchPins[7] = {11,10,9,A2,6,A3,5};

void setup() {
  pinMode(ledPin, OUTPUT);
  pinMode(speakerPin, OUTPUT);
  pinMode(switchPin5, INPUT);
  pinMode(switchPinA4, INPUT);
  pinMode(switchPin11, INPUT);
  pinMode(switchPin10, INPUT);
  pinMode(switchPin9, INPUT);
  pinMode(switchPinA2, INPUT);
  pinMode(switchPin6, INPUT);
  pinMode(switchPinA3, INPUT);
 
  digitalWrite(11, HIGH);
  digitalWrite(10, HIGH);
  digitalWrite(9, HIGH);
  digitalWrite(A2, HIGH);
  digitalWrite(6, HIGH);
  digitalWrite(A3, HIGH);
  digitalWrite(5, HIGH);
  digitalWrite(A4, HIGH);
}

void loop() {
  digitalWrite(ledPin, HIGH);
  while (1) {
    if (digitalRead(switchPin11) == LOW) {
      digitalWrite(ledPin, LOW);
      makeNoise(11, 2093);
        digitalWrite(ledPin, HIGH);
        break;
    }
   
    if (digitalRead(switchPin10) == LOW) {
      makeNoise(10, 2349);
      break;
    }
   
    if (digitalRead(switchPin9) == LOW) {
      makeNoise(9, 2637);
      break;
    }
   
    if (digitalRead(switchPinA2) == LOW) {
      makeNoise(A2, 2793);
      break;
    }
   
    if (digitalRead(switchPin6) == LOW) {
      makeNoise(6, 3136);
      break;
    }
   
    if (digitalRead(switchPinA3) == LOW) {
      makeNoise(A3, 3520);
      break;
    }
  
    if (digitalRead(switchPin5) == LOW) {
      makeNoise(5, 3951);
      break;
    }
   
    if (digitalRead(switchPinA4) == LOW) {
      makeNoise(A4, 4186);
      break;
    }
  }
}

void makeNoise(int switchPin, int frequencyInHertz) {
  long delayAmount = (long) (1000000/frequencyInHertz);
  boolean y = true;
  while (y) {
    digitalWrite(speakerPin, HIGH);
    delayMicroseconds(delayAmount);
    digitalWrite(speakerPin, LOW);
    delayMicroseconds(delayAmount);
    y = checkforchange(switchPin);
  }
  int switchValues[7];
    int i = 0;
    while (i < 7) {
      switchValues[i] = digitalRead(switchPins[i]);
      i++;
    }
}

boolean checkforchange (int currentSensor) {
  if (digitalRead(currentSensor) == HIGH) {
    return false;
  }
  return true;
}

(end of code)

Here is the source for the code that I used: https://www.instructables.com/id/Musical-Glove/

Step 3: Sewing

At this point, you need to sew the Lilypad Arduino into the glove. I warn you, I do not ever sew.... but I was still able to do this!

You need to make sure the thread is wrapped around each pin you use so there isn't any barrier between the thread and the pin. 

The first part that I sewed in was the ground (the little negative sign). My Lilypad Arduino is positioned so the ground is pointing toward the thumb. You want to sew toward the side of the glove and up the thumb. Continue the stitch over the top of the thumb and stitch an area of exposed thread on the tip. The best way to do this would probably be a whip stitch (I realize after I'm done making this). You just want to make sure there are plenty of contact points on the tip of the thumb. 

Now the real fun starts! Again, you want to make sure that the thread is wrapped around each pin that you sew in so there's a solid connection. The first pin I sewed in was pin 5. I sewed up the right side of the pointer finger. At this point, repeat what you did on the tip of the thumb and create a patch of thread on the side of the pointer finger with plenty of thread exposed so you have a lot of contact points.

Perhaps the biggest difference between the Lilypad Arduino Protosnap and the original Lilypad Arduino is the size. You *do not* want any of these stitch lines to cross, so the easiest way to do this with the Protosnap is to alternate between sides of the unit for the buttons (thread patches) on each finger. In this case, this means that pin A4 is actually sewn under the unit (inside the glove); it then comes out on the other side of the unit (the side closest to the fingers), and is sewn to the left of the first stitch line up the pointer finger. Again, create a patch at the tip so there are lots of contact points, but try to make sure there's plenty of distance between the buttons.  

You want to continue to alternate between sides of the unit for the middle finger and the ring finger. 

Side of Middle - 6
Top of Middle - A3
Side of Ring - 9
Top of Ring - A2

For the pinky, use pin 10 and sew up the the right side of the pinky, like you did with the other fingers. Sew pin 11 around the left side of the glove. This works particularly well with the Protosnap Lilypad Arduino as this pin points directly to the left side in this position, so the unit is evenly sewed into the glove. 

Once you have the Lilypad Arduino sewed in, you can sew in the buzzer. This is the same buzzer that came with the Lilypad Arduino in the Protosnap board (how convenient is that?!). If you noticed, there is one more I/O pin you can use on the Lilypad Arduino, and that's pin A5. Wrap the thread around this pin and stitch downward slightly. The buzzer has a positive (+) side and a negative (-) side. Stitch pin A5 to the positive pin on the buzzer. You can then wrap a different thread around the negative side of the buzzer and sew upward so you hit the ground thread. Again, make sure plenty of contact is made with these two threads.   

Step 4: Clean Up

While some of you may be sewing masters, the rest of us need to clean up some of the stitch paths. In my case, whenever I'd tie off one of the stitch paths, I needed lots of extra thread to tie off. What you see here is what the glove looked like before I went through with a pair of scissors. 

You may be saying to yourself, "This seems like merely a matter of aesthetics; why is this necessary?"

When you do upload your code to the Lilypad Arduino, you may notice it works only sometimes or not at all. This is what happened to me, and it was because all the extra threads would come in contact with each other. 

Don't let this happen to you! Even if you do need extra thread like myself, you can always cut it off later. 

Step 5: You're Almost Done!

Once you're done making your glove pretty (and functional), you can upload your code with the Lilypad FTDI Basic.

In my case, I also had a 110mAh LiPo Battery, so you can charge it and use the glove without having to be connected. 

Make sure the unit is switched on, and then you're good to go!