I wanted to address the theme of the hackathon, being about gaming, in a creative way and took this oppurtunity to make something really fun and exhausting (if you don't exercise).
What it does
The project makes you a desperate T-Rex who's ready to explore the wondrous 2-D, 8-bit, binary colored world of Google Chrome with joy and excitement. You can wear this device on or above your waist so that the T-Rex shadows your movements. So make sure you exercise your knees daily to keep up with the high scores.
How I built it
So this project consists of mainly 3 sections:
- Sensor (Accelerometer)
- Logic Unit (Microcontroller)
- Output Unit (LEDs and Keyboard)
1. The Adafruit LIS3DH SPI Triple-Axis Accelerometer:
It's used to detect the changes in acceleration of the person due to the movement. When a person jumps up or ducks down, he/she produce a relative acceleration to do so.
We measure the change in acceleration by taking the absolute value of X, Y and Z axes because the change would be positive no matter we are going up or down.
2. The Seeeduino XIAO Microcontroller Development Board:
The SEEED Studio's Seeeduino XIAO is a minimal, low-cost board that uses the Atmel ATSAMD21G18, a powerful 32-bit ARM Cortex®-M0+ processor running at 48MHz with 256KB Flash and 32KB SRAM. I've used this board because of it's miniscule size (20 x 17.5mm) which is perfect for wearable devices and small projects. It's Compatible with both Arduino IDE and CircuitPython. But I've chosen to program it using CircuitPython because it's faster and much simple.
In the source code, first import the necessary standard libraries like time, board, digitalio which are built-in the board. Then to use the other hardware, I've added the 'adafruit_bus_device', 'adafruit_hid' and 'adafruit_lis3dh' libraries, manually in order for the functions to work. I've used the Serial Peripheral Interface (SPI) connection to communicate between the accelerometer and the microcontroller board, so I setup the pin configurations for that.
Then I've intiliazed what kind of Keyboard I'll be using which is US-American standard layout. There's a delay of 1 second so that the board doesn't start rushing to the end. 'ledj' (red LED) is used to indicate when a jump has occured, whereas 'ledd' (blue LED) is used to indicate when a duck has occured.
The main 'while' loop consists of all the logic that needs to be running everytime. The board checks what the default position is by checking which axis has the value in the range of gravitational constant (g ~ 9.8 m/s²). Then it calculates if the change in acceleration is greater than 10 (roughly g).
3. Red/Blue LEDs and Keyboard:
This is the output unit of the project. The board presses the UP Arrow and turns on the red LED for 500 milliseconds. Similarly, if it detects a duck, the board presses the DOWN Arrow and turns on the blue LED for 500 milliseconds.
I've put some 'print' statements in between but it's only for debugging purposes and can be ignored. You can use an application like putty or Arduino's Serial Monitor to see the values of X, Y and Z axes
Challenges I ran into
- Since this is my first Hackathon, I ran into a lot of challenges. A LOT
- I had to learn Git & GitHub thoroughly to deliver the best write-up I can.
- Many hours were spent only to play with Markdown.
- I assembled the circuit on the breadboard initially then created a PCB layout to improve the form factor of the project.
- Not to forget how much stress I had to put on my knees.
- I was unable to find a team during the process, so I had to learn, make, improve, write and document myself.
- The most difficult part was thinking about an idea. Due to the pandemic I've not been able to order/recieve many components and parts which would've helped me make more useful (or funny) projects. I was limited only to my laptop and a few sensors, so had to build something with what I got. But I hope I've overcome this hurdle and put your interest in this project.
Accomplishments that I'm proud of
I'm proud of being a part of Major League Hacking. This being the first time I'm participating in a Hackathon (both offline or online). I did face many challenges and learned to overcome them. The community was really helpful and I also got a chance to interact with a lot of people.
What I learned
- Git & GitHub
- Importance of time and exercise
- Project Documentation and Management
What's next for Jump Yo' Rex
This project still uses a USB cable to power and interact with the computer, so I'm planning to use bluetooth instead and will try to improve the interaction overtime. Pretty soon the T-Rex within will be free from the leash and roam around jumping and going crazy.
Thank you for your time and taking interest in this project. Feel free to contact me on Github, Twitter, Instagram or LinkedIn. Or checkout my other projects at Hackster.io. I'll be happy to take up your questions and answer as much as possible.