Abstract
Without access to external guidance, such as landmarks or beacons, indoor mobile robots usually orientate themselves by using magnetic compasses or gyroscopes. However, compasses face interference from steel furniture, and gyroscopes suffer from zero drift errors. This paper proposes an orientation sensor that can be used on differentially driven mobile robots to resolve these issues. The sensor innovatively combines the general differentials and an optical encoder so that it can provide only the orientation information. Such a sensor has not been described in any known literature and is cost-efficient compared to the common method of using two encoders for differentially driven mobile robots. The kinematic analysis and the mechanical design of this sensor are presented in this paper. The maximum mean error of the proposed orientation sensor was about 0.7° during the component tests. The application of the sensor on a vacuum cleaning robot was also demonstrated. The use of the proposed sensor may provide less uncertain orientation data for an indoor differentially driven mobile robot.
1. Introduction
Determining a mobile robot's position or orientation accurately without the aid of any external devices has always been a challenge. There are several common methods that can be used as positioning systems for mobile robots [1,2]. These methods are: odometry, inertial navigation (or gyroscopes), magnetic compasses, polarized light compass, active beacons, global positioning systems (GPS), landmark navigation and model matching (or map-based positioning). The first four methods can be used on mobile robots directly without the use of any maps, external marks or devices, and the remaining ones are more complicated in terms of installation and setup of external devices. In fact, each type of positioning system has its advantages and disadvantages, and there is no positioning system that can replace the other types under all circumstances.
For examples, odometry cannot provide accurate information over a longer period of time because of several uncontrollable reasons such as slipping of the wheels, the backlash of the gears and uneven ground. The signal of inertial navigation may drift so eventually it will lose its accuracy. Magnetic compasses can easily face interference from nearby live electrical wiring or ferromagnetic structures [3]. The orientation sensor based on a magnetometer produced an error as large as 35° when ferromagnetic mobility devices approached it. Reference [4] also showed that the magnetic field sensor generated large errors in an environment with magnetic interference. One way to reduce the errors was to fuse the magnetometer with the gyroscope and/or accelerometer together by using a Karman filter [5,6]. The polarized light compass uses the polarization pattern cast by the sun to determine orientation, so it may not adequate for indoor application where sunlight is not available. The active beacon method usually requires the setup of several external beacons such as LEDs, ultrasonic transducers or lasers, which may be too troublesome for home application. GPS can be accurate to within 1 m outdoors, but GPS receivers usually have problems in receiving signals indoors. Landmark navigation relies on the computer vision of the mobile robot and requires natural [7] or artificial [8] landmarks to be carefully selected or deployed before the orientation can be determined. The model matching method needs to create a map first. This method is difficult to use by itself for real-time motion.
Currently, the low-cost vacuum cleaning robot uses only bumper switches as its major sensors to carry out its cleaning task. The cleaning robot usually moves in predefined (zigzag, spiral, elliptic) or random patterns, or adopts certain strategies such as hit-and-turn to clean the house. To reduce their cost, they are not equipped with any orientation sensor, so the robot does not know which direction it is heading, which makes it impossible to move in those predefined patterns accurately. The result is that it may need to sweep several times in the same area before its paths have covered most of the area. The lack of orientation information makes the cleaning robot less efficient and effective.
To improve the robot, it would be preferable to install an orientation sensor on the cleaning robot without increasing the manufacturing costs too much. Many common cleaning robots are based on the differentially driven platform because of its simplicity and versatility. In this paper, we will focus on the robots of this configuration only. There are several ways to detect the orientation change of a differentially driven mobile robot. The straightforward approaches use magnetic compasses or gyroscopes. However, as mentioned previously, the gyroscopes and magnetic compasses have their own drawbacks. A more reliable method is to install an optical encoder on each of the two driving wheels of the differentially driven robot. By doing this, we can determine not only the orientation but also the travelling distance of the robot. However, knowing the travelling distance is useless for the low-cost cleaning robot because it cannot be used without a map. Therefore, the two encoders provide redundant information. To reduce the cost, we would like to propose a reliable, simple, and innovative sensor that can provide orientation information in this paper.
2. Method
The orientation sensor includes an optical encoder and three differentials, which are commonly used in the powertrain of a car to allow the driving wheels to rotate at different speeds. The sensor can be used in differentially driven wheeled mobile robots or similar two-wheel drive mobile robots to provide relative orientation information. Since the differential drive configuration is the most common configuration for mobile robots [9], due to its excellent manoeuvrability, the proposed sensor does not lose too much of its applicability. The innovative idea for the proposed orientation sensor came from the traditional south-pointing chariot, which was invented about eighteen hundred years ago by the Chinese. The south-pointing chariot is a mechanical device, which looks like a two-wheeled cart carrying a person whose finger is pointing to the front. To use the chariot as a means of determining direction, we first let the finger point to a known direction. Thereafter', the finger will keep pointing in the same direction regardless of which direction the cart goes assuming that there is no slippage between the wheels and the ground, and there is no backlash among the gears. Since the compass' invention about one thousand years ago, the south-pointing chariot has been used for educational or recreational purposes only. Although people have known of the south-pointing chariot for hundreds of years, no one has ever thought that it could be used with modern electronics to provide reliable orientation data for mobile robots. In the following section, we will present a kinematic analysis of the proposed orientation sensor.
2.1 Kinematics
The orientation sensor we proposed consists of an optical encoder and three differentials. There are many different designs of differentials that can achieve the same function [10], but we selected the model proposed in [11] as shown in Figure 1 because it can provide a lower profile. In this design, each differential includes three bevel gears so there are nine bevel gears in total. Among them, gear 1 and gear 9 are attached to the left wheel and the right wheel, respectively. Gears 3 and 4 are attached back to back, and so are gears 6 and 7. Gears 2 and 8 spin around their own vertical axles which are perpendicular to the main axle. Gear 5 spins as long as there is angular discrepancy between gears 4 and 6. None of the nine gears are fixed to the main axle or the vertical axles. The encoder is connected to the shaft of gear 5 to detect its angular movement. If both driving wheels have the same angular movement, the shaft of gear 5 will remain stationary and the encoder will not detect any angular movement. If the left wheel rotates faster than the right one, then the platform will turn right at an angle. In the mean time, the shaft of gear 5 will turn left at the same angle so that the finger or the pointer attached to the shaft will always point in the same direction. The angular change can be converted into digital signals by an optical encoder to determine the platform's relative orientation for navigation and localization.

Mechanism of the orientation sensor
The principle of the mechanism can be further explained as follows. Assuming that there is no slipping between the two driving wheels and the ground, and there is no backlash among the gears, any movement of the differentially driven platform can be considered as a linear combination of two possible movements. First, both wheels rotate at the same speed. Second, one wheel stays stationary and the other rotates at a certain speed. In the following section, we will examine the two possible movements in details.
For the first movement, if both wheels rotate at the same speed, the platform moves in a straight line and gear 5 will not spin at all due to symmetry, and neither will gears 3, 4, 6 and 7. Because gears 1and 9 are fixed on the wheels, they will turn at the same speed, and gears 2 and 8 will spin around the vertical axles and the two vertical axles will rotate with the main axle.
For the second possible movement, if we fix the left wheel and let the right wheel rotate, then gear 9, attached to the right wheel, and all the other gears except gear 1 rotate in the direction as shown in Figure 2. Because the right wheel moves forward and the left wheel remains fixed, the platform will turn left. However, as indicated by the arrow on gear 5 in Figure 2, gear 5 will turn right. By properly designing the gears, the wheel size, and the distance between the two wheels, we can make it so that the turning angle of the platform equals the rotation angle of gear 5, but in different directions.

Kinematics of the orientation sensor when gear 1 is fixed
Because the movement of the platform is a linear combination of the two possible movements discussed previously, the rotation angle of gear 5 is equivalent to the turning angle of the platform. Therefore, we can install an optical encoder on the shaft of gear 5 to detect its angular movement, which is equivalent to the orientation change of the platform. Of course, the direction that the encoder detects will be opposite to the direction the platform turns.
2.2 Gear Design
In the following section, we wish to design the gears and the wheels so that the angle the optical encoder detects is the same as that at which the platform turns. Based on the formula for a bevel gear differential [12], we have Eqs. (1) and (2) for the left differential and the right differential used in the proposed orientation sensor:
where ω0 is the angular velocity of the main axle, ωi (i = 1,2,…,9) is the angular velocity of the
and
In addition, gears 3 and 4 are attached, and so are gears 6 and 7, so we have
and
Combining Eqs. (1) and (2) gives
Substitution of Eqs. (5) and (6) into Eqs. (3) and (4), respectively, leads to
and
Substituting Eqs. (8) and (9) into Eq. (7), we can obtain
Let us assign the number of teeth
Since gear 1 is fixed on the left wheel and gear 9 is fixed on the right wheel, we can learn from Eq. (11) that gear 5 will not spin when the left wheel and the right wheel rotate at the same speed. However, whenever there is a difference in the angular speed between the two wheels, gear 5 will spin according to Eq. (11), which can be rewritten as
where Δθ1, Δθ5, Δθ9 are the angular changes of gears 1, 5, 9 during the same period of time, respectively. Let the diameter of the wheel be
Plugging Eq. (13) into Eq. (12) gives
Properly designing the four parameters,
we can obtain
Eq. (16) shows that if we use an optical encoder to measure the angular change of gear 5, the angular change is also the orientation change of the platform as long as Eq. (15) can be satisfied.
2.3 Implementation
For the orientation sensor proposed in this paper, we used the following parameters:
Design of the gears used in the orientation sensor

The major dimensions of the proposed orientation sensor with the driving wheels

(a) Completed differentials of the orientation sensor with the wheels; (b) Completed orientation sensor with the wheels
To test the performance of the proposed orientation sensor, we installed the sensor on a differentially driven robot platform. The design of the platform with the orientation sensor is shown in Figure 5(a).

(a) Design of the differentially driven platform with the orientation sensor; (b) Completed platform with the orientation sensor
The orientation sensor was installed with the driving wheels under the chassis. Each wheel was driven by a servo (operating voltage: 6V, maximum torque: 3.4 Kgf-cm) capable of rotating 360°. A caster wheel was installed at the rear of the chassis to support the structure. The completed differentially driven platform with the orientation sensor is shown in Figure 5(b).
The control module for the platform is shown in Figure 6, in the middle of which is the main controller we used for the platform, PIC30F2010 (Microchip, USA). The Quadrature Encoder Interface (QEI) module of the controller provides an interface for the optical encoder. The controller can also send pulses with controlled width to control the speed of the servos.

The control module of the differentially driven platform
3. Results and Discussion
In this research, we conducted several tests to verify the feasibility of the proposed orientation sensor. For the purposes of comparison, we used the proposed orientation sensor and an electronic compass in most of the tests. An electronic compass is an absolute orientation measurement system, which can tell its heading relative to the magnetic poles of the earth. However, the proposed orientation sensor is a relative orientation measurement system, which can recognise a change in orientation relative to its original orientation. In many indoor applications such as vacuum cleaning robots, the information pertaining to the relative orientation which changes with an acceptable accuracy is more useful than the information of an absolute orientation with uncertain errors.
The tests we conducted are as follows. First, we tested the performance of the orientation sensor and the electronic compass alone. Second, we installed the sensors on a differentially driven platform and moved it on straight rails to evaluate the reliability of the orientation sensors. Then we removed the rails and let the platform move in a straight line in a room where there were some steel desks and cabinets nearby. We also let the platform move in a straight line in an empty hallway so that we could compare the results with the ones obtained when the platform moved in the room. Finally, we used the proposed orientation sensor to guide the platform moving in a zigzag pattern to demonstrate its applicability.
In these tests, the electronic compass we used was made by Robot Electronics (part no. CMPS09, Norfolk, UK). The electronic compass has an embedded controller so that it can perform tilt compensation. Its accuracy is about 0.5 – 1.0% according to its specification. The main controller, PIC30F2010, of the test platform can access the information provided by the electronic compass via the inter-integrated circuit (I2C) interface. A personal computer was used to access the orientation data from the main controller using an RS-232 interface. The control system of the test platform is shown in Figure 7.

The control system of the test platform with the orientation sensor and the electronic compass
3.1 Component Tests
In this section, we tested only the orientation sensor and compared the results with those obtained by using the electronic compass. We first tested the proposed orientation sensor by connecting the left wheel or the right wheel to a stepper motor. We controlled the stepper motor making it rotate one, two, three and four revolutions, which corresponded to 90°, 180°, 270°, and 360° rotations for gear 5, and then we measured the rotation of gear 5 using the encoder. The test setup is shown in Figure 8, where the stepper motor was connected to the right wheel through a coupling and the left wheel was fixed by attaching it to a frame. Tables 2 and 3 show the average results obtained from 10 measurements by using the stepper motor to rotate the left wheel or the right wheel clockwise or counterclockwise, respectively. The maximum mean error for the proposed sensor was about 0.7°, and the maximum standard deviation was about 0.9°.
Rotation of the left wheel clockwise (upper) and counterclockwise(lower), all units are in degrees
Rotation of the right wheel clockwise (upper) and counterclockwise(lower), all units are in degrees

Test setup of the orientation sensor
We then used a similar method to evaluate the electronic compass. We turned off the stepper motor after the electronic compass had rotated to the desired angle and obtained the results shown in Table 4. It can be seen that the maximum mean error was around 0.7°, and the maximum standard deviation was around 0.3°. By comparing the results with those obtained using the proposed orientation sensor, we can see that the maximum mean errors of both the proposed orientation sensor and the electronic compass were the same. The proposed orientation sensor had a slightly larger standard deviation than the electronic compass, which might be caused by the backlash between the gears.
Rotation of the electronic compass, all units are in degrees
3.2 Moving on Straight Rails
The purpose of this experiment was to evaluate the effects of the electromagnetic waves generated by the servos and the effects of ferromagnetic materials on the proposed orientation sensors and the electronic compass. Trying to keep the compass away from all electronic noises, we placed it on a pedestal of 150 mm in height at the rear of the platform as shown in Figure 9. The control circuit was placed in the front, and two servos were placed under the chassis. During the experiment, we moved the platform on aluminium rails of 1000 mm in length so we knew that the ideal orientation variation obtained from the proposed orientation sensor and the compass should be close to zero. The experiment consisted of two parts. In the first part we turned off the servos, pushed the platform on the straight rails and used the proposed orientation sensor and the electronic compass to obtain orientation information. The rails were placed as shown in Figure 10. In the second part of the test, we turned on the servos, and all the other conditions remained the same.

The arrangement of the sensors, the control circuit and the batteries of the platform

The guiding rails to allow the platform to move on them
Figure 11(a) and Figure 11(b) shows the orientation information of one of the four trials we performed in the first part and the second part of the experiment, respectively. The statistics for the four trials, in each part of the experiment, are listed in Table 5.
The maximum errors from the proposed orientation sensor and the electronic compass with the servos off or on

The data from the orientation sensor and the electronic compass when the platform was pushed on straight rails with servos (a) off; (b) on
As we can see from Figure 11(a) and Table 5, both the results obtained by using the proposed orientation sensor and the electronic compass were similar when the servos were off. The maximum error for the proposed sensor was 0.6°, and for the electronic compass it was 1.2°. The difference between the two sensors was only 0.6°. However, when we turned on the servos in the second part of the test, the electronic compass was affected by the electromagnetic wave and generated a large angular deviation from the ideal 0°. From Figure 11(b) and Table 5, we can observe that the maximum error of the electronic compass was increased to 6.2°. When the servos were on, the maximum error of the proposed orientation sensor was not affected by the electromagnetic interference and remained at a small value of 0.4°.
3.3 Moving in a Straight Line
From the previous tests, we knew that the proposed orientation sensor's error was about 0.7° on average. In this experiment, we will use the orientation sensor's information as a reference to understand the effects of the ferromagnetic materials nearby. We used a differentially driven platform moving in a straight line with guidance from the proposed orientation sensor. The electronic compass was installed on the platform and tested in two different environments. The first environment was a room with some steel cabinets and desks nearby, as shown in Figure 12(a).

(a) The planned straight-line path in a room; (b) the planned straight-line path in a hallway
The second environment was an empty hallway. The hallway was about 2.3 m wide, as shown in Figure 12(b). The length of the test path was 4 m. We programmed the main controller so that it read from the optical encoder every 1 s, and then controlled the platform's orientation if the optical encoder detected that the platform deviated from the original heading by more than 1°. Figure 13 shows the orientation results from the robotic platform moving in the room, from which we can see that the maximum deviation of the electronic compass was about 16°. Figure 14 shows the results from the platform moving in a straight line in the hallway. The maximum deviation of the compass was reduced to about 8°. The deviation decreased because there was no ferromagnetic material nearby. However, there was still some deviation caused by the electromagnetic waves from the servos or control circuit that we could not totally eliminate. In addition, the platform with the proposed sensor had an average offset of 65 mm in the room and that of 70 mm in the hallway after it had moved 4 m. The offset was a result of the error of the orientation, which may be due to the difference between the two driving wheels, the slipping between the wheels and the ground, and the uneven floor.

The four sets of data from the orientation sensor and the electronic compass when the platform moved in a room

The four sets of data from the orientation sensor and the electronic compass when the platform moved in a hallway
3.4 Zigzag Movement
To test the applicability of the proposed orientation sensor, we programmed the platform with the proposed orientation sensor to move in a zigzag pattern as shown in Figure 15. Being able to move in this pattern with reasonable accuracy is important for the vacuum cleaning robot application. Many vacuum cleaning robots cannot move in a zigzag pattern accurately, so they need to rely on some other moving strategies to clean a house effectively. However, these moving strategies are usually inefficient. If we equip a vacuum cleaning robot with the proposed orientation sensor to achieve the zigzag moving pattern, then the robot's performance will be improved without adding too much to the cost.

The planned zigzag path for the platform with the orientation sensor
The experiment was also performed in the same empty hallway of 2.3 m in width, as shown in Figure 15. In this experiment, we installed a bumper switch in front of the platform, as shown in Figure 9. The zigzag movement can be programmed by repeating the following procedure: when the platform hits the wall, it backs off by about 20 mm, turns 90°, moves forward for about 200 mm, and then turns 90° again in the same direction. The platform continued to move forward until it hit the wall again. Then it performed the same movement as described previously except that it turned in the opposite direction. Again, we allowed the controller to read the optical encoder every 1 s, and we corrected the orientation of the platform if the encoder's reading was more than 1° in either a clockwise or counterclockwise direction. Figure 16 demonstrates that the platform with the proposed orientation sensor could perform the continuous zigzag movement. When we examined the moving path closely, we found that the situation is as illustrated in Figure 17, in which the actual path is represented by the dotted line and the ideal path is represented by the solid line. Based on the control scheme we used, the platform had a little offset (about 70 mm for the travelling distance of 4 m according to the previous test) from the ideal path. In a real application, we can have an overlap sweeping area for two adjacent paths so as to overcome the offset problem. On the other hand, we can also change the control scheme to reduce the offset. For example, we can read the encoder and correct the orientation of the platform more frequently. However, doing this may cause a control instability problem.

Consecutive zigzag movement of the platform with the orientation sensor

Illustration of the ideal path (solid line) and the actual path (dotted line)
3.5 Discussion
This proposed orientation sensor can be applied when the only information required is the relative orientation. The sensor is quite cost-effective because it uses only one optical encoder, nine plastic gears and a few mechanical parts. As shown in the kinematic analysis performed previously, when the platform turns a certain angle, the encoder in the proposed sensor reads the same angle in the opposite direction. The two angles are the same because Eq. (15) is satisfied. If Eq. (15) is not satisfied, then we have
where
When we want to apply the proposed orientation sensor to any other differentially driven platform with different sized wheels or with different distances between the wheels, as long as we know the number of teeth of the gears in the orientation sensor, the wheel diameter and the distance between the two driving wheels, we can use Eqs. (17) and (18) to calculate the turning angle of the platform based on the information from the encoder of the orientation sensor. Therefore, the proposed sensor can still be used as a standard component for various differentially driven platforms with different wheel diameters and different distances between the two driving wheels.
The proposed orientation sensor, like many other sensors, has accumulated errors. Slippage, backlash of the gears, unequal wheel diameters, uneven floors and the resolution of the optical encoders may contribute to errors in the orientation sensor. If we use the orientation sensor for a long time, the accumulated error may be too large to be acceptable. However, if we can calibrate the orientation sensor from time to time, then during the time between calibrations, we can still use the orientation sensor with acceptable accuracy. The calibration may be performed manually or automatically. For example, users can reposition the platform with the sensor to a predefined direction and reset the orientation information, or the programmer can use a feature in a household environment such as a long wall as a reference to reset the orientation.
4. Conclusion
In this paper, we present the development of an orientation sensor consisting of an optical encoder and three differentials. The sensor is cost-effective compared to the common approach of using two optical encoders on a two-wheeled platform to detect changes in orientation. The basic idea of the sensor originated from the traditional south-pointing chariot, but we innovatively combined it with modern electronics so as to make it able to provide orientation information for a mobile robot. We also generalized the basic idea so that the constraints of the south-pointing chariot were removed to allow us to make a standard orientation sensor for two-wheeled differentially driven platforms of different sizes.
The orientation sensor can perform approximately as well as the electronic compass that we used in this research during the component tests. The electronic compass has a self tilt-compensation capability but still suffers from interference from nearby steel furniture and electromagnetic interference caused by the motors and control circuits. The level of error in the research ranged from 6.2° to 16°, which may vary depending on the real-world situation. On the other hand, the proposed orientation sensor can provide more reliable orientation information in an environment where there are ferromagnetic materials nearby or where there is electromagnetic interference. We also used a mobile robot equipped with the orientation sensor to move in a zigzag pattern to demonstrate its applicability.
Footnotes
5. Acknowledgments
The authors wish to thank the National Science Council, Republic of China, for financial supporting this research under Grant NSC99–2221-E-011-100.
