The Code

To write the code, we first required the code which is needed to use the mpr121 breakout board. We got the code from this website:

http://bildr.org/2011/05/mpr121_arduino/

We then changed the code around so that it can incorporate our use of LEDs, the button and the shocker that we made. To see the changes to the code, visit this gitlab link:

The changes we made were done in the mpr121.ino file given to us through the bildr website. The red rows were our deletions and the green rows were what we added to the code to make it work how we wanted.

http://gitlab.doc.gold.ac.uk/uyunu001/Arduino-Shock-Vest/commit/f7cb1d93074f36a1c4eaacf914140ac34df6c2cc

 

Advertisements

The Finished Physical Design

When the vest is finished you should have the following outputs:

  • 8 LEDs
  • 2 Shock wires (Need both to be connected to one hand to be shocked)

The inputs on the vest are:

  • The targets (4 in our case)
  • The reset button

You can connect a power-bank to your Arduino Uno to power the circuit.

The Schematic Design

This is the schematic design to follow when trying to connect the Arduino Uno, the MPR121 breakout board and the modified shock gum toy.

schematic-design

There is also a push button included which is used to reset the LEDs when you have run out of lives. Pins 3 – 10 are used connected to the cathode of the LED and the anode is connected to a 220 Ohm resistor which is then connected to Ground. Pin 11 is used for the push button which is used as an INPUT so the function digitalRead will be used with it.

Also, as you can see the shocker has 3 ouput wires, two of the wires have to be connected to each other so that essentially you have two wires which will generate the shock. In the image below, the blue wire (OUTPUT A0, A1, A2) is connected to the pink wire. The brown wire is the standalone output wire. If both sets of output wires are touching each other, the shock will not work. Finally, the green wire is the Ground wire.

img-20161218-wa00011

Shock Gum – Rewired

Changes to the Shocker

As we require a high current for a person to get shocked, we have to use three arduino pins as output pins as 1 or 2 pins do not provide enough current for a person to feel a shock. This is why we used the pins A0, A1 and A2 on the Arduino Uno as output pins for the shocker, so when the target gets hit, we use digitalWrite HIGH on all three of these pins.

Making and Linking Targets

To make the target we did these following procedures:

  1. Draw out the targets
  2. Wire up the targets connecting the target to the MPR121 board
  3. Tape over the visible wire using copper tape
  4. Place cardboard over the copper tape
  5. Tape over the cardboard with copper tape again

This allows the targets to be quite rigid so that the targets do not accept a crease in the vest as a hit.