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:
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.
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 complete vest
The circuit after following the schematic design
The underside of the circuit
This is the schematic design to follow when trying to connect the Arduino Uno, the MPR121 breakout board and the modified shock gum toy.
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.
Shock Gum – Rewired
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.
To make the target we did these following procedures:
- Draw out the targets
- Wire up the targets connecting the target to the MPR121 board
- Tape over the visible wire using copper tape
- Place cardboard over the copper tape
- 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.
The Cardboard with the second layer of copper tape
The first Target copper layer
The wires from the MPR to the Target
The MPR board
The target with the cardboard on it
The shocker was one of the hardest outputs to get running. At the beginning we decided to follow an instructables web link which showed instructions on how to make the ‘worlds smallest shocker’.
When buying a disposable camera, after opening it up, we found that our camera contained a 6 pin transformer when we required a 5 pin transformer, this left us stunted on what to do next. We then decided to find out other items that can give a shock.
This led us to buying a Shock Gum toy, we opened it up, rewired it so that instead of connecting to a battery, we can connect to it to our arduino kit, we then got rid of the pull function of the toy to make it work on touch.
Shock Gum – Rewired
- 2 x Arduino Uno/ Nano
- 2 x MPR121 Capacitive Touch Sensor Breakout
- 2 x Disposable Cameras — Used but not what we wanted
- 2 x Nerf Guns
- 16 x RED LED’s
- 2 x Buttons
- 2 x Hi-Vis Vests
- 2 x Power Banks
- 2 x USB Cables
- Copper Tape
- Soldering Station
- Hot – Glue Gun
If you get use a disposable camera, please follow this link to make the shocker:
Changes we have made include a change from the LCD screens to LED’s, when opening the disposable camera, we got a 6 pin transformer instead of a 5 pin transformer therefore making us unable to make the shocker that was shown in the instructable. We are therefore looking for better alternatives to make the shocker.
At the moment, the only bit of the of the shock vests we have completed is connecting the mpr121 breakout boards, the LED’s and the targets so that when a target is shot, one of the LED’s turn off signifying that one ‘life’ has been taken away.