Introduction: Fitness Games
Using a fitness trampoline and some electronics with an Arduino you can play games that make you fit. Jumping on a trampoline is good for your heart and muscles. Gamification of workouts has been tried by mobile apps. But my way is more fun.
Game characters move by jumping on the trampoline. Jump higher to make the character jump. Bend down (uses some other muscles :-)) to make your character duck.
1 trampoline, for instance a Gymstick with a mechanical switch that registers jumps properly.
1 Arduino Leonardo
1 Infra red sensor - this is used to register stoops.
1 330 or 470 ohms resistor
1 push button (Arcade button)
The infra red sensor works better than ultra sonic sensors (even the expensive ones register too many false stoops, I tried them) and is easier to set up than a light barrier (I tried that too).
Step 1: Prepare the Trampoline
Buy a trampoline that has a mechanical switch on it to register jumps (see photo that shows the bottom of mine). The switch makes contact when a person is on the trampoline. The switch doesn't make contact when the person is in the air (jumping), or when the person is away.
Google for "fitness trampoline" or "mini trampoline" to find one.
Remove all existing electronics from the switch and connect the wires to the Arduino Leonardo, as explained in the next step.
Step 2: The Electronics
Prepare the electronics according to the schematic I provide here.
The trampoline switch that registers jumps connects to pin 7 and ground. Also connect the IR sensor, LED + resistor (a rectangle is the European notation of a resistor, see the schematic) and a push button. The push button is used to put the system on or off quickly. This is needed because the system emulates a keyboard and you want to be able to turn that off easily.
Connect the electronics device to a free USB port of your PC.
An OpenScad file and an STL file are provided if you want to 3D print an enclosure like I did.
Upload the Arduino sketch into the Leonardo.
Working of the sketch:
- The main loop monitors the status of the push button to see if it is on or off. If it's on:
- It monitors the trampoline switch and sends it to the PC (via USB) as a keypress of the Ctrl key.
- It monitors if a user is present in front of the IR sensor and if so it sends a Shift keystroke to the PC.
Games can be developed by using Construct2 or your own favourite game engine as long as the game engine can trap Shift and Ctrl keys.
Step 3: Play Games
Connect the trampoline to the electroncis case and connect the electronics to the USB port of your PC.
Ideas for games
Platform games whereby a character moves to the right on a horizontal platform are easy to make and fun to play. Other ideas:
- Duck hunt whereby you are the duck (and you must bend down to avoid bullets of hunters)
- Super Cobra, Scrambler or other games whereby you control a helicopter or airoplane through a cave (duck to move down and jump to move up).
A (working) example demo game is here:
You control a Lion that collects coins for points and you must bend down to avoid nasty flying coconuts.
Note for Windows users
You should disable the sticky keys options in Windows