Introduction

Aims

In this part of the activity we will:

  • Look together at how the motor works
  • Write a program to make the motor move

Learning outcomes

Learning outcome
Mechatronics Understand the high level principles of how a servo motor works
Programming Write a program to command the motor to move

Preperation

Equipment required

Equipment item Quantity
Assembled volume meter 1
Laptop/PC 1

How is the motor moving

This video shows how servo motors work! - If youโ€™re interested itโ€™s well worth a quick watch. (You can watch it now or later on - up to you!)


Activity

Note

  • You will need to add the kitronik-robotics-board extension to this code project
  • An extension is a code library that allows you to use additional functionality (such as controlling the robotics board)

Pic Pic

A simple program to make the motor move

We want to use the buttons to move the motor into different positions. To do this lets write a program

  • Write the program below
  • Download it to the micro:bit
  • Check that the motor is moving correctly
Blocks Python
Pic Pic

Important Questions

  • What do you observe?
  • Which way is the motor rotating when you push the buttons?
๐Ÿ‘‰๐Ÿพ Answer
  1. When you push the button for zero degrees it should move clockwise
  2. When you push the button for 180 degrees it should move anticlockwise