SPIKE™ Prime with Python

Automating Action

Students will add a motor to a model to automate the action.

45 min
Years 7-9 or Key Stage 3

Questions to investigate

How can a mechanism be motorized to add automation? How can automation make tasks easier?


Ensure SPIKE Prime hubs are charged, especially if connecting through Bluetooth.

1. Engage

Engage students in a discussion about automation. Prompt students to provide ideas about what automation is and provide examples of everyday items that provide automation. Consider showing images or videos as needed for students to understand how automation happens.

Show students the video from the SPIKE Prime Extra Resources - Ideas, the LEGO Way lesson. Use this video to prompt a discussion about what could be automated in the model shown. Discuss ideas for adding a motor to automate the movement provided by the two people in the video.


Challenge students to add a motor to the tower arm in order to automate the movement to the character rather than needing to move it manually.
Students will design an idea for adding a single motor to the tower arm. Students should sketch an idea for adding the motor then write out their pseudocode for how to program the tower arm to move. Students need to consider the design of the tower arm, understanding how it can move, in order to program the movement to be automated.

Open a new project in the Python programming canvas. Ask students to erase any code that is already in the programming area. Students should connect their hub.
Students will program the movement of the arm. Use the pseudocode to help create the program. Remind students to test their program several times in order to ensure it moves as expected. Ask students to add code comments using # to explain the steps of the program.

3. Explain

Students should share their final design and program, explaining how the program automates the movement.

Ask students questions like:

  • How did you program your model? Ask students to share their program comments to explain.
  • What decisions did you have to make while adding the motor?
  • What decisions did you have to make when programming your movement?
  • How does adding the motor to automate the movement make the task easier?
  • What were areas that you had to debug or troubleshoot?
  • What was difficult about this challenge?

4. Elaborate

Have two groups of students come together to form a larger group.

Group 1 will present their model and program to Group 2. Group 2 will then present their model and program to Group 1.

Both groups should focus on the code comments provided in each program. The groups will work together to make sure the code comments clearly outline each program.

Working together, groups should create basic user instructions for their automation. Each group can add these instructions to the top of their program using a code comment.

5. Evaluate

Teacher Observation:
Discuss the program with students.

Ask students questions like:

  • How were you able to motorize your mechanism?
  • What decisions did you need to make in order to add the motor?
  • Why are code comments, including user instructions, important to create?

Have students answer the following in their journals:

  • What did you learn today about adding automation to movement?
  • When can automation be helpful?
  • What characteristics of a good teammate did I display today?
  • Ask students to rate themselves on a scale of 1-3, on their time management today.
  • Ask students to rate themselves on a scale of 1-3, on their materials (parts) management today.

Teacher Support

Students will:

  • Build and program a model that automates a task.
  • SPIKE Prime sets
  • Devices with the SPIKE App installed.
  • Student journals

Design projects that combine hardware and software components to collect and exchange data.

Use flowcharts and/or pseudocode to address complex problems as algorithms

Incorporate existing code, media, and libraries into original programs, and give attribution.

Systematically test and refine programs using a range of test cases.

Document programs in order to make them easier to follow, test, and debug.

Develop a model to generate data for iterative testing and modification of a proposed object, tool or process such that an optimal design can be achieved.

Engage effectively in a range of collaborative discussions (one-on-one, in groups, and teacher-led) with diverse partners on grade 8 topics, texts, and issues, building on others' ideas and expressing their own clearly

Present claims and findings, emphasizing salient points in a focused, coherent manner with relevant evidence, sound valid reasoning, and well-chosen details; use appropriate eye contact, adequate volume, and clear pronunciation

Follow precisely a multistep procedure when carrying out experiments, taking measurements, or performing technical tasks

Acquire and use accurately grade-appropriate general academic and domain-specific words and phrases; gather vocabulary knowledge when considering a word or phrase important to comprehension or expression

Develop a model to generate data for iterative testing and modification of a proposed object, tool or process such that an optimal design can be achieved.