Code a Geometric Drawing Robot with LEGO SPIKE Prime | A Hands-On STEM Lesson Plan

Bring math to life with this hands-on STEM lesson! Guide students to build and program a LEGO SPIKE Prime robot that draws geometric shapes, from simple squares to complex art. This project integrates coding, geometry (polygons, angles), and algebra in a fun, creative challenge.

Previous Lesson
PDF
```html

Lesson: The Robotic Geometric Artist

Materials Needed:

  • LEGO® Education SPIKE™ Prime Set (Hub, 2 motors, wheels, frame components)
  • Computer or tablet with the LEGO Education SPIKE App (Word Blocks or Python)
  • Large sheet of paper (e.g., A3 or butcher paper) or a whiteboard
  • A marker (e.g., dry-erase for a whiteboard or a felt-tip pen)
  • Tape or LEGO rubber bands to attach the marker to the robot
  • A ruler and a protractor
  • A calculator

Lesson Overview

In this project, you will transform your SPIKE Prime robot into a "turtle" robot that draws precise geometric shapes. You will apply core concepts from geometry and algebra to program the robot's movements, starting with simple squares and advancing to complex, creative artwork. This is not about memorizing formulas, but about using them to solve a fun, hands-on engineering challenge.

Learning Objectives

By the end of this lesson, you will be able to:

  1. Apply the properties of polygons (side lengths, interior/exterior angles) to a practical robotics problem.
  2. Use measurement and algebraic variables to calibrate the robot's movement and create reusable code.
  3. Deconstruct a complex composite shape into simpler geometric components for programming.
  4. Use creative problem-solving to design and execute a unique piece of "geometric art."

Part 1: The Warm-Up - Angles and Turns (15 minutes)

Before we build, let's think about the logic. A robot drawing a shape on the ground is like walking the perimeter of that shape.

  1. The Key Concept: When your robot gets to a corner of a polygon, it needs to turn. The angle it turns is the exterior angle of the polygon, not the interior one.
  2. Quick Puzzle: A square has four 90° interior angles. If you walk along one side and get to the corner, how many degrees do you turn to face along the next side? (Answer: 90°).
  3. Harder Puzzle: An equilateral triangle has three 60° interior angles. To draw it, how many degrees does your robot need to turn at each corner? (Hint: The exterior angle is 180° - interior angle). (Answer: 120°).
  4. The Universal Rule: For any regular polygon, the exterior angle is 360° / number of sides. This is the magic formula for today's lesson! We will use this to program all our turns.

Part 2: Build and Calibrate Your Drawing Robot (30 minutes)

Let's build a simple robot and teach it how to move accurately. This step is crucial and is a real-world measurement challenge.

  1. Build: Construct a simple, stable robot with two drive motors. It just needs to be a basic chassis.
  2. Attach the Pen: Using tape, rubber bands, or LEGO technic pieces, attach a marker to the front or center of your robot. The marker tip should just touch the paper when the robot is on the surface.
  3. Calibration 1 - Moving Straight:
    • Write a simple program to make the robot's motors run for exactly one rotation.
    • Place the robot on your paper, mark its start and end points, and run the program.
    • Use a ruler to measure the distance it traveled in centimeters. This value (cm per rotation) is your first key calibration number!
    • Algebra Connection: You've just found the value of 'c' in the equation `distance = c * rotations`.
  4. Calibration 2 - Turning:
    • Write a program that makes one wheel move forward for one rotation and the other wheel move backward for one rotation. This should make the robot spin in place.
    • Place the robot on the paper and mark a line showing where it's pointing at the start. Run the program. Mark a line where it's pointing at the end.
    • Use a protractor to measure the angle of the turn. This value (degrees of turn per rotation) is your second key calibration number.
    • Problem-Solving: How many rotations (or degrees of motor movement) would you need to make the robot turn exactly 90°? Calculate this and test it!

Part 3: Programming The Basics - The Square and The Triangle (25 minutes)

Using your calibration values, let's write code to draw a simple shape.

  1. Goal: Draw a 20cm x 20cm square.
  2. Algorithm Plan:
    • Put the pen down (or just start with it down).
    • Move forward 20cm.
    • Turn 90 degrees.
    • Move forward 20cm.
    • Turn 90 degrees.
    • ...repeat two more times.
  3. Code It: Translate your algorithm and your calibration numbers into a SPIKE program. For "Move forward 20cm," you'll need to calculate how many motor rotations that is using your `cm per rotation` value. For "Turn 90 degrees," use the value you calculated in the calibration step.
  4. Test and Debug: Does it look like a square? Are the corners sharp? Are the sides straight? Adjust your calibration values if needed. Real-world engineering requires iteration!
  5. Challenge: Now, modify your program to draw an equilateral triangle with 20cm sides. Remember the exterior angle rule from the warm-up!

Part 4: The Main Challenge - The Geometric Artist (45 minutes+)

This is where you combine all your skills. Your mission is to program your robot to create a piece of "geometric art."

Your artwork must include:

  • At least two different regular polygons (e.g., a square and a hexagon).
  • At least one composite shape (e.g., a square with a triangle on top to make a house).
  • A "travel" move where the robot lifts its pen (or you lift it manually), moves to a new spot, and starts drawing again.

Process:

  1. Design: On a piece of scrap paper, sketch your artwork first. Label the shapes and the side lengths.
  2. Calculate: For each shape, calculate the turn angles and the required motor rotations for each side length. For your composite shape, you may need to use concepts like the Pythagorean theorem to find the length of a diagonal line. For example, in a house shape, the roof is made of two right-angled triangles.
  3. Code and Create: Write the program for your masterpiece. A great way to organize your code is to create "My Blocks" (custom functions) for each shape, like `draw_square(side_length)` or `draw_hexagon(side_length)`. This is a powerful algebra concept where you use variables to make your code flexible.
  4. Refine: Test your program section by section. It's much easier to debug drawing one shape at a time than to debug the entire artwork at once.

Part 5: Reflection and Wrap-Up (5 minutes)

Once you have your final artwork, think about these questions:

  • What was the most challenging part of this project? The build, the calibration, or the final artwork programming?
  • How did a simple geometric rule (exterior angles = 360/n) become the core of your complex program?
  • If you had to draw a circle, how might you program the robot to approximate one? What geometric shape would you be using?
  • What real-world machines work on similar principles of coordinate movement and geometry? (e.g., 3D printers, laser cutters, CNC machines).

For Further Exploration (Optional Extensions)

  • The Scaler: Create a single variable at the start of your code called `scale`. Make it so all your drawing commands are multiplied by this `scale` variable. Now you can draw your entire artwork bigger or smaller just by changing one number!
  • The Area Calculator: After drawing a shape, program the SPIKE Hub to calculate the area of the shape it just drew (using the side length variables you gave it) and display the result on the light matrix.
```

Ask a question about this lesson

Loading...

Related Lesson Plans

Unpacking Animal Farm: A Study Guide to Orwell's Allegory, Satire & Themes

Explore George Orwell's classic allegory, Animal Farm, with this detailed study guide. Understand the parallels to the R...

Explore Flora and Fauna: Fun Art Lesson & Drawing Activity for Kids

Engage children with this easy art lesson about flora (plants) and fauna (animals). Learn definitions, explore famous na...

Fun Animal Writing & Drawing Activity for Young Kids | Creative Writing Practice

Engage young writers with 'Animal Adventures in Writing!' This fun, step-by-step activity guides kids to choose an anima...

Create Your Own Wimpy Kid Journal: Fun Writing & Drawing Lesson Plan

Engage students with this fun lesson plan inspired by 'Diary of a Wimpy Kid'! Kids learn about narrative voice and simpl...

Hands-On Science Fun: Build Plant & Animal Cell Models with Lego Bricks | STEM Activity

Discover the building blocks of life with this fun STEM activity! Learn how to build detailed plant cell and animal cell...

Fun Bluey Drawing & Pre-Writing Activity for Preschoolers | Learn Letters & Shapes

Engage your little learner with this fun Bluey-themed drawing and pre-writing activity! Kids draw favorite characters, e...