Professional Documents
Culture Documents
Required components:
1. Robot chassis with motors
2. Motor Driver circuit board
3. Arduino/Pi with data cable
4. Connecting wires
5. PC (Arduino IDE installed)
A Mobile Robot is capable of locomotion and not fixed to a single physical location. Mobile
robotics is a subfield of robotics. A mobile robot uses sensors to identify its environment and move
around it. It does have sensors, controller and actuators as physical components, like in any other
robot. It does also have software component that makes it roam around autonomously through the
decision making process based on the sensors’ input.
Parts
1. Sensors: Sensors help the robot to identify its surrounding environment and detect path &
obstacles. There are different sensors that can be used with the mobile robots for different
applications, including IR, Ultrasonic, Colour detector, Laser scanner etc.
2. Controllers: Different types of controller are used in robots along with the memory and
additional circuitry. A robot controller makes decision for the robot based on the sensor values and
the algorithm stored in the memory. In this lab we will use Arduino controller.
3. Actuators: They enable the robot to perform action in/on the environment and objects within it.
Typically motors are the actuators for mobile robot. However, a mobile robot may be equipped with
addition manipulator which may contain addition actuators such as pneumatic, suction etc. The
mobile robot chassis used in this lab have 2 motor fixed with it.
Programming Arduino
Once the circuit is complete, connect Arduino with your PC using the data cable. Run the Arduino
IDE and perform following steps to upload the code;
a. Select appropriate board from Tools → Boards
b. Select appropriate port from Tools → Port
c. Upload the code (Sketch → Upload)
Analogue value of the pin can be set between 0~255. Through changing this value speed of the
motors can be varied. The speed can also be varied by providing analogue value to the motor enable
pin.
________________________________________________________________________________
.
.
.
void loop() {
analogWrite(left_wheelA, 100); digitalWrite(left_wheelB, LOW);
analogWrite(right_wheelA, 100); digitalWrite(right_wheelB, LOW);
}
Practice Tasks:
1. Program the robot to drive straight forward for five seconds and repeat in reverse direction.
2. Program the robot to move straight for 5 seconds in full speed then slowdowns, makes U-turn
3. Make the robot move forward for 2 seconds and then make a random radial turn.
4. Make the robot move forward for 2 seconds and then make a random axial turn.
5. Program the robot to follow a path that is in Z shape. For shorter lengths run the robot in half
speed for 5 seconds. The longer length takes 10 seconds to cover in full speed. The angle between
Exercise Task: Write a program for the robot to run on a path shaped like infinity. The robot
should complete the path between 10~20 seconds.
Exercise Question: What kind of issue(s) you had while solving the practice and exercise tasks?
How you may solve those issue(s)?
Answer:
1. The motors were unable to run while putting them on the floor when the lower
PWM value is passed. The issue was resolved by providing the higher PWM
values.
2. While using ESP32, it was challenging to provide it approximately 3.3V. The
different terminals of the provided battery were checked, and ESP32 could also be
powered up along with the H-Bridge with the same battery.
3. Understanding the working principle of H-Bridge has still to be learnt. With
practice and extra time, it could be understood.
Note: Demonstrate the practice and exercise tasks within the lab. Submit the handout along with the
exercise code and a picture of the final circuit on LMS.
Exercise Code
void setup() {
pinMode(left_wheelA, OUTPUT); pinMode(left_wheelB, OUTPUT);
pinMode(right_wheelA, OUTPUT); pinMode(right_wheelB, OUTPUT);
}
void loop() {
delay(2000);
// Stops
analogWrite(left_wheelA, LOW);
analogWrite(left_wheelB, LOW);
analogWrite(right_wheelA, LOW);
analogWrite(right_wheelB, LOW);
delay(500);
// Slightly Straight
analogWrite(left_wheelA, 70);
analogWrite(left_wheelB, LOW);
analogWrite(right_wheelA, 70);
analogWrite(right_wheelB, LOW);
delay(300);
// Second Part of Loop
analogWrite(left_wheelA, LOW);
analogWrite(left_wheelB, LOW);
analogWrite(right_wheelA, 70);
analogWrite(right_wheelB, LOW);
delay(2000);
// Stops
analogWrite(left_wheelA, LOW);
analogWrite(left_wheelB, LOW);
analogWrite(right_wheelA, LOW);
analogWrite(right_wheelB, LOW);
delay(500);
}
Conclusion:
Thus a mobile robot is studied through which numerous concepts of H-Bridge and ESP32/Arduino
UNO are cleared and PWM speed is also taken into consideration.