Instructables
If you are anything like me, you probably like playing the computer game minesweeper. When playing, I've noticed that since there's no penalty for losing, I wouldn't try as hard as if there was. It's as if I was too carefree- until now. I modified an open-source version of the game in processing, so when the player clicks a mine, they are given a mild (but still quite painful) shock. It's like high-stakes minesweeper.  To do this, I found  cheap stick of "shocking gum" (http://amzn.to/MOgtAJ), took it apart, made it so it could be controlled by an Arduino, modified an existing open-source minesweeper processing script, and next thing I knew it, I was being shocked after losing a game of minesweeper.

Using the device is quite simple:
Plug it into your computer.
Hold onto the shocker (a small, plastic chip) with your thumb and index finger.
Run the game.
If a mine is clicked on, you will be given a mild shock lasting roughly 160 milliseconds.

No, the shock is not dangerous. It is most definitely not pleasant, and does make the game frightening, but the shocker was taken from a toy and is not truly dangerous. With that being said, though, the package warns to not use it if you're under the age of 14, or if you have a pacemaker of anything else of that sort. I am not responsible for anything bad that comes of you using this.

Oh, yes, I did mention that I did not write the entire, or most of, or really even a 1/16 of the minesweeper source code. All I did was add the shocking feature, and changed around some difficulty stuff. The credit goes to Luke Noonan, who published it under a CC-BY-NC-SA license. The original source code and stuff can be found here: http://www.acsu.buffalo.edu/~johnnoon/programming
/sweeper_2.pdf


Don't know what minesweeper is? Check out the Wikipedia page here: http://en.wikipedia.org/wiki/Minesweeper_%28video_game%29
 
Remove these adsRemove these ads by Signing Up

Step 1: Supplies

Here's what you need to make it:
1 Arduino
1 Stick of shocking gum (http://amzn.to/MOgtAJ)
1 5v Relay
1 IR receiver diode
1 NPN transistor
1 10k resistor
1 diode

Step 2: Obtain Shocking Mechanism

You have to begin by stealing the shocker from the gum pack. Here's how to do that:
1. Cut off back (see picture 2)
2. Open up (see picture 3)
3. Unhook spring (see picture 4)
4. Unscrew negative lead (see picture 5)
5. Cut out battery socket (see pictures 5 and 1)

Now everything come out of the pack quite nicely.

Step 3: How the shocking works

Before doing anything, I needed to find out how to induce the shock. After playing around with it for a little bit, I found that when the negative lead is connected one of the sides of the shock gum (see picture for details) it shocks. This is to be expected because that will ground the circuit, thus making it complete, thus allowing current to flow through the shocking part.

From here I decided the the best thing to do would be to use a relay to connect them.

Step 5: Set up relay

This part is tricky. A relay switch is simply a switch that in not controlled by pressing a button, or sliding switch, but is controlled by current. If it has current running through it, it will throw a switch. I'm no electrical engineer, so I can't explain this as well as some people, but wiring a relay directly to a micro controller will drawn infinite current, and will fry your micro controller. There are many ways to stop this from happening, each person has there own strategy, but I would use the one found here: 
http://blog.makezine.com/2009/02/02/connecting-a-relay-to-arduino/

The relay should be controlled with pin 2.

Step 6: Attach Shocker to Relay

Picture of Attach Shocker to Relay
This is fairly easy. Hook up one of the wires to the common pin of the relay, and the other to the normally open pin of the relay. It doesn't matter which wire is which.

Step 7: Arduino Code

Picture of Arduino Code
Here's the code for the Arduino. It's quite simple really; when it receives the letter 'X' from the serial port, it throws the relay, inducing a shock. Here it is: 

void setup()
{
  Serial.begin(9600);
  pinMode(2, OUTPUT);
}

void loop()
{
  if (Serial.available())
  {
    if (Serial.read() == 'X')
    {
      digitalWrite(2, HIGH); //Shocks
      delay(150);
      digitalWrite(2, LOW); //Stops shocking
    }
  } 
}

Step 8: Processing Code

Picture of Processing Code
As I said earlier, most of this is not my work. It was taken from Luke Noonan and is available here: www.acsu.buffalo.edu/~johnnoon/programming/sweeper_2.pdf. To respect is CC-BY-NC-SA license, I'm going to credit him (done) and release this instructable under the same license he did.
The code is so long that I cannot paste it here, you have to download it below. I modified it so when a mine is clicked, it write 'X' to the serial port, which is received by the Arduino. Have fun.

Step 9: Sweep Some Mines

You're now ready to play! Simply plug the Arduino into you're computer, upload the code, run the processing script, and play! The game is a good recreation of original minesweeper, but does not have all the same features. Gameplay is essentially the same, so if you're good at minesweeper, you'll be good at this. You can time yourself using a stopwatch, although the shocking feature helps to improve accuracy, not speed.

Again use this at your own risk, but don't worry too much about getting shocked, it's less painful than you'd think (but still unpleasant).

Any questions, comment, or angry rants can go in the comments section, I'll get back to you pretty quickly. Have fun and happy sweeping!
Raphango10 days ago

Great fun for kids! =D

Congratulations!!

hsturley1 year ago
Would it be possible to use this with other games, like for fps' to shock you when you get shot or die?
alecnotalex (author)  hsturley1 year ago
Yes, that would be possible. It would be a little more difficult, though.