Todays goals:

  • Research constructions & balancing medium
  • Research related software solutions
  • Research on possible sensors
  • Research and test of possible motors and wheels

The Plan

In this session we will do some research into related work and projects, to provide us with a solid knowledge base for constructing Max and making him able to balance on a ball. As can be seen in the plan, in Table 1, we are planning to conduct research in four areas:

Project plan for week 21. Table 1: Project plan for week 21.

  • Body Construction
  • Software Components
  • Sensors
  • Motors and Actuators

At the end of this session, we hope to be ready for constructing a ball balancing robot in the next session.

Research constructions & balancing medium


We need to figure out the best way to make Max N00b be able to balance on a ball. For this, we need a sturdy construction with wheels for keeping Max staying on the ball. However, we also wish to make Max drive around while simultaneously balancing on the ball which means he needs at least 3 degrees of freedom; so Max has to be able to drive forwards and backwards (1 degree), turn left and turn right (2 degrees) and move sideways left and right (3 degrees).

For this, we need to research what construction constitutes a strong, rigid body while at the same time provides the necessary degrees of freedom. Also, we need to look into what kind of balancing medium we will use for Max to balance on. Here we need to figure out the shape, size and surface material that can help Max balancing. Finally, we will look into which factors that might affect balancing abilities for objects.


This experiment will be about looking through research about, and get inspiration from, various ball balancing robot constructions created by other researchers. We will also look into how one can utilize the concept of center of mass for balancing purposes.


None, as we are researching physical constructions.


Looking into various research, we have found that the main type of ball balancing robots is a 3-wheeled construction, e.g. as seen here, here and here. However, we also found a 2-wheeled ball balancing robot made out of NXT-lego, as can be seen here. We will now briefly discuss the robot types.

2-wheeled ball balancing robot

Calling it a 2-wheeled balancing robot might be a bit inaccurate as a third wheel is in fact used on the robot. However, we argue that since only two of the three wheels are motorized, it is a fair definition. This type of robot has most of its weight distributed onto the third wheel, making the robot’s center of mass be on that wheel which means the other two wheels will have less friction compared to an evenly distributed weight on all three wheels. This means the people in the video can use regular wheels for their robot. If the weight was evenly distributed, the friction could cause trouble when moving the ball around, consequently making the robot fall down. One of the issues with this type of robot for us, is the fact that using only two motorized wheels can only cause two degrees of freedom, where we need three.

3-wheeled ball balancing robot

This type of robot, as can be seen in the videos, has three evenly distributed wheels. This means every wheel supports ⅓ of the robots weight. As discussed in the previous section, limiting friction is one of our main objectives to make sure our robot will have a good, stable balance. We want to achieve several degrees of freedom, so the wheels have to be facing several directions which causes friction. If we used regular wheels, the friction could cause issues such as making the ball not move around (since one motor might not be able to overcome the inertia from the two other wheels) or make the robot fall off the ball.

Overcoming this friction, however, is doable. As can also be seen in the videos of the 3-wheeled robots, special wheels are being used. These, called Rotacaster wheels, can be used. We will go into further detail with the various wheel types in a later session report. However, by using rotacaster wheels and placing them evenly, it is possible to provide the three degrees of freedom that we want.

Center of Mass and how it affects balance

The center of mass (often also known and used as the center of gravity, unless you study extremely large objects) is the point where the average of all of an object’s mass is concentrated. If we want to balance something, we have to make sure that the center of mass is either directly above or below the base of support; i.e. the pivot point. If our center of mass is below the pivot point, we can see our robot as being stable. This means we can push the robot a bit and it will maintain its balance. However, if our center of mass is above the pivot point, we have an unstable construction, and a small push will make the robot fall over unless the pivot points moves around.

We can use this to understand how our robot might keep perfect balance because we now know that a center of mass below the pivot point gives improved balance.

Balancing objects

When creating a ball balancing robot, we need to consider what kind of balancing object we will use for the best balance performance. As such, we need to consider the following factors that have an impact on the robot’s performance:

  • Object size
  • Object shape
  • Object weight
  • Object viscosity
  • Surface material

We will now explain why these factors are important.

Object Size

Knowing how the center of mass/gravity works, we realize that the size of the balancing object is important to know. If we have a large object, it would require a larger construction of Max if we want to keep the center of mass below the pivot point.

Object Shape

This point is quite self-explanatory. If the balancing object is perfectly round, it will provide less friction between the object’s surface and the plane on which it rests, and also between our wheels and the object. Also, the center of mass will always be aligned to the center of the balancing object, which makes it easier for Max to balance on it.

Object Weight

The weight has an impact because of how mass affects acceleration and deceleration – also known as force. If we have a very heavy ball, it requires much force to accelerate it – which also means it will require much force to decelerate the ball. This means it will be difficult to make small adjustments for maintaining Max’ balance on such a ball. However, if we have a very light ball, these same small adjustments might provide too much force causing an extreme acceleration which can make Max fall off the ball. This means we have to find a balance.

Object viscosity

The viscosity of the object is also an important factor. Max’ balancing performance will be affected if the object is either very rigid or very soft which we have to take into account. If the viscosity is like that of a half-inflated balloon, a lot of friction will be created between the balancing object and the plane on which it rests, as well as between the object and the wheels on Max.

Surface Material

The surface material will also affect how we should construct Max. If the surface provides a good grip for the wheels, it will also cause more friction for the wheels not rotating with the object’s rotation. It can also cause more friction between the object and the plane on which it rests. However, the surface material can also be too slippery for the wheels we choose, making Max e.g. not capable of balancing on the ball (unless he has a very low center of mass which in theory would make him unable to fall off because of no friction) or perhaps not able to control the ball’s rolling direction.


For figuring out the best control architecture for programming Max into being a ball balancing robot, and at the same time drive over a tightrope, we will first discuss Maja Mataric’s three definitions of approaches (Deliberative, Reactive and Behavior-Based) for control as seen here. We will then look into how the approaches relate to what we know from previous lessons from the course, and then choose the approach which seems most applicable.


None other than discussing the possible theories of approaches in accordance to previous lessons.


None needed, since this exercise is based solely on theory and earlier lessons.


Deliberative Approaches

Deliberative is an approach where every plan or move of the robot is hard-coded into the actual program. This is for performing specific pre-planned action, such as driving backwards for 1000 ms followed by turning right for 300 ms. Since Max needs to react to real world changes, such as a slight change in posture, it means that a more reactive approach seems more favorable.

Reactive Approaches

This approach favors sensor input to be directly computed for outputs to the actuators. In other words the actuators constantly reacts and responds to the sensors’ inputs accordingly. The actuators will therefore be directly connected to the sensor, which is favorable when using controls such as following lines, like the PID-controller we have experimented with in earlier lessons, or, in our case, keeping balance on a ball. However this approach alone is not favored for our project, since Max must act differently depending on the current situation e.g. must ignore reactions of movement if he is falling. Another reason is that Max must also be able to receive commands and perform pre-defined actions.

Behavior-Based Approaches

A behavior-based approach, is a set of behaviors with certain priorities which will be performed according to given sensor and internal data. A solution for using the behavior-based approach for our project is to make a set a of behaviors and prioritize them in according to importance. The top priority will be keeping Max balanced, second priority is to make Max move and turn at a desired direction, the third priority behavior is to keep Max aligned with a line, and the last priority is getting Max moving to a waypoint and stop.

We argue that the most applicable approach is the behavior-based approach because of its hierarchical structure, where it runs a behavior with more planned actions, such as getting to a waypoint and stop, and can be overridden by higher prioritized behaviors that are more reactive, such as keeping balance.

Research on possible sensors


To make Max balance on a ball we will need some sensors that he can use to orient himself to. In this session we will discuss the different sensors we have used in previous exercises and if we should try some new ones. We will go through all the sensors we find usable for our purpose.


The following sensors are all sensors that we have found applicable for providing Max with the needed data to balance on top of a ball.


Gyro sensors, as the one found here, can measure the rotation along a single axis, which makes it possible to calculate the current angle in which Max would be along in that axis. Because the data from the gyro is relative to only Maxs own angle, it means the data provided will be unaffected by environmental factors such as surface conditions, lighting etc., only the gyros own technical limitations can affect the validity of the data, which in this case would be drift as discussed in lesson 5. Since the gyro only covers a single axis of rotation, Max would have to implement at least two sensors, to cover both axes on which Max could fall.


An accelerometer, like the one seen here, can measure its acceleration in three axes which can be used to calculate its relative position to earth. This means it can provide the needed data to make Max capable of calculating the needed actuation to remain balanced. Just like the gyro the accelerometer is not affected by environmental conditions, only its own technical limitations, which is its inaccuracy in measurement. An example of this inaccuracy can be depicted as the force on the z axis that could be 9g ± 0,2g, where the 0,2g is the inaccuracy.

Ultrasonic range & IR range finder

An ultrasonic range finder, as seen here, and Infrared range finder, as found here, could be used by hanging sensors out over one of the sides of Max in both his X and Y axis resulting in the distance to the surface. This data can then be used to calculate the correction needed to keep him balancing, similar to what was done in one axis in lesson 5. Unlike the previous sensors mentioned above, these range finders will be affected by the surrounding environment e.g. light and surface texture.

Since we also want Max to be able to “walk the tightrope”, we need him to be able to follow a line. We will now look into sensors that we suspect can be used to follow a predefined line.


An infrared temperature sensor, or a pyrometer, can be used to measure temperature at a distance. We believe that this can be used to follow a black line on a white surface if there is enough light in the room to make the black line hotter than the white. It could also be possible to make a track with a heated line in it. The NXT variant of a pyrometer, here called a Thermal Infrared Sensor (TIR-sensor), can be found here. One problem with using the TIR-sensor is caused from its use of a light beam on the measured area that will expand according to the distance from which the measurement origins. This can give some problems if it can’t track the temperature precise enough.

Camera tracking

A NXT camera has been developed that can track up to 8 objects and follow a line. It can be seen in action here. With this sensor we will be able to track a line at a distance and at the same time be able to track an object of interest. Because this sensor uses picture recognition it will take a lot more CPU time than the other sensors which just returns some numbers. This could be a challenge because a self balancing robot has to make small correction all the time to keep its balance.

Light sensor, Color sensor and Light sensor array

We have in some of the previous lab session experiments examined both the Light- and Color-sensor. Our notes on the Light sensor can be found here. The Color sensor can be found here. The problem as described in our notes is that the sensors have to be mounted very close and perpendicular on the surface. This can make it difficult to make a good construction of Max since a balancing robot will most likely never stand still, causing small changes in the distance between the Light sensor and the surface.

The Light array sensor is made of 8 small light sensors placed on a line. This makes the robot highlig capable of following a line if the sensor is mounted very close to the surface. The sensor and some videos of it in action can be found here.

Electro Optical Proximity Detector

This sensor is able to make calculations of the distance to an object precise We can use it if the ball is balancing on a stick or something else with a noticeable height difference. This sensor uses its own light source which makes it tolerable for environmental conditions. The sensing area has the same problems as the TIR-sensor.


The compass sensor is a digital compass which measures the angle in 360 degrees with 0 degree being north. We can use this to determine the orientation of the robot which can be helpful if we only have one sensor for line tracking and we have to turn Max to a certain position.


None needed


Based on our research we have chosen two sensors we will test for making the robot balance. We will make some test with the accelerometer and the gyro to see which works best or if we need to combine the sensors. For the tracking part we hope to get our hands on the NXT camera, if it is possible to get the TIR-sensor we will like to make some tests with that as well.

Research and test of possible motors and wheels


The plan for researching possible motors and wheels consists of searching for comparisons of LEGO motors and then supplementing that with a series of small experiments, to test the areas that we feel might be insufficiently covered by others.

The motors will be tested on: Speed/Power; Consistency in action and Backlash, which are three important criteria for our motors. Speed/Power is needed to be able to correct for rapid changes in posture. Consistency is needed to be able to get a steady balance that does not over- or undershoot the correction because of inconsistency in the motors performance. Lastly, Backlash in the motors will soak up some the movement made to correct balance, meaning that the more Backlash a motor has, the more it will have to correct before an actual adjustment is made, resulting in unstable balancing abilities.


When searching for a comparison on LEGO motors, many results show up that refers to a very extensive comparison made by Philippe Hurbain, which can be found here.

This made an excellent base for our experiments, but we wanted to supplement it with a couple of experiments: First we wanted to compare the power of the motors in a more realistic and tangible way, since how many Ncm (newton centimeter) of torque a motor has and what this actually means, might be a bit incomprehensible. Second, we wanted to make a simple speed comparison test that is not measured directly on the motor shaft. Third, we want to test how consistent the motors are in their output, and final, test the amount of backlash that is in the motors.

We have at our disposal four kinds of lego motors that we can utilize as shown in figure 1.

RXC 43362, NXT Servo, EV3 Medium, EV3 Large. Figure 1: From left to right are: RXC 43362, NXT Servo, EV3 Medium, EV3 Large.

First we will perform experiments testing the power of the available motors by counting the number of rotations the motor makes when it also has to turn an unplugged NXT Servo. This is done to simulate the resistance that might occur when having to “pull” up Max when falling. The setup used can be seen in Figure 2.

LEGO Motor performance test setup. Figure 2: LEGO Motor performance test setup.

As seen in figure 2, annotation A is a LEGO Mindstorm rotation sensor as the one described here. This will count the number of rotations on the servo. To add an amount of realism to the test we made the motor drive a rubber wheel that is pressed firmly against another wheel simulating the motor wheel pressed against the ball, annotation C. Annotation B is the NXT Servo attached to the same shaft as the rotation sensor adding resistance. Annotation D is the motor being tested, which in this case is a NXT Servo, this is then replaced with the other motors, which are attached to the same shaft to maintain similar circumstances when testing. The test itself consist of every motor running over a period of 5 min and then returning a value representing the total number of rotations made.

The results from the power performance test, sorted by performance are as follows:

  • EV3 Large: 8424 Rotations
  • NXT Servo: 7734 Rotations
  • EV3 Medium: 6046 Rotations
  • RCX 43362: Unable to overcome the resistance from the NXT Servo, even after getting help with overcoming the initial inertia.

Afterwards, we performed a speed test, which was done as the power test. However, we removed the resistance that was provided from the NXT Servo. The results from the speed performance test, sorted by performance, are as follows:

  • EV3 Medium: 16236 Rotations
  • RCX 43362: 12634 Rotations
  • EV3 Large: 11472 Rotations
  • NXT Servo: 10837 Rotations

Thirdly we performed a consistency test, which is done by using the same setup as before, without the resistance motor attached, and then driving the motor for a period of 30 sec, ten consecutive times with complete stops in between. With this, we will be able to calculate the deviation of the maximum and minimum number of rotations. This will visualise some of the reliability of the motors. The results of the consistency test, are as seen in figure 3 and Table 2:

The consistency of the four motors and their relation in RPM. Figure 3: The consistency of the four motors and their relation in RPM.

Deviations of four lego motors. Table 2: NXT Servo: A deviation of 6; EV3 Large: A deviation of 7; EV3 Medium: A deviation of 26; RXC 43362: A deviation of 54.


The code used for performing the 5 min speed and power test can be found here

The code used for performing the 10 x 30 sec consistency test can be found here


Based on the results from the previous section we are able to conclude that the most viable motor to use in our project would be the EV3 Medium motor. This is because of its small and compact construction that allows for easy mount and integration, while still providing speed and power with an acceptable balance of backlash and consistency.



We have made the initial research and are now able to continue with our project. We will use this collection of new and previous knowledge to begin defining the software structure and testing the different sensors, as well as begin constructing the physical construction of Max as a ball-balancing performer.