Skip to content
Learning Site
Home

About

  • About Robotical
  • Case Studies
  • Meet the Team
  • Blog
  • Contact Us

Our Products

  • Marty the Robot
  • Axiom
  • Cog

Teach

  • Lessons & Resources
  • Marty for Educators
  • Funding & Grants
  • Professional Development
  • Why Teach STEM?
  • Coding Environments
  • Student Led Learning

Let's Code

  • Marty the Robot
  • Code Online
  • Marty Apple App
  • Marty Android App
  • Update your Marty
  • Cog
  • Code Online
  • Cog iOS App
  • Cog Android App
  • Axiom
  • Axiom Science

Support

  • Marty Get Started
  • Cog Quick Start Guide
  • Axiom Science Quick Start Guide
  • Support & FAQs
  • Marty V2 User Guides
  • Marty V1 Resources
  • Request Support
  • Request Top-Up Training

Shop

  • Marty the Robot and Physical Computing
  • Class Packs
  • Add Ons & Extras
  • Account
  • Shipping, Returns & Cancellations
  • Distributors
HomeLessonsUnits of workCurriculum standardsTutorials

Information

  • Lessons & Resources
  • Knowledge Base & User Guides
  • About Us
  • Shipping, Returns & Cancellation
  • Privacy Policy
  • Learning site privacy
  • Terms of Service
  • Partner Hub

Support & Help

  • Support & Help Center
  • Getting Started with Marty V2
  • Getting Started with Marty V1

Learning, Resources & Guides

  • Marty V2 Lessons Site
  • Marty V1 Lessons Site

Contact Us in the UK

Stanhope House,12 Stanhope Place,Edinburgh,United Kingdom,EH12 5HH
(+44) 0131 564 0922
hello@robotical.io
Contact Us

Contact Us in the US

2810N Church St, PMB 61694,Wilmington,Delaware,USA19802-4447
(+1) 833 886 1661
hello@robotical.io
Contact Us

Why not join our mailing list?

For News, New Products and Special Offers

Join mailing list

Copyright 2016-2026 © Robotical Ltd

All lessons
Marty app
CurrentPrevious

4.06 Marty Uses the Raspberry Pi in Python

So you can use a Raspberry Pi. What difference will it make to Marty whether I use the Pi or connect directly with my device?

4.06 Marty Uses the Raspberry Pi in Python
Age / stage
14 - 16
Estimated time
45 minutes
Difficulty
Intermediate
Products
Marty V2

On this page

  1. Lesson overview
  2. Before you begin
  3. Warm-up
  4. Get learning
  5. Further challenge ideas
  6. Cool down
  7. Additional reading
  8. Curriculum standards

Additional reading

Raspberry Pi setup with Marty

Setting up the python environment, for Marty

Programming in Python

Curriculum standards

21
Choose your curriculum to see the relevant standards.

21 of 21 linked standards shown.

Australian CurriculumAustralia2
Curriculum areaLinked standards
Digital Technologies, Design & technologies: Digital Technologies

Select a code to read the full standard.

Digital Technologies, Design & technologies: Digital Technologies

  • ACTDIP039Design the user experience of a digital system by evaluating alternative designs against criteria including functionality, accessibility, usability, and aesthetics
  • ACTDIP044Plan and manage projects using an iterative and collaborative approach, identifying risks and considering safety and sustainability
CSTA Education StandardsUSA2
Curriculum areaLinked standards
General standards

Select a code to read the full standard.

  • 3A-CS-02Compare levels of abstraction and interactions between application software, system software, and hardware layers.
  • 3A-AP-17Decompose problems into smaller components through systematic analysis, using constructs such as procedures, modules, and/or objects.
Curriculum for ExcellenceScotland14
Curriculum areaLinked standards
Health and Wellbeing: Mental, Emotional, Social and Physical Wellbeing
Literacy & English: Listening and Talking
Literacy & English: Reading
Literacy & English: Writing
Technologies: Computing Science
Technologies: Craft, Design, Engineering and Graphics

Select a code to read the full standard.

Health and Wellbeing: Mental, Emotional, Social and Physical Wellbeing

  • HWB 0-11a / HWB 1-11a / HWB 2-11a / HWB 3-11a / HWB 4-11Social wellbeing
  • HWB 0-14a / HWB 1-14a / HWB 2-14a / HWB 3-14a / HWB 4-14aSocial wellbeing

Literacy & English: Listening and Talking

  • LIT 3-05a / LIT 4-05aFinding and using information
  • LIT 4-07aUnderstanding, analysing and evaluating
  • LIT 4-09aCreating texts

Literacy & English: Reading

  • LIT 3-15a / LIT 4-15aFinding and using information

Literacy & English: Writing

  • LIT 3-20a / LIT 4-20aEnjoyment and choice
  • LIT 4-21aTools for writing
  • LIT 3-22a / LIT 4-22aTools for writing
  • LIT 4-23aTools for writing
  • LIT 4-28aCreating texts

Technologies: Computing Science

  • TCH 4-13aUnderstanding the world through computational thinking
  • TCH 4-15aDesigning, building and testing computing solutions

Technologies: Craft, Design, Engineering and Graphics

  • TCH 4-12aApplication of Engineering
England's National CurriculumEngland1
Curriculum areaLinked standards
Computing, Design and Technology: Computing

Select a code to read the full standard.

Computing, Design and Technology: Computing

  • ✔️Understand what algorithms are; how they are implemented as programs on digital devices; and that programs execute by following precise and unambiguous instructions
ISTEUSA2
Curriculum areaLinked standards
International Society for Technology in Education (ISTE)

Select a code to read the full standard.

International Society for Technology in Education (ISTE)

  • 4bStudents select and use digital tools to plan and manage a design process that considers design constraints and calculated risks.
  • 6aStudents choose the appropriate platforms and tools for meeting the desired objectives of their creation or communication.

Resources

Learner resources

  • Workbook for the Raspberry Pi with PythonFile links loading
  • Marty wifi codeFile links loading
  • Marty and the Raspberry Pi codeFile links loading

Educator resources

  • Teacher GuideFile links loading
  • Presentation for Raspberry Pi and PythonFile links loading

Lesson overview

This lesson assumes that Raspberry Pis are available as a resource and have been setup and linked to a device. For resources supporting the setup of a Raspberry Pi, please refer to the links in the additional reading section.

In this lesson, learners will be connecting Marty to the Raspberry Pi and writing some basic commands. Learners will compare what they could do with these programs when run directly from a device and when run from the Raspberry Pi, attached to Marty.

Learning objectives

  • I can describe why some procedures benefit from an 'always on' situation.
  • I can compare and contrast the steps in the code, making specific reference to the associated hardware.

Key vocabulary

  • Raspberry Pi
  • Virtual
  • Python
  • autonomy
  • remote
  • local

Prior learning

Experience using Command line syntax, experience with a Raspberry Pi and python

Before you begin

Equipment

  • Two Martys for instructions, one with a Rasperry Pi installed in the head.
  • Two devices for controlling Marty, one connected to the Raspberry Pi and the other directly connected to Marty; this was done with one device for the videos in the lesson.

Warm-up

TimingActivityPossible adaptations
Timing—

Warm Up

Ask learners if they know of any programs, on their computer or device, that stop running on their device when it is turned off: shut down or stand by. Examples may include some games, internet browsers, a variety of apps. Ask if they know of any programs that run when their device is turned off. Examples may include a clock or calendar, some games, some apps. When are there applications that fall into both categories: are there some apps that turn off when you turn off your phone while others remain on? Is there a reason for this? What do you think?

Ask learners if they think it is a good idea for all programs running on a device to stop running when the device is 'off' or would they prefer the application to continue to run. Are there times when you want an app to stop running, even when it is not closed? List examples for each. Discuss why it makes sense for some apps to continue running 'in the background' while it is preferred that other apps close when you go to standby.

What about when there are multiple devices running similar code, is it better to have one master device controlling and monitoring everything or is it better to have each device with individual control? Are there occasions where one or the other is preferred? Can you think of any of these and justify why one or the other is better?

Possible adaptations—

Get learning

TimingActivityPossible adaptations
Timing—

Get Learning

Introduce Marty with a connected Raspberry Pi and a Marty without one. Inform the class that you are going to run the same program on these two Martys but they way the program connects with each Marty is different. Task the learners with thinking about how they might be different, reassure them that what they can see, by looking at both Martys, from where they are sitting, is exactly the same and that both Martys are the same model, they may have even been made around the same time. In fact, the code for both Martys is running on one device. It is just as possible to do this with two devices rather than one.

Record any ideas the learners suggest for the differences between the two devices. Additionally, have learners complete the activities on the first page of their workbook, which relates to this.

Without showing the display to the learners for the devices that will be running the Marty script, load and run the command to have the Marty walk for 10 steps on both the device running through the Raspberry Pi and the one acting directly with Marty; inform learners that this is what the command is doing. Point out that both Martys are carrying out exactly the same actions, with the same code causing said actions.

Then run both programs a second time. Shortly after running the script, close the lid for the devices, or put them it in standby mode; if this will take too long to 'wake' from, perhaps disconnecting the wifi or the ethernet cable would be more suitable.

Alternatively, you could show the video from the PowerPoint presentation, the first shows both Martys walking for 10 steps, the second shows one of the Martys walking 10 steps and the other stopping after 4. The first video is above and the second is below; additionally, there is a short video showing the code on the devices starting and then the lid closing, then the cameras pans to both Martys: one has stopped and one continues.

Cool down

TimingActivityPossible adaptations
Timing—

Cool Down

Bring learners back together to discuss the learning that occurred. Have groups share their thoughts about code that relies on a person monitoring everything and code that is more autonomous - the code works so it should be able to run reliably without oversight. Encourage every group to suggest their ideas about everyday instances where code is essential for everyday events to run reliably.

Suggested questions you might ask:

  • What would happen if that procedure was only run remotely?
  • What would happen if that procedure was only run locally?
  • Why might it be preferable to have the ability to 'step in' and take remote control of a program?
  • What might need to happen before an individual or organisation feels confident about letting a procedure be more autonomous? (Suggestions here may be significantly varied: cost efficiency, not enough people to maintain, hazardous environments, slow human response times, etc.)

Carry out any end of lesson routines.

Log off devices and clear everything away.

Possible adaptations—
Watch on YouTube
Watch on YouTube

One Marty will stop and the other will continue going. Ask why that might have happened, record ideas on a display. Return to the ideas in the warm-up, which apps keep running in the background on your device. Something like that is happening here. Putting the device that is controlling Marty in standby stops a script's execution, but one Marty doesn't stop. Run the scripts again, if learners want to see it, perhaps they think they missed something or think you did something sneaky. Wait for the walking to stop and then open the heads for both Martys for learners to see the difference.

Both code samples are downloadable in the resources section.

The learners will see that one of the Martys has an additional device, which they will recognise as a Raspberry Pi. The Pi did not go into standby, in fact, the device on the teacher's desk was only relaying the information to the Pi: the Pi will still be on, now. Have learners refer back to the tasks on the first page of their workbook, they may have additional thoughts: ideas about the difference between running scripts on the device in front of them, that directly connects to Marty through wifi, and executing commands via an intermediary device, a device that will remain on and the code will run on (the raspberry pi): what might happen in the real world if an important script were run and then suddenly stopped because someone tripped on a power cable or spilled coffee on a device? Learners may suggest that important systems likely have backup generators, which is likely true, but this might still result in a couple of seconds of downtime, which could be avoided.

Possible adaptations—
Timing—

Time For Practice

Have learners refer to their notes from past lessons to find something interesting to run, that can continue without supervision or control. Once the commands start, the Pi will take care of everything. Have learners detail the potential problems of programs shutting down, if a connected device were to shut down. Have learners create a flow chart for a process, for example an alarm or traffic lights, and why they need to have a local control that keeps them on rather than a remote system that keeps the power on. Also inform that something may be monitoring the system remotely but the code is not solely reliant on a distant device.

Possible adaptations

Support

Have physical flowchart cards available for creation in the workbooks. Have the line of code that is necessary for connection to the Pi copied onto piece of paper to enable easier typing in the device.

Further challenge ideas

Extend

Have learners research past problems that occurred due to a failure of a remote device. Task learners to determine about where the code failed and why. Have learners suggest results if the code had been handled by a local device.

Watch on YouTube