Jump Fit
If you don't want to go through the hassle of building this, here is a fun motion game on the browser, https://binjump.in/
This Project was done by Anuj Malviya, Josh Elias Joy, and Akshay Phate as a part of the Wearables Sytem Design course at IIIT Hyderabad. We would also like to thank our Professor Raghu Reddy.
We designed a wearable gaming system to motivate people to exercise and also have fun at the same time. As for the game we took inspiration from the google chrome dino game, but the catch here is that you have to jump in real life to play the game. To make things more competitive and fun, we have made it a multiplayer game.
Supplies
Components
- Arduino Micro
- Arduino Pro Mini 8Mhz X 2
- FTDI Serial Adapter
- Nrf24l01 X 2
- MPU9250 X 2
- AA Battery Holder X 2
- Slide Switch X 2
- AA Battery X 4
- Electrolytic Capacitors 100uF
- Wires ( Flexible Silicon wires around 20 AWG easy to work with)
- Velcro
- Tape
Tools
- Soldering Iron
- 3D Printer (Ultimaker S5)
- PLA Filament
Building the Circuit
The wearable gaming system consists of a Receiver and a Transmitter. The Transmitter is a wearable device, since we are building a 2-player game we need 2 transmitters. The Receiver emulates a keyboard and sends the right keystrokes to make the dino jump when the player jumps.
The Receiver Device Consists of:
Arduino Micro: The Arduino micro can act as USB Human Interface Device meaning it can act as a usb keyboard, mouse or gamepad.
Nrf24l01: The nrf24lo1 is a cheap, robust, and low-power wireless transceiver. It used to communicate between the Arduino Micro (Receiver) and Pro Mini (Transmitter).
Arduino Micro NRF24
D5 --------------------------- CE
D7 ---------------------------CSN
SCK------------------------- SCK
MI ----------------------------MISO
MO--------------------------- MOSI
The Transmitter Device (Wearable) Consists of:
Arduino Pro Mini: The Arduino Pro mini Communicates (I2C) with the IMU to detect a jump. The advantage of using an Arduino Pro mini is that it is compact and we can optimize it for low-power usage.
Nrf24l01: NRF24L01 module was attached to the Arduino to make the designed system wireless without limiting the user's mobility. It is used to communicate between the Arduino Micro (Receiver) and Pro Mini (Transmitter).
IMU MPU 9250: The MPU9250 is a 9-axis IMU, we use it to detect a jump by measuring acceleration changes in the z-axis.
Arduino Pro Mini NRF24
8 -------------------------------CSN
9 -------------------------------CE
13 ------------------------------SCK
12 ------------------------------MISO
11 ------------------------------MOSI
Arduino Pro Mini MPU9250
A4------------------SCL
A5------------------SDA
Note that the electrolytic capacitors were needed for the Nrf24l01 to work properly.
Programming the Device
The Arduino IDE has been used to Programme the devices. Here is a getting started guide, note that I have used the Legacy IDE.
The Following additional Libraries have been used, to easily communicate with nrf24 and MPU9250 IMU.
- RF24: https://github.com/nRF24/RF24
- MPU9250_asukiaaa: https://github.com/asukiaaa/MPU9250_asukiaaa
Here is a good tutorial on how to work with Nrf24
Comments are present in the attached programs to explain the code.
In the Transmitter code, we read the acceleration in the x, y, and z-axis from the IMU and transmit the data wirelessly through the Nrf24 transceiver.
On the Receiver side, we compare the acceleration values received with a threshold. We can specify different threshold values, the higher the threshold needs higher jumps, in turn making the game more difficult. if the values are greater than the threshold we send a keystroke using the keyboard.h library. The space key has been used for player 1 and lowercase 'l' for player 2. It is necessary to send key presses between some time intervals else pygame (python library used to build the game) slows down.
Designing an Enclosure in Fusion 360
The enclosure design is similar to that of a drawer. The electronics are placed inside the drawer and gets enclosed in a cabinet-like housing. The bottom portion of the drawer is designated for the battery compartment.
There is a handle present to the side of the enclosure to fasten the velcro.
Case/Housing Design
- The orientation we considered are followed: XZ as the Top plane, XY as front plane and YZ as side plan.
- Our CAD model is devided into two parts one is the housing and the other is the slider cap.
- We used Fusion 360 to design the whole assembly.
- We started designing the case as our primary and stationary part of the assembly.
- We made the first rectangular box on top plane and constraining using X and Z axis.
- Extruded the shape based on the required space for the circuit along with tolerance limits.
- Then gave fillets to the top longitudinal edges, later we gave almost 2.35 times more fillets to lateral edges than longitudinal edges.
- After the solider shape of our casing, we used shell command to give uniform thickness of 1.75mm and convert the solid form to housing. Thickness has been chosen based on Ultimaker S5 specification and based on PLA requirements.
- We decided that the assembly should be easy to open so we gave a sliding path in the casing to allow the cap to slide smoothly.
- To make a slider in the case we used XY as the base plan for our sketch and extruded the profile of two parallel walls sketch to the next surface tangentially.
- Later we used swape command to make handle and gave a opening to the opposite wall of handle, so that we can use Velcro to tie the device with the arm like Apple smartwatch cloth bends.
- Last operation we used to remove the face from one side so that the cap can slide and pack the device properly
Cap/draw design:
- We used YZ plane as base plane to make sketch for the cap. We extruded it with respect to housing inner space + tolerances.
- Extracted the sketch of opened face from housing and remove the extra material from cap. So it will slide and give edge to edge fitting with the housing.
- Extruded the two side walls with 2.8 mm holes on both the sides and later we use these walls to screw the housing.
- The end of the assembly we gave the embossed name of device “wearable joystick” on the top of housing and extruded it under the 3d printer limits.
- After 3d printing we used zero size sand paper to give smooth surface finish which allow to slide the cap into the housing guider.
Assembling the Device
The enclosure was 3d printed (Ultimaker S5) using PLA filament and the electronics were housed in the enclosure as per the above image. Tape has been used to secure the components to the enclosure.
Building the Game
We build a custom two-player rendition of the Chrom Dino game in Python using the Pygame library. But you could just play with the original game in the Chrome browser.
Pygame is relatively easy to get started with once you have learned Python.
Concepts of Object Oriented Programming have been used in the code. The Dino, Cactus, Score, Ground, and Sky are different objects.
There is potential to improve the performance of the game, but we had just a month to build the whole system (Electronics, code, CAD and game development ) along with other university coursework, thus it wasn't a priority.
The Jump Fit game we built can also be downloaded from here.