Skip to main content
Skip to main content

Sphero and the
Chocolate Factory

Years 3-4 (can be adapted for 5-6)

Students are introduced to programming Sphero, using Sphero to represent a character from a story, fairy tale or book that they have read. This activity allows students to use the visual programming software Lightning Lab to control Sphero to act out the role of a fictional character.

This activity uses Charlie and the Chocolate Factory by Roald Dahl as an example, but you can use a story that your class is familiar with.

This lesson idea was created by Steven Payne.

Image credit: Enotovyj/ Pixabay



  • Spheros
  • iPads with the SPRK Lightning Lab app.
  • Paper and pens
  • Cardboard boxes and glue / sticky tape

Prior Student Learning

Digital Technologies:

  • Students have done some work on algorithms and used some basic visual programming (possibly with Sphero).


  • Students have done some work on angles.


  • Cardboard boxes and glue / sticky tape.

Learning hook

Show images of the four main rooms in Charlie and the Chocolate Factory: The Chocolate Room, The Inventing Room, The Nut Room and The Television Room (or choose places or scenes from the book that your class has read.)

Ask students to discuss in pairs something important or memorable that happened in each of the rooms.

Introduce Sphero (maybe dressed up as a character from the book). Explain that we are going to program Sphero to navigate a path to various rooms (or scenes) in the book and respond appropriately with colour and movement.

Learning map and outcomes

  • Students describe the sequence of events in the story.
  • Students work in teams to design their algorithm using SPRK Lightning Lab.
  • Students work in teams to implement their program for Sphero to interact with the various rooms or scenes
  • Students can debug their algorithms

Learning input

Show how to pair Sphero with an iPad and run a block-based program in Lightning Lab.

Show a few of the basic control blocks and how to change their behaviour (e.g. angle, colour, speed). Do not show too much as students should be playing, discovering and problem-solving with Lightning Lab in their groups.

Explain that students are going to construct their own paths around the Chocolate Factory for Sphero to follow.

Sphero can play the part of Willy Wonka, or another character, or a visitor from your class. Students will need to program Sphero to move around the Factory and interact with the various rooms.

Learning construction

Students work in small groups or pairs to construct a path on the floor using cardboard boxes (or similar) as the different rooms.

This is an opportunity for students to play and find out how to control the Sphero.

Encourage students to be imaginative and consider direction, speed, colour, and sound and how these might be relevant to points in the path or the story.

E.g. Sphero could turn blue (like a giant blueberry) in The Inventing Room. Sphero could slow down and turn pink to represent the Pink Sweet Boat ride in The Chocolate Room.

As students draw lines, teacher asks questions as appropriate:

  • Why have you used this block?
  • How does Sphero know where to go next?
  • How could you program Sphero to avoid crashing into the box?
  • What have you changed?

Reinforce the fact that failure is a good thing! As students work, they should make notes on what works and doesn’t work. They can also compare notes and help other groups out.

Learning demo

Once students have programmed Sphero, choose a couple of groups to present what they have created with the class:

  • What did you discover about the different blocks?
  • How did you show what the character was thinking or doing?
  • What worked well?
  • What did not work well?
  • What would you change if you were to repeat the task?

Take photos / video of the presentations and discussions about the learning process.

Learning reflection

Bring together the observations from the learning demo and, if possible, show some photos / videos.


Lessons and activities designed to use with Sphero and Lightning Lab, including submissions from teachers across the world, cn be found here