---
title: "Getting Started with Servo Motors and the Micromelon Rover"
date: "2022-08-03"
categories: ["All", "Getting Started"]
tags: ["Servo Motors", "Extension"]
excerpt: "Learn the basics of how to extend your rover with servo motors."
featuredImage: "/images/resources/getting-started-with-servo-motors.png"
---

![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1659567094500-HT33NXMCL4VB1UGYZ37Y/image10.png)

Servo motors are a type of direct current (DC) motor which is a very common type of motor you can find in lots of electronics around your home. Servo motors are very good at making precise movements since they contain a built in controller which ensures the output speed is more reliable. The driving motors on the sides of the rover are freely spinning DC motors. This post will be a brief introduction to how servo motors work, what are the most common servo motors, where to buy them, and how to use them with the Micromelon Rover.

## **What is a servo motor?**

A servo motor works by using a controller to set the exact position or speed it needs to stay at. There is a small device (the control circuit) that takes an analog input and determines the motor’s position. These motors are more focused on giving you precision over speed/power, and are generally quite weak in terms of torque.

![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/b2c5d0f2-f845-4d05-9312-520ef94fe7b1/image3.png)

Servo motors are useful for robotic arms, DVD player trays, cameras, as well as many other devices that need an accurate and/or gentle motor movement.
This kind of servo is called a positional rotation servo motor, and is by far the most common type of servo motor. You can set the exact amount of rotation for the motor in terms of degrees from -90 to 90, giving you 180 degrees of rotation.

The other type of servo motor is called a Continuous Rotation Servo motor which can spin freely much like a regular DC motor.

![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/31ea95e1-f32a-4fb3-befa-a54a9ae2c04f/image7.png)

Setting the speed of a regular DC motor is fairly challenging because you need extra components and circuits to do so. You can read more about these circuits called H-Bridges. A continuous rotation servo motor has all of this functionality built into it already, which is why it is used over a DC motor as it makes it significantly easier to use.

## **Buying servo motors**

There are many different stores to buy servo motors from. With electronic components it is always highly recommended to look into the supplier you are buying from to make sure you do not buy something of bad quality. We at Micromelon recommend you do your own research into reputable suppliers before purchasing equipment as prices and quality can vary significantly. Some examples of where these parts can be found are Core Electronics, Jaycar, RobotGear, Sparkfun, etc. Some servo motors are stronger than others so it's a good idea to get metal geared ones where you need a stronger, longer life motor and to prevent wasted components.

You also have to be careful that the motor you are buying meets the electrical specifications of the rover. The rover servo connectors are 5V which fits within the specifications for most hobby servo motors, and can provide around 1A of current per motor. The most common hobby servo we recommend is the MG90S 9g servo motor with 180 degrees of rotation and the larger MC996R 55g servo motor with 120 degrees of rotation for when more torque is required.

We’ve provided some product links below of motors we have tested and used with our Rovers.

[https://www.jaycar.com.au/arduino-compatible-9g-micro-servo-motor/p/YM2758?pos=3&queryId=c2ebbc26559d7559d5f5e7caf8f29784&sort=relevance](https://www.jaycar.com.au/arduino-compatible-9g-micro-servo-motor/p/YM2758?pos=3&queryId=c2ebbc26559d7559d5f5e7caf8f29784&sort=relevance)

[https://core-electronics.com.au/9g-micro-servo-1-6kg.html](https://core-electronics.com.au/9g-micro-servo-1-6kg.html)

#### **A note about servo ratings**

![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/443d3098-2e2a-421a-913c-59c799fcd566/image6.jpg)

The servos that we have suggested for light duty applications are called 9g servos. A 9g servo simply means that the motor itself weighs 9 grams. These motors typically give you something around 1.6kg*cm of torque. Which is to say they can lift a 1.6kg weight, at a distance of 1cm. The longer this distance, the weaker the output force will become. This relationship is inversely proportional, so as the distance from the motor doubles, the output force is halved. (E.g. at 2cm this motor will only lift up to 0.8kg of weight) This is usually the most important specification to consider when shopping for a motor as you want it to be able to comfortably supply enough force for your application.

This specification is usually denoted as “stall torque” which means that the motor cannot physically lift or move anymore when that weight is on it. Exceeding the rated torque is never a good idea and can drastically reduce the lifespan of your motors.

### **Connecting Servo Motors to the Rover**

On the back of the Micromelon rovers there are two servo ports that you can servo plug motors into. Note that servo motors need to be plugged in the correct way around. The back of the rover has an icon that shows which way they should plug in. On most motors the red wire means power or +, the brown wire means ground or - and the yellow wire means signal or S. On the right is an example of something we’ve made with servo motors!

## **Using Servo Motors in the Micromelon IDE**

![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/14aca424-96db-4356-b7ad-6479ca039cd3/block.png)

To use a servo motor with the Micromelon IDE, you have to access the “Extension” section on the left of the user interface. (UI)It is here you can find all of the useful blocks that will interact with servo motors.

These blocks allow you to set the position of servo motors in terms of degrees. The position you see when you enter a certain value for degrees will depend on the servo motor you are using.

![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/17965975-2fa8-466a-ace0-5dfe1c944e0a/dictionary.png)

For using Python the relevant functions can all be found in the functions library for Servos. These all work the same way the blocks do outlined in the more detailed description below.

#### **Blocks**

![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/95e38562-ed2e-4010-ad80-35ecc8647471/image8.png)

#### Python

```
`Servos.setBoth(45, 30)`
```

#### Description

This block allows us to set the exact position or speed of both the servos at the same time. Usually this is measured from the right horizontal test this out for your specific servo motor!. This block will only take inputs from -90 to 90, representing a range of servo motors with 180 degrees of freedom. It can go slightly higher than that from my testing, where -80 was closer to -90 in my experience, but generally it works out.

You can use the exact same block for Continuous Rotation Servos, but they scale up in speed with the same input. This means 90 is maximum speed one way, and -90 is maximum speed the other way. The real speed produced depends on your specific servo motor.

---

![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/f07c3cef-db28-473b-80ca-c21e5fdcfca1/image1.png)

```
`Servos.left(30)`
```

This servo motor block works functionally the exact same as the block above it. It allows you to move only one servo motor in the scenario where two are plugged. You can use the drop down menu by clicking on it. You can input a number, or one of the data blocks.

---

![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/43eb04d8-0c88-457e-aaf6-1ebf250d49fc/image11.png)

```
`Servos.read()`
```

This block allows us to utilize what it knows about the servos position. This block gives the value of the servo positions in degrees, and allows you to substitute that value into other blocks.

## **Wrapping Up**

Now that we’re familiar with some of the key concepts behind servo motors, the blocks, and the code to use them. We’ve got a bunch of activities you can try and extend with servo motors now that you know how to use them!

### Related Posts

          Resources

      [

![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1639455538805-9NI7CPKR7IYG6D4RBKAN/high+quality+sumo.png)

  ](/resources/creating-a-sumo-unit)

	[All](/resources?category=All)

                [Creating A Sumo Unit For Your Digital Technologies Class](/resources/creating-a-sumo-unit)

	[All](/resources?category=All)

How to run a sumo unit in your digital technologies classroom.

                [Read More &#8594;](/resources/creating-a-sumo-unit)

	[All](/resources?category=All)

      [

![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1637464845856-BBPD7GTIIHHOSJCFORWF/the+ultrasonic+sensor.png)

  ](/resources/ultrasonic-sensor)

	[All](/resources?category=All), [Guides](/resources?category=Guides)

                [The Ultrasonic Sensor](/resources/ultrasonic-sensor)

	[All](/resources?category=All), [Guides](/resources?category=Guides)

Learn all about the ultrasonic sensor!

                [Read More &#8594;](/resources/ultrasonic-sensor)

	[All](/resources?category=All), [Guides](/resources?category=Guides)

      [

![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1625616494179-LZHZP5MUA0E0MQKEB7HC/cropped+image+4.png)

  ](/resources/year-7-digital-tech-at-st-peters)

	[All](/resources?category=All), [Customer Stories](/resources?category=Customer+Stories)

                [Case Study: Year 7 Digital Tech at St Peters Lutheran College](/resources/year-7-digital-tech-at-st-peters)

	[All](/resources?category=All), [Customer Stories](/resources?category=Customer+Stories)

See how Meg Foley at St Peters conducted a challenge for their Year 7s using Micromelon.

                [Read More &#8594;](/resources/year-7-digital-tech-at-st-peters)

	[All](/resources?category=All), [Customer Stories](/resources?category=Customer+Stories)

      [

![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1637464675848-K9YEOYK65IWRFRX4QJ1R/blog+header+image+.png)

  ](/resources/robot-simulator)

	[All](/resources?category=All), [Getting Started](/resources?category=Getting+Started)

                [Getting Started With The Robot Simulator](/resources/robot-simulator)

	[All](/resources?category=All), [Getting Started](/resources?category=Getting+Started)

How to get started with the Micromelon Robot Simulator.

                [Read More &#8594;](/resources/robot-simulator)

	[All](/resources?category=All), [Getting Started](/resources?category=Getting+Started)

      [

![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1626837419969-WBB4D85KQIXSOP750N5M/resized+banner+%281%29.png)

  ](/resources/getting-started-with-the-micromelon-rover)

	[All](/resources?category=All), [Getting Started](/resources?category=Getting+Started)

                [Getting Started With The Micromelon Rover](/resources/getting-started-with-the-micromelon-rover)

	[All](/resources?category=All), [Getting Started](/resources?category=Getting+Started)

Crash course on basic rover function, how and what to program and starter activities to attempt.

                [Read More &#8594;](/resources/getting-started-with-the-micromelon-rover)

	[All](/resources?category=All), [Getting Started](/resources?category=Getting+Started)

      [

![](https://images.squarespace-cdn.com/content/v1/60a43bf842d7b601064a8828/1622691207784-0X6JV7RYRQXZAFRG712S/pisonescape.png)

  ](/resources/prison-escape)

	[Activities](/resources?category=Activities), [All](/resources?category=All)

                [Activity: Prison Escape](/resources/prison-escape)

	[Activities](/resources?category=Activities), [All](/resources?category=All)

Learn branching and iteration using the colour sensors and motors.

                [Read More &#8594;](/resources/prison-escape)

	[Activities](/resources?category=Activities), [All](/resources?category=All)
