Double Jump
Jan 2024
GOAL: Use gear reduction to run a stepper motor for 200 steps, but move a character (e.g Mario) from 90 to 180 degrees
SKILLS: Gear Design, CAD (OnShape), python programming (event detection), using a limit switch, using a stepper motor, wiring, assembly, laser cutting, use of single board computer (Raspberry Pi), design, collaboration
This Super Mario Bros-themed gear mechanism is designed to transmit a full 360 degree rotation of the pinion gear (200 steps from a stepper motor)) to a 90 degree rotation of the final gear. The arc of the 90 degree rotation makes the Mario attached to the gear appear to be jumping up onto a ledge.
The system uses a Raspberry Pi 4, L298N motor driver, limit switch, 9V battery, and a stepper motor.
Design Constraints
use a gear train with at least 4 gears
Success = +/- 50 degrees
Super Success = +/- 5 degrees
may NOT use any pre-made gears or software that creates gears
Video
Gear Design
To design the gears I used equations to calculate things like base diameter, root diameter, outer diameter, pitch, filet radius, etc.
The calculations are below:
Two different strategies were used to draw the involute curve and create a gear tooth shape that allows the contact point to move smoothly and facilitate smooth meshing.
One of the strategies was to plot the equation in Desmos, and graph vertical lines that intersect to get the cartesian coordinates of the involute (see "involute with equation" folder above or screenshots below)
Wiring
DJ.py Code

Code Summary
first call the rotate_CCW function to get back to the starting position
a for loop goes through and sets the GPIO pins with logic that changes the magnets and operates the stepper motor.
There are four different states in order to keep the rotation going, so the current_step variable is incremented and modulo by 4 to figure out with state to apply
If the limit switch is pressed, the callback function is called, which calls the rotate_CW function
rotate_CW is similar to rotate_CCW, but it is set to stop the rotation and exit the program once the given number of steps is reached
CAD
Testing Result
90 degrees on the dot! Yay!
Things to adjust in the future:
Currently, we use sys.exit() to just end the whole program when the clockwise rotation is done. This is not very modular because the clockwise function might not be able to be reused in another application. Probably need to change some logic in the callback function.
using lock nuts so that the gears don't become looser over time
better cable management inside of just stuffing it into a box