• raspberry pi
  • National Centre for Computing Education logo

Robotics With Raspberry Pi: Build and Program Your First Robot Buggy

Build and program your first robot buggy using a Raspberry Pi, learning how to connect motors, add sensors and write algorithms.

7,294 enrolled on this course

Several images representing parts of the course, including a Raspberry Pi, an ultrasonic distance sensor, a robot buggy, and electronics
  • Duration

    3 weeks
  • Weekly study

    2 hours

Learn robotics by building a robot buggy and controlling it with a Raspberry Pi

On this course from the Raspberry Pi Foundation, you’ll build a robot buggy controlled by a Raspberry Pi.

You’ll start by learning how to connect motors to your Raspberry Pi, and how to write a Python program to control them to move your buggy. You’ll move on to adding sensors to your robot and writing algorithms that use the inputs from these sensors, giving your robot the ability to follow lines and avoid obstacles.

You’ll examine the wider context of modern robotics, and think about how robotics affects society.

Download video: standard or HD

Skip to 0 minutes and 3 seconds How can you build your own robot using a Raspberry Pi computer? How can you program the motors of a buggy in Python? How can you design an algorithm so your robots avoid obstacles and follows lines? This free course will teach you how to make your own robot buggy. You will learn about physical computing and programming input and output components, such as motors and sensors. And you will consider the effects of robots on society. You’ll also take part in practical activities to design and customise your buggy. This three week course contains peer led discussions, trainer interaction, and feedback on your knowledge as you progress. You can learn whenever and wherever you want.

Skip to 0 minutes and 43 seconds So whether you’re a teacher with students of your own or simply curious about physical computing with a Raspberry Pi, this course will help you build and program your first robot buggy. Sign up now at rpf.io/robotics.

What topics will you cover?

  • The GPIO Zero Python library, and how this can be used to interact with input and output components
  • The construction of a simple robot buggy
  • How distance sensors work
  • Obstacle avoidance algorithms
  • Line sensors
  • Line following algorithms
  • The effect of robotics on society

Learning on this course

On every step of the course you can meet other learners, share your ideas and join in with active discussions in the comments.

What will you achieve?

By the end of the course, you‘ll be able to...

  • Describe the advantages of using robotics to teach computer science
  • Produce a robot buggy that can move in particular patterns, avoid obstacles, and follow a line
  • Develop suitable algorithms for your robot depending on the task
  • Demonstrate how to control a variety of components using the GPIO Zero Python library
  • Discuss different uses of robotics and the components that they may use

Who is the course for?

This course is for people with little or no experience with physical computing, who want to create their first robot.

Ideally you should have some basic familiarity with Python, for example from our Programming 101 course.

It is particularly well-suited for teachers delivering lessons up to GCSE level or equivalent, who are looking for engaging programming activities for their classrooms.

What software or tools do you need?

This course requires you to have the following:


  • Raspberry Pi 3B, 3B+, or 4
  • Motor controller board
  • Two 3V–6V DC motors
  • Two wheels
  • Ball caster (unless using more than two wheels)
  • An Ultrasonic Distance Sensor (UDS)
  • Two resistors for splitting the voltage if the UDS is 5V (e.g. a 1200 and a 2200 Ohm resistor)
  • Two line-following sensors
  • Jumper leads (female-to-female and male-to-female) or wire
  • AA battery holder (for four AA batteries)
  • Four AA batteries
  • A USB powerbank (to power the Raspberry Pi)
  • Soldering iron and solder
  • Wire strippers
  • Scissors
  • Screwdriver
  • A small cardboard box for the chassis (can be plastic, wood, metal, etc.)
  • Black tape and white paper or card (to make a track with a black line for the line-following robot)

The hardware components and tools are listed in this document. This list includes suggested models, types and pictures of each component, although alternatives are also available.


  • The latest version of the Raspbian operating system
  • An IDE of your choice

Additional extras

  • Adhesives (duct tape / electrical tape, putty, glue, etc.)
  • Cable ties or velcro straps
  • GPIO reference card

Who will you learn with?

Alex is a Learning Manager at the Raspberry Pi Foundation and Computer Science teacher. When not coding, he enjoys table tennis, gaming and going for walks in the woods.

Nina manages Raspberry Pi's translation community to make our learning resources accessible to anyone, regardless of the language they speak.

Who developed the course?

Raspberry Pi Foundation

The Raspberry Pi Foundation works to put the power of digital making into the hands of people all over the world, so they are capable of understanding and shaping our increasingly digital world.

National Centre for Computing Education

This course is part of the National Centre for Computing Education (NCCE). Funded by the Department for Education and partners, we aim to change the way computing is taught in schools across England, and enable more young people to benefit from studying this important subject.

If you are a teacher in England you can get free upgraded access to this course, and use it towards NCCE certification. To do this, you must join the course through the Teach Computing website

Endorsers and supporters

supported by

Google logo

Learning on FutureLearn

Your learning, your rules

  • Courses are split into weeks, activities, and steps to help you keep track of your learning
  • Learn through a mix of bite-sized videos, long- and short-form articles, audio, and practical activities
  • Stay motivated by using the Progress page to keep track of your step completion and assessment scores

Join a global classroom

  • Experience the power of social learning, and get inspired by an international network of learners
  • Share ideas with your peers and course educators on every step of the course
  • Join the conversation by reading, @ing, liking, bookmarking, and replying to comments from others

Map your progress

  • As you work through the course, use notifications and the Progress page to guide your learning
  • Whenever you’re ready, mark each step as complete, you’re in control
  • Complete 90% of course steps and all of the assessments to earn your certificate

Want to know more about learning on FutureLearn? Using FutureLearn

Learner reviews

Learner reviews cannot be loaded due to your cookie settings. Please and refresh the page to view this content.

Do you know someone who'd love this course? Tell them about it...