Project Overview
Wobbledogs is a game about quirky creatures that wobble and mutate. This project uses the LEGO Education SPIKE Prime set to design a small robot that "wobbles" and walks in a similar playful way. You will build a body around the SPIKE Prime Hub, add flexible legs and motors, then program behaviors including randomized "mutations" that change gait parameters—similar to Wobbledogs’ genetics.
Learning goals
- Understand how mechanical design (leg length, joint stiffness) affects movement.
- Program basic motion, randomness, and simple selection (a tiny genetic experiment).
- Use sensors to add feedback (e.g., avoid obstacles).
- Practice iterative design: build, test, measure, improve.
Materials (from SPIKE Prime set + extras)
- SPIKE Prime Hub
- 2–4 Large or Medium motors (depending on design)
- Beams, liftarms, pins and connectors (from set)
- Rubber bands or flexible connectors (to make joints springy)
- Distance or color sensor (optional but recommended)
- Tape, foam or cardboard for pads if you need grip
- Computer or tablet with SPIKE app (Scratch or Python / MicroPython)
Design ideas (choose one)
- Two‑motor wobble walker: Hub is the body. Two motors drive left and right leg assemblies that are attached with flexible joints so each drive causes a wobble and a step. Simple to build and program.
- Four‑leg staggered walker: Four passive legs (flex joints) and 1 motor that rocks the body back and forth; the legs are shaped so rocking produces forward motion.
- Tail‑wag balance walker: One motor wags a tail to shift the center of mass and produce steps with passive legs.
Step‑by‑step build (2‑motor walker — recommended)
- Build a compact rectangular frame with the SPIKE Hub mounted on top as the central body.
- Attach two motors on the sides near the front of the body. Each motor will drive a leg assembly (one on left, one on right).
- Create each leg: a short beam as a thigh, a pivot connector acting like a hip joint, and a longer beam as a lower leg ending with a flat foot. Use rubber bands or a flexible connector at the hip to give springiness (wobble).
- Mount leg assemblies on the motor output shaft (or link the motor to the leg with gears/axles) so motor rotation pushes/pulls the leg forward and backward.
- Optionally add a passive tail (beam) with a rubber band to act as a counterbalance; this can improve walking stability.
- Connect the motors to ports (e.g., A and E) and plug in any sensors (distance sensor to front port).
Behavior and parameters to control (the "genes")
Each robot variant can be defined by a small set of parameters (like a genome):
- motor_speed (how fast motors turn)
- stroke_angle (how far each leg swings)
- phase_offset (timing offset between left and right legs)
- leg_length (physical, you can swap beams)
- joint_stiffness (rubber band tension)
By changing these parameters you’ll see very different behaviors — slow wobble, quick hops, spinning in place, or straight walking.
Programming logic (high level)
- Create functions to set a gait: move left leg forward by stroke_angle, then right leg, or run them continuously with a phase offset.
- Allow parameters to be randomized to simulate mutation.
- Run short trials (e.g., 10 seconds) for each parameter set and measure performance (distance traveled with a tape measure, or progress reported by the hub if you have an encoder-based method).
- Keep the best performers, then create new variants by mutating their parameters — repeat to mimic selection.
Example pseudocode (adapt to SPIKE app blocks or MicroPython)
# Pseudocode (structure you can implement in SPIKE blocks or Python)
params = { 'speed': 30, 'stroke': 30, 'phase': 0.2 } # a sample genome
def set_gait(params):
left_speed = params['speed']
right_speed = params['speed']
stroke = params['stroke']
phase = params['phase'] # fraction of cycle
def step_cycle(params, duration):
# run for 'duration' seconds
start_time = now()
while now() - start_time < duration:
t = (now() - start_time) % cycle_time
# compute desired angle for each motor as a sinusoid
left_angle = sin(2*pi*(t/cycle_time)) * stroke
right_angle = sin(2*pi*((t/cycle_time) + phase)) * stroke
motor_left.run_to_angle(left_angle, speed=params['speed'])
motor_right.run_to_angle(right_angle, speed=params['speed'])
# Trial & simple selection
population = random_variants(n=6)
for variant in population:
apply_variant(variant)
distance = run_trial(duration=8)
log(variant, distance)
# pick best, mutate, repeat
Notes: In the SPIKE Prime Scratch environment you will implement a sinusoidal or timed motion using motor blocks (set speed, rotate for degrees, repeat). In Python, use the SPIKE API to command motors to angles or speeds and read time.
Simple concrete Scratch-style routine
- Loop forever:
- Left motor: rotate forward by X degrees at speed S
- Wait T seconds
- Left motor: rotate backward by X degrees at speed S
- Right motor: same but start T*phase seconds later
Testing and measuring
- Run short trials (5–10 seconds). Measure how far the robot moves with a ruler or mark start/end positions on the floor.
- Change one parameter at a time to see its effect (e.g., increase stroke from 20° to 40° and observe).
- If it spins instead of walking, reduce phase offset or adjust leg angles and stiffness to improve traction.
- Use the distance sensor to detect obstacles and make the robot turn or stop.
Debugging tips
- Check that motors are mounted rigidly and that the leg connection actually converts rotation into useful leg motion.
- Ensure rubber bands are not slipping and aren’t too tight (which would prevent wobble).
- Lower speed if the robot shakes too violently; increase speed slowly.
- Try different foot pad materials (tape, foam) if slipping is a problem.
Extensions (advanced)
- Implement a simple genetic algorithm: keep top 2 performers, cross their parameters, add small random mutations, run next generation.
- Record performance data to the hub and plot it to show improvement over generations.
- Add more degrees of freedom (extra motors for hips or tail) to increase behavioral variety.
- Create a display screen on the Hub that shows the current "genome" and a fun dog face that changes with mutations.
Safety and practical notes
- Work on a flat surface and keep hair/tape away from moving parts.
- Do not overload the motors—give them rest between trials if they heat up.
- Supervise use of small parts if younger people are nearby.
Project timeline (suggested)
- Build prototype frame and one leg: 30–60 minutes
- Finish two-leg assembly and attach hub: 30–60 minutes
- Basic programming (walk/wobble): 30–90 minutes
- Testing, measuring and iterative improvements: multiple 10–30 minute trials
Final tips
Start simple. Get a basic wobbling motion first, then add randomized parameters and selection to make it feel like a Wobbledogs evolution. Keep notes of which parameter changes help or hurt performance. That experimentation is where most learning happens.
If you want, tell me which SPIKE Prime ports you plan to use and whether you prefer Scratch blocks or Python, and I can give a concrete block sequence or Python example tailored to your hardware mapping.