Introduction
It is important for every mobile robot to possess the ability to navigate in target environment. Navigation can be described here as the robotic system’s ability to identify its own position in an unknown area with respect to some reference point and then move to its target position. In order to navigate in its environment and reach target position correctly, an efficient control system should be designed.
The aim of this project is to design and implement a mobile robot localisation and control.The mobile robot is developed with the ability of:
Localisation System
For a positioning system, it is required that the robotic system should be able to know its current position coordinates in an unknown area. Position is represented in 2-D Cartesian space, i.e. x and y axes points, measured in centimetres.
Control System
Design of control system for mobile robot must be such that robot can accurately follow the desired trajectory according to the orders from the supervisor.
For data processing and control system implementation, the available single-board computer such as Raspberry Pi and micro-controller Arduino Uno are used. The Supervisor input target point and sensor data will be processed on Raspberry Pi. The calculated target joint angles and distance required to reach target will be sent to the Arduino Uno which will then send commands straight to the motors. Moreover, control system will be implemented on Raspberry Pi using Python and commands will be sent to motors from Arduino Uno. To obtain measurements about path moved by the motor, encoder is used. Also, four ultrasonic sensors are installed as an external positioning system.
Ethics
There are some standard ethics which engineers must comply with. The ethics related to this project are:
Plagiarism
Honesty
The honesty in the report information such as:
Researches
Design; the project design should be the student’s original work with the supervisor oversight
The honesty in the final project results
Respect of Human Subjects
Human subjects must be respected. For instance, personal information including voice recording, images, and private data must not be leaked or exhibited to the public without the person’s permission.
The project requires working at the institution’s laboratory. The laboratory ethical behaviours are:
Using lab’s tools carefully and returning each tool after usage
Keeping the lab clean, turning off the light when leaving, etc.
Reporting an error such as tool damaging, water on the floor etc. to the security office or the administration office
Not working alone on a hazardous process (soldering in my project)
Commitment of the opening hours of the institution’s laboratory
Using the Robot for Spying
It is rather easy to use the robot for breaching others’ privacy if a camera is connected to the robot and UART is applied to control the robot from a distance. As the goal of the project is to use it for educational purposes, the student(s) must not use the robot for spying activities.
Design
Design Subject
This chapter consists of features of the materials used such as the sensors (encoder, Ultrasonic) and processor. The main subjects that form the project are:
Robot’s mechanical structure and total cost of the robot
Hardware; microprocessor, microcontroller, H-bridge driver, motors with encoders, wheels, ultrasonic ranging sensor, and power supply
Software; programming code language and I2C setup
Robot’s Mechanical Structure
The robot consists of triple-decker carriages. Lower Decker is built as the basic structure of the robot holding both motors and the two upper deckers. In addition, the batteries are placed on the lower Decker. The middle Decker holds the microcontroller (Arduino Uno) and the circuit breadboard. The higher Decker is built for holding the microprocessor (Raspberry Pi) and the battery supplying the Raspberry Pi.
The robot will have two independently-driven wheels. Both wheels are not connected to each other so the robot could go right and left by making one of the wheels move while the other remaining constant. The two ball wheels will be the part of the robot serving as a balanced point for it.
Figure 3-1: The robot’s mechanical structure
Hardware
Processors and Microcontroller
As mentioned, Raspberry Pi 3 and Arduino Uno are used for data processing and control system. As complex calculations are involved in the project, Raspberry Pi is used to allow the user to visualise these complex results like target angle (θ). The other part of the project is to control the robot’s motion by controlling the motors. Arduino Uno microcontroller is used for controlling the robot’s motion.
There are several reasons Raspberry Pi together with Arduino Uno is used. First, the need of real-time monitoring of robot position necessitates the use of Arduino Uno as a microcontroller. However, Arduino Uno has a very small memory to store code and perform complex inverse kinematics calculations. Therefore, the need of the Raspberry Pi as a processor is required. In addition, Raspberry Pi has only digital IO and no Analog pins. Although there are some techniques to overcome these limitations, it is still more appropriate to use Arduino Uno with plenty of both digital and analog GPIOs. To conclude, it is better to use them in combination rather than struggling with the limitations of both devices. Here, RPi acts as the brain and Arduino acts as a muscle or a slave board. Furthermore, there is I2C interface on both Arduino Uno and RPi. Thus, communication among them is easy without any problem. Raspberry Pi 3 and Arduino Uno overview refers to Appendix A.
H-Bridge
L293D is a quadruple high current half-H drivers’ device. It provides current up to 600 mA at voltages from 4.5 to 36 V. This current supplies the motors with the commands coming from the Arduino Uno (microcontroller).
H-Bridge has 4 transistors; S1, S2, S3, S4 (see Figure 3-2). Two transistors are activated each time.
Motor forward: S1 and S4 are closed; S3 and S2 are open
Motor reverse: S3 and S2 are closed; S1 and S4 are open
Figure 3-2: H-bridge diagram
Wheels
The wheel choice depends on the wheel’s diameter. The wheel diameter is important for the encoder resolution. In this project, 60 mm diameter wheels are used. The distance travelled per revolution is calculated according to equation 3-1.
Distance travelled per revolution mm = Wheel Diameter mm×π
(3-1)
Distance travelled per revolution =60×π= 188.4 mm
Gear Motors with Encoders
The motors used are 6 V DC gear motors with encoders geared to ratio 47:1. The motor provides a speed of 120 RPM at 6V DC. The diameter of the motor shaft equals to 4 mm which needs a mounting hub to be attached to the wheel. The motor is shown in Figure 3-3.
The reason of using this motor is simple. The objective of the project is to navigate and control a robot which needs a sensor. An accurate way to do us using encoders. In order to make the robot reach the exact target point with no error, the motor has a normal speed of 120 RPM at 6 V DC with less wheel slipping.
The selection of encoders usually depends on the output and the resolution of the encoder. The encoder used provides 1050 counts per revolution (CPR); the greater the number; the more accurate the distance. The minimum resolution of the encoder used could be calculated by equation 3-2 using the circumference of the wheel.
Encoder minimum resolution= wheel circumferenceencoder resolution (3-2)
Encoder minimum resolution= 188.448=3.925 mm
The result shows that the minimum distance travelled per encoder count is equals to 3.925 mm (22 CPR).
Ultrasonic Ranging Sensor
Two methods have been used to navigate the robot; navigating using encoders and navigating using ultrasonic ranging sensors. Ultrasonic sensors are very powerful sensors to calculate the object distance. This method is used for many industrial applications. Ultrasonic ranging sensor calculates the distance by calculating the time of sound reflection; a sensor sends sound and calculates the time between sending the sound and receiving the reflection of it.
Figure 3-5: Ultrasonic Ranging Sensor Operation (Block Diagram)
The block diagram above shows Arduino and ultrasonic operation. Arduino triggers the sensor by sending 10us pulse to the trigger pin on the sensor. The sensor will send 8 cycle-sonic burst automatically and the echo will rise at the same time. The echo will fall after receiving the reflected sonic bursts. The result pulse width by the echo is the distance from the sensor to the object.
Power Supply
The Raspberry Pi is power by 5V, either micro-USB or battery. 5V battery is connected to Pin2. The Arduino Uno could be also powered using 5V connected to Vin Pin in the board or 9V connected directly to the power plug. The power plug has a 5V regulator to convert the 9V to 5V as required by the Arduino board. The motor requires 6V to be powered. The encoder requires 3.5-20V supplied from the Arduino board.
The reason the motors are not supplied by the Arduino Uno board is because motors draw a lot of current and may cause a damage to the Arduino Uno board or may reset its readings.
Software
The system has a microprocessor and a microcontroller and both operate using different languages. The language used for the Raspberry Pi is Python allowing access to a module called math with mathematical functions for complex numbers in C standard. The project is dealing with complex calculations as calculating angles. Python also provides the access to a module called smbus used for the I2C communication between devices. It is needed to send data to the microcontroller. The main reason of operating the Raspberry Pi using Python language is that Python is powerful in image processing. Thus, work image processing could be included in the future project where many positioning robots’ applications use image processing. The other reason is to learn a new language during the project.
Arduino Uno has no operating system and can be programmed using embedded C language. So, the language used for the Arduino Uno is embedded C language; Arduino’s own language.
I2C Bus Setup
If Raspberry Pi is master and Arduino Uno is slave, there is no need to use it to deal with 3.3V RPi and 5V Arduino operation. This is because RPi has 1kΩ resistor to the 3.3V power rail. When data is to be transmitted, the line is pulled to 0V. For a logical ‘low’ value, it is pulled up to the supply rail voltage level. There is no pull up resistors for Arduino. 3.3V is considered ‘low’ logic value. Thus, communication works as expected. Built-in pull-up resistors are only available on the Pi’s I2C pins: Pins 3 (SDA) and 5 (SCL), i.e. GPIO2 and GPIOP3 on a Rev. 2 board. On the Arduino Uno, the I2C pins are A4 (SDA) and A5 (SCL).