mBot Solar System

Contributed By: Kayoe Stewart


Click here for a forum post that is associated with this classroom project. We would be happy to help you out with any questions you or your students may have. 

mBot Solar System

Simulating the Planets using mBots

The Challenge

As a robotics and astronomy geek, I wanted to see if I could blend the two and use mBots to simulate how the planets in our solar system orbit around the sun. Astronomy is an amazing topic that typically intrigues students because of the wonder and mystery of space. The enthusiasm of the students sometimes makes it easier for teachers to introduce some of the concepts covered in this unit. 


However, a big challenge in learning about space is that we cannot observe outer space firsthand. This aspect makes it difficult as a teacher to demonstrate aspects of our solar system, and beyond, in ways that the students can grasp and visualize. 

One of the fundamentals in understanding our solar system is being able to visualize the relative positions and orbits of the planets. The sheer scale of the solar system makes it challenging to fully comprehend where these objects exist relative to each other. We typically rely on models to help our students understand this relationship. A quick example of one of these models is the standard set up in the gym or outside with some balls of different sizes to represent the planets and string to measure distances. This model is relatively easy to set up but it can be hard to demonstrate how these solar system bodies then move in relation to each other. I thought 'why not use robots to help take this to the next level? The mBot allows me to calculate exactly how the planets move around the Sun. More importantly though, I can simulate how each planet moves compared to the other planets. Plus, I can automate it all so that everything happens with the push of a button. 


We fell in love with this little robot a long time ago because of its low cost and high versatility. Because it uses scratch language (something that many students are already familiar with) it is relatively easy to just jump into the world of robotics with these little guys. 


Whenever I start to work with a new device or platform I first try to figure out two things, what I call the "floor" and the "ceiling". To do this, I ask the following questions: 


  1. How much time do you need to spend playing in order to familiarize yourself with the device and get started?   

    • This is the floor. Something that is intuitive and easy to figure out has a low floor. As the amount of time needed initially and the challenge in getting started goes up so does the floor. 

  2. How versatile is the equipment and how far can you take it? 

    • This is the ceiling. Something that is very versatile has a high ceiling meaning that there is a lot of room to grow. 


The mBot is very easy to just jump into so it has a very low floor. At the same time its versatility gives it a high ceiling meaning it isn't just a one trick pony and can be used to explore much more complicated aspects of coding and engineering. 


We have already professed our affection for these robots in an earlier post titled Mastering the mBot by Makeblock. If you are new to the game please click the link to learn about how to start using the mBot. In this post we will be starting to test the limits to how much you can do with these robots and attempt to address other aspects of the science curriculum. 

Curriculum Connections

As we have said in previous posts, the mBots have many curriculum connections. So many that it would take forever to mention them all. The versatility of these innovative robots results in many different applications with tie-ins to many subjects. We have already talked about how these robots can be used to explore music, language arts, science, mathematics and much more.  In using mBots for something as specific as modelling the solar system we can start to refine our focus on specific units and outcomes in the science and math curriculum. 


Grade 6 Space 

205-2 select and use tools in manipulating materials and in building models 

104-8 demonstrate the importance of using the languages of science and technology to compare and communicate ideas, processes, and results 

300-23 describe the physical characteristics of components of the solar system—specifically, the sun, planets, moons, comets, asteroids, and meteors 

105-1 identify examples of scientific questions and technological problems that are currently being studied 

205-8 identify and use a variety of sources and technologies to gather pertinent information 


Grade 9 Space 

312-4 describe and explain the apparent motion of celestial bodies 

209-4 organize data, using a format that is appropriate to the task or experiment 


Grade 10 Motion 

116-7 analyse natural and technological systems to interpret and explain their structure and dynamics 

213-3 use instruments for collecting data effectively and accurately 

214-8 evaluate the relevance, reliability, and adequacy of data and data collection methods 

325-1 Describe quantitatively the relationship among displacement, time, and velocity 


Grade 7 Mathematics 

GCO: Shape & Space (SS): Use direct and indirect measurement to solve problems 

SCO: SS1: Demonstrate an understanding of circles by: • describing the relationships among radius, diameter and circumference of circles • relating circumference to pi • determining the sum of the central angles • constructing circles with a given radius or diameter • solving problems involving the radii, diameters and circumferences of circles 

The Project

Eight planets is a lot to begin with. So to make things more achievable I started with the four innermost planets (Mercury, Venus, Earth and Mars). The first step in this process was to do some research to determine the following for EACH of the four rock planets: 


– Distance from the Sun 

– The total distance travelled in one orbit around the Sun 

– The amount of time in days it takes to orbit the Sun 


These numbers are used to calculate two very important variables, the speed that each planet travels through space (their velocity) and the path that they each travel through space (their trajectory). In my research, I found a handy table from Northwestern University that breaks down these numbers for all eight planets in our solar system (http://www.qrg.northwestern.edu/projects/vss/docs/space-environment/3-orbital-lengths-distances.html).  In building the code I made sure that it was easy to input these three variables so that most of the code could be left untouched (ie. each time I wanted to adjust the code for the different planets I only had to change these numbers). 


Here are links to the programs for the four innermost planets, a blank program if you want to input the values yourself as well as a screenshot of the code for planet Earth. 

You can see that this program is divided into two sections. The bottom section is where we input our variables that will help us calculate the numbers we need. Using the table linked above, we see that the Earth orbits at 93 million miles from the Sun, the total distance it travels in a year is 534 million miles and it takes 12 months (or 365 days) to do this. The mBots can't handle large numbers in the millions so I moved the decimal place for these distances to the left four places. If you look closely you can see that I defined DistanceFromSun as 9300, DistanceTraveled as 58400 and AmountOfTime as 365 days. By moving the decimal to the right we are working with smaller distances but this is fine because we are only comparing how these planets move relative to each other and these numbers are still proportionally appropriate. In other words, as long as we adjust all of the distances in the same way our results will still work.  

Orbit (calculating the differential)

To begin to direct an mBot we first have to understand how it moves across a surface. An mBot is what we call a differential robot. This means that the two motors can move independently and at different speeds. This differential allows the robot to turn with precision and even pivot. The first step with this is to measure the distance between the two wheels. This will help us compensate for the width of the robot. I measured this to be 130cm. To help calculate how the two wheels operate relative to each other I had to determine what my differential is.
 The formula for this is: 1 minus the width between wheels divided by Distance from the Sun, or in the case of planet Earth 1 - 130 / 9300 (0.01) = 0.99. This number is very close to 1.0 which  would mean that the robot is not going to turn very much, if at all. To help improve the orbits of all the planets, I added a correction factor of two to my calculations which brought the differential down to 0.97.  This number will be used later on when we want to tell our two motors how fast to turn in order to drive in a circle.

Time (calculating the velocity of the planets)

For anyone who is familiar with how to calculate the velocity of an object you know that you really only need two factors, distance and time (V=d/t). We have both of these numbers from our research which makes it easy to run this calculation (Velocity of Earth in millions of miles per day = 58400 / 365 = 160). 

Making the Robot Move

Now that all of the numbers are calculated we can start determining how fast the mBot's motors should be moving to both maintain the appropriate distance from the centre (the sun) and move at the proper speed. To help with this I created a variable called TurnRight. This variable is defined in the upper section of the code. 

If we go back to the concept of differential motors we know that we can easily program our robot to drive in a circle by making one motor go faster than the other. In this case we are setting the velocity of our M1 motor to the full value of the variable we have defined as Speed (VM1 = 160). To make the Earth robot turn I have set the M2 motor velocity to be dependent on the differential or orbit (VM2 = Speed / Differential or 160 / 0.97 = 155).

Turning it on and off

Finally, I wanted to be able to turn this program on and off so that it wasn't running when I didn't want it to. I used the light sensor on the top of the robot as an on switch and programmed the robot to wait until I covered the light sensor with my finger to start. I also used the ultrasonic sensors in the front of the robot as the off switch. This way if I placed my hand in front of the robot it would stop the program.  

The Activity (suggestions for delivery and assessment)

The benefits of such an activity are that it applies to a number of different subjects at a number of different grade levels. Where and how far you take this is completely up to you and how you feel it fits in your classroom. Whatever grade level you are teaching or whatever unit you are on it is important to start by going over the code so that the students understand (at least at a certain level) the inner workings of the program.  


In grade six students are encouraged to use solar system models to help simulate the movement of the planets. Again, this is sometimes challenging because it is hard to visualize the orbits without a more complex model. The advantage of using the mBot model is that we can focus more on the relative motion of the planets compared to each other and not just on their relative distances from the sun. This leads to a more realistic and complete simulation of the planetary orbits and better comprehension. 


As a starting point to this unit, grade six classes are also encouraged to create wall charts and tables listing the various bodies and their key characteristics. This model can be an excellent application of such information as the students can take the data they have researched such as orbit lengths and use it in the simulation. 


In grade nine the students are required to better understand the apparent motion of celestial bodies. Again, they are to demonstrate this though models but in this upper grade they are now not only exploring the rotation of these objects but their revolution (orbit around the sun). 


If you are using this activity in either grade six or nine I would recommend that the students  first run the program for Mercury to see just how the robot and the code works. This initial introduction gives you and your class an  opportunity to dissect the code in order to better understand it's bits and pieces. I have included programs for all four planets but, if time allows, I would suggest using the blank program also provided and challenge the students to input the necessary values that they researched on their own. Based on these values, students  can predict the path of each "planet". This can be done either relative to the other orbits or numerically based on their observations of Mercury's orbit.  After formulating predictions they can then experiment by running the code. Keep in mind that Mercury will need roughly 11 feet of space which means that when it's time to move on to the other planets you will need to move to a larger area like the gymnasium. 


Because it's kind of hard to imagine tiny robots as massive, round bodies orbiting in space, I used balloons to represent the planets. Balloons were a fun and easy choice because I was able to match the true colour of the planets and inflate them to the proper relative size. Because balloons are nice and light, it was easy to stick them to the robots with a bit of tape and not have to worry about them interfering with the simulation. Challenge your students to get creative and use many types of recyclables (as long as they're not too heavy) to build models of the four rock planets that can be attached to their robots. As an educator, assess content knowledge because, in order to accurately represent the planets, you have to know a thing or two about what they look like (size, colours, composition, atmosphere etc.). 


If your school is lucky enough to have four mBots, each robot can be programmed as a different planet to run at the same time. This is ideal and makes it easy for your students to observe the timing of all four orbits. Using tools such as stopwatches, they can be challenged to record the time it takes for each of the "planets" to revolve a certain number of times. If you only have one mBot at your school the students can still tackle the same challenge but by running one robot (and one program) at a time. In both of these cases the students will be able to compare each robot’s orbit to the actual orbits of the planets. For example, Mercury only takes three months to make one trip around the Sun which is one quarter of the time it takes the Earth. If we have done our calculations and research correctly we should our robots mirror this. Following this you can challenge them to represent their results pictorially or graphically to help summarize the information. 


If you are incorporating this activity in your grade 10 motion unit you can focus more on the formulas used to calculate the speed or velocity of each planet. Even though the numbers used in this simulation are not necessarily the actual measurements for distances (due to us adjusting the decimal place), the relationship between the four robots is bang on compared to the relative velocities of the four planets. As an added experiment, students can calculate the actual velocities of the planets using the real numbers for each. They can then compare these velocities to the velocities they are generating in their program. Again, if we are using the correct values, the numbers generated by our program should mirror the actual velocities of the planets. 


This activity also has a number of connections to the math curriculum in middle school. The obvious tie-in is to the grade seven classroom where the students have to demonstrate an understanding of circle geometry. This includes knowing the relationship between a circle's radius, diameter and circumference. This activity is an excellent application of these concepts and makes for a perfect opportunity to assess comprehension of these relationships. 

Extensions and Modifications

We have only simulated the orbits of the four innermost planets. If time allows, and you want to take this activity a bit further, your students can work together in figuring out the key measurements for the four gas giants. In our original design of this model Mars' orbit has a diameter of just under 60 feet. Therefore, in order to expand this to the outermost planets you will have to make some adjustments to the code so that the orbits for the rock planets are proportionally smaller. When I expanded to include the gas giants I had to do the following: 

- move the decimal for my distances one more place to the left (e.g. 9300 to 930 for Earth's distance from the Sun) 

- changed Time from days to months (365 to 12 for Earth) 


The grades six and nine curriculums also require an understanding of the relative motion of the Moon around the Earth. As an added challenge, students can extend this activity and attempt to simulate the movement of the Moon with their mBots. To do this, students would simply have to research these key values for the Moon and have the program calculate the rest for them. This can even be carried over to the lunar systems of other planets such as Jupiter and Saturn that have multiple major moons. 


As awesome as the mBot is, not everyone has one. Because of this, I also created a LEGO Mindstorms EV3 project that does the same thing. If you only have access to LEGO kits here is a link to the Mindstorms project which includes programs for all four rock planets.  


One important piece of this activity is making sure that you are allowing for enough space for the robots. In running the program for Mercury you only need  to allow for a diameter of roughly 11 feet (small enough for a classroom). However, when you run the program for Mars you are looking at about 55 to 60 feet of floor space. With this in mind, you will need a large space like the gymnasium to do the entire simulation. With Mercury only needing 11 feet of space though, you can start in the classroom before moving to the gym. Spending the first bit of this activity in the classroom will give you some focused time to dissect the code and better understand how everything works. Running the simulation for Mercury in the classroom also can lead to discussions on what differences you may see with the other three programs. Students can measure the diameter and radius for Mercury and make predictions for the other planets (based on their research). At the same time, they can predict the timing for the remaining three planetary orbits based on the time it takes Mercury to complete one circle. This time in the classroom can also be used to prepare the other robots and get ready for the larger simulation.   


One of the most noticeable drawbacks of the mBot is that the wheels sometimes do not have consistent traction. A combination of a lightweight robot, motors that can sometimes be temperamental and low batteries all can lead to issues with the accuracy of your program. In this case, I always made sure I was using fully charged batteries and that none of my motors were loose. This helped me make sure that the robots weren't going off course too much. Even with doing this though, I still noticed some deviation with the robots at times. It is important to mention this to your students to prepare them for any minor differences. It would also be worth your while to have some back up batteries and tools on hand so that you can make corrections on the fly.  


Our hope is that as teachers incorporate this activity in their classroom they consider how to really make it their own. I have presented it in such a way that anyone can incorporate it easily into their classroom but we have also left it open for improvements and adjustments. We would love to hear from you and your progress on implementing this activity in your classroom. In addition to this, if you have gone so far as to make modifications, add on extensions, or even connect it to another part of the curriculum we would love for you to share.   

Happy playing!

Kayoe Stewart

Kayoe is a lover of all things STEM. He has been working in science education for 16 years with the  past 10 of those years being at Science East heading their robotics and coding programs. Recently, through a partnership with Brilliant Labs, he has been working on building content and capacity for both organizations.