The Maze Robot

advertisement
American College of Sofia
Class of 2016
The Maze
Robot
By Nikita Ovsyannikov, Venezia Georgieva and Boris Zyumbyulev
Supervised by Krasimira Chakarova, Ph.D.
Vienna International Science and Engineering Fair
14th of March, 2015
-1-
Project Abstract
Sensors are machines that can detect changes in the environment around them.
An Ultrasonic sensor uses ultrasound, which is a sound wave above 20,000 Hz (more
than the human ear can detect). Even though the ultrasonic sensors already have
many applications, The Maze Robot aims to determine if these sensors can be used to
safely explore unknown areas, such as caves or labyrinths. First, we constructed a 2-3
meter long and 1 meter wide maze with various tunnels and corridors. Then, a small
10x20 cm robot was constructed using materials from the Arduino Company, DC
motors, wheels, etc. The most important part of the robot is a small ultrasonic sensor
serving as the ‘eyes’ of the robot. Then, a lengthy computer code (on a language
similar to Java) was imported to the robot’s motherboard. The end goal of the
construction is to visualize the pre-constructed maze and not to bump into any of the
maze walls. After placing the robot in the labyrinth it managed to avoid hitting
obstacles and eventually safely solved the maze. Therefore, the ultrasonic sensors on
similar robots can be used to check if unknown areas for people are safe or not. They
prove to be an inexpensive solution for scanning dangerous geographical, geological or
construction zones.
-2-
Table of Contents:
1. Introduction
4
a. Background Research
4
i. Ultrasonic Sensors
4
ii. DC motors
5
iii. Arduino
7
iv. Continuous Track or Wheels
8
b. Hypothesis
9
c. Goals
9
2. Model Construction and Methodology
10
a. Overview
10
b. Detailed List of Materials
10
c. Procedure
11
3. Results and Discussion
14
a. Overview
14
b. Sources of error
14
c. Ways to improve
15
4. Application
16
5. Summary
17
6. Technical Drawings and Illustrations
18
a. Overview of the Model
18
b. Arduino Uno R3
19
c. Motor Shield
20
d. Gearbox assembly and inner side of one DC motor from the Double
21
Gearbox
7. The Code
22
8. Bibliography
27
-3-
Introduction
The Maze Robot is a device on tank threads, which uses various methods and
technology from the realms of Physics, Engineering and Computer Science. The
motors, code, motor shield and motherboard work in perfect sync to bring our robot
to life. However, the most important part is the Ultrasonic Sensor. The project
demonstrates the possible applications of ultrasonic sensors, along with other
concepts such as the use of DC motors in vehicles and the principles of electric
currents. In the following pages comes further explanation of these processes, and of
the overall function of the robot, in the detailed model construction, discussion, and
other sections of the paper.
Background Research
1. Ultrasonic Sensors
Ultrasonic sensors work on the ultrasonic principle entirely. From the emitters,
short high-frequency pulses propagate throughout the space in front of the mechanism
at regular intervals. When the wave strikes an object, of almost any kind as long as it
can reflect sound, it “bounces” back as echo and returns to the emitter. The sensor
calculates the distance to the object in question by measuring the time-span between
the emission of the pulse and the received echo.
-4-
Furthermore, since the receiver concerns itself only with the time of the flight
and not with the intensity of the echo pulse, this allows any background interference
of sound to be suppressed. This principle provides much more versatility than a light
sensor, as colors no longer can be a problem. For example, the ultrasonic sensor can
detect black objects on a black background, which would be indiscernible by a naked
eye in most cases. Transparent surfaces and liquids are also detected by the sound
pulses, in addition to all types of fabrics or heterogeneous substances. Dust-laden airs
and ink mists are not a problem for this kind of sensor, allowing it to be useful in all
kinds of environments. Such a mechanism works with pinpoint accuracy anywhere
from 2 mm to 10 m. Thus, if attached somewhere, it can “hear” hazards even before
they have come near enough to be dangerous for the system. Its usage, but not
limited to, is: parking helpers in cars, at production lines, measuring liquids,
orientating a device used for scouting, mapping of the sea floor or any other place. In
conclusion, the ultrasonic sensor is an extremely versatile device that has many uses
while employing a simple wave principle.
2. DC motors
Any electric motor functions on a
magnetic principle. Inside one, two magnets
on the basic principles of repulsion and
attraction cause motion. In the supplied
picture, the armature is an electromagnet
that has a given magnetic field. Another
-5-
permanent magnet, also called field magnet due to its function, is placed around the
core of the motor. Thus, north attracts south, and repels north, and vice versa. This
relationship makes the core of the motor to revolve around a stationary axle.
However, this simplistic approach would turn out to be wrong in the end, as the
electromagnet would make only a half-turn and then stop in the magnetic field of the
field magnet. Thus, precisely when the electromagnet reaches that stop position, the
electromagnet’s field switches and turns completely around. This allows for another
half-turn to be executed, and hence, the core would spin freely. The method through
which the switch is executed is based on the commutators inside the electromagnet
and the brushes to the side. Whenever the armature passes through the horizontal
position the commutators touch the brushes, which switches the electromagnetic field
of the armature. This way the south pole is always below the horizontal center of the
armature; it will always repel from the south pole and be attracted by the north one.
Some of the usages of such a motor include, but are not limited to: the fan in the
microwave oven, electric drill, hair dryer, power windows of your car, the furnace
blower. The mechanism is simple and it has a wide universal application to daily life.
This motor is controlled by a DC current, which provides several advantages such as
excellent speed control over acceleration and deceleration, while being simple and
cheap. However, it requires high maintenance of the wires and dirt can impede its
performance. The AC variation of the electromagnetic motor relies on a magnetic
field caused by an AC current to interact with another electromagnetic field, either
permanent or induced by a DC coil. One of the main advantages of this form is the
fixed speed which is correlated to the frequency of the AC current. Another point is
the reliable operation and need of low maintenance. This makes it a cheap product
and is widely used. However, due to the nature of our model, the disadvantages of the
latter mechanism had us use a DC motor rather than an AC. That is due to the latter’s
inability to function at lower speeds and proper positioning control, which is essential
to the movement of the robot. In conclusion, in our model, the DC electro motor is
much more suitable than the AC one.
-6-
3. Arduino
Arduino is a company that focuses on creating and selling easy to use hardware
and software for the creation of interactive projects. All information on how to
connect their motherboards is open-source; this means that if anyone has the basic
parts, tape, and cardboard, any device can be brought to life. Their philosophy is that
any project should be open-source from the hardware to the software to the design,
and that everyone, including children will be able to make it. The motherboard the
robot uses is the Arduino Uno. It has 14 digital input/output pins, 6 analog inputs, a 16
MHz ceramic resonator, a USB connection, a power jack, an ICSP header, and a reset
button. The motherboard is powered up either with a USB, or through a AC-to-DC
adaptor or a battery. The board uses its own programming language, based on C and
Java, and is called Arduino Software. The database is automatically uploaded once it
is connected to a computer, and from there, and through each pin, the possibilities
are many. The DC motors are connected with Arduino’s Motor Shields which are a dual
full-bridge driver that allows for two independent motors to work at the same time.
Each one can alter its speed and direction without affecting the other, while all of this
happens through the motherboard. It is powered only by an external source (a
battery). That is due to the two separate power connections of the shield: for the
motor supply and for the logic. Thus, an external source must be included in the
project. Most parts used, and the programming language are by the Arduino company
who keep their information an open-source for everyone to use and learn to carry out
bright ideas.
-7-
4. Continuous tracks or Wheels
Each
one
has
several
advantages and disadvantages. A
robot with wheels is cheaper, faster,
more
agile,
light
weight,
while
incorporating simple and tougher
parts that are harder to break.
However, the biggest problem is the
ability to pass over terrain. In most
cases, a wheel can get stuck in a
hole,
and
that’s
a
significant
inconvenience. The continuous tracks solve this issue. In addition to that, power is
much more efficiently used by the tracks while maintaining a high traction level, even
on slippery surfaces. Furthermore, the tracks lessen the impact on the ground due to
the distribution of weight across the whole of the lower body. This permits the robot
to walk on soft surfaces, such as snow, and increases the overall weight growth
potential of the robot. In other words, more mass can be stacked upon the continuous
tracks. However, with such great perks, there are some problems. They do provide
neither the speed nor the maneuverability of the wheels. Despite their short life, they
are also difficult to maintain and break easily. Nonetheless, due to the circumstances
and the expected environment for our robot, choosing tracks was the better option.
Speed is irrelevant in the model, so is maneuverability. On the other hand, the ability
to pass rougher roads will help the robot to handle any unexpected changes along the
way.
-8-
Hypothesis
1. Questions to Answer:

How can the ultrasonic sensor be used on miniature robots?

What should be the code applied to make robot avoid obstacles?

In what way can the robot give feedback of the path it takes to the
user?
2. Hypothesis:
If an Ultrasonic sensor is added to a moving robot, then the robot will be able to
avoid obstacles and find a safe path around maze-like structures. This will happen
because the ultrasonic sensor will give feedback to the motherboard (about the
distance between the robot and the nearest obstacle), thus the imported code will tell
the robot to turn away from the obstacle.
Goals:
 To create a robot that can solve mazes-like structures and go through
unexplored places for humans such as caves or old construction sites.
 To make the robot able to go through a variety of terrains and not to have
difficulty passing through rough surfaces.
 To make the robot not only solve the “maze” itself, but also to give some sort
of feedback to the user about the path that it is taking.
 To create a fairly cheap way to insure the safety of people in the future
-9-
Model Construction and Methodology
Constructing The Maze Robot was a long and complicated process filled with new
challenges around every corner. As the saying goes, as one problem was solved two
more took its place. Even so, the team was determined to see it through and
eventually every part worked in perfect sync with the other. The first step in
constructing the project was picking out the parts. After long hours of consideration,
the products of the Arduino Company were chosen, because of their convenient
hardware. The Arduino Uno motherboard, which is the brain of The Maze Robot works
with a unique coding language, especially designed for Arduino products. After having
all the needed parts, the next step was the wiring of individual components. The
sensors, motors, motor shield and servo were all put together. Then came a period of
trial and error, but soon everything was up and running. The finishing touches on the
robot itself were to make it look appealing, yet durable. The final step of the whole
project was to figure out the layout and then construct the maze in which our robot
can show the best of its abilities.
Detailed List of Materials
1. Products from Arduino

Arduino Uno R3 motherboard

Arduino Motor Shield R3

Analog Feedback Micro Servo by Metal GearServo
2. Base of the robot

Tamiya 70100 Track & Wheel Set, which includes tacks (in segments of
19 cm, 7 cm and 5.5 cm), axels, various shapes of wheels and other
construction materials

3 Tamiya Universal Plates, which consist of a plastic plate filled with
holes for bolts and cables, holders for the wheel axis and multiple bolts

Tamiya Double Gearbox, which consists of two DC motors and their
corresponding components, which will eventually give the robot
movement.
- 10 -

Various bolts and screws
3. Materials used during the construction of the robot, which are not part of the
final product

Scissors

Pliers

Tape

Fastener

A Graffiti spay to color the
maze walls

Markers, Pens and other
Writing utensils
4. Other materials

Vktech Male to Male Solderless Flexible Breadboard Jumper Cables for
Arduino (more than 120) and other Jumper wires

Ultrasonic Sensor HC-R04 by Erelement

9V Battery and AA Batteries

An Asus N series Laptop

HC06 Bluetooth transmitter

24 Maze walls, which are made from PVC and are 40 cm long

An on/off switch
5. For Further Improvement

A TTL Serial Camera

An SD Card

An SD card slot by AdaFruit, which will be put on the Breadboard and will
contain the images obtained by the camera.
Procedure
1. To begin with, the first Tamiya Universal Plate is used to construct the base and
very first layer of the whole tank. It is important to follow the instructions
provided in the box to properly build this piece.
2. Once the base is ready, the Tamiya Double Gearbox kit, in which all parts are
separate, is used. The gear mechanism, which will spin the tank treads, and the
DC motors are assembled adequately according to the instructions from the
manufacturer.
- 11 -
3. After those two parts are complete, they are put together specialized frames of
the base.
4. Now, the Tamya 70100 Track & Wheel Set is used to build the wheels and the
tracks. The instruction manual must be followed to complete the process
properly.
5. The wheels with the tank treads are then added to the base with the motors
and gears. Currently, the “legs” of the robot (movement mechanism) is
complete.
6. Since there is not enough space on the initial base, the next Tamiya Universal
Plate is screwed over the first one by using long bolts (however, it is placed in
such a way, that it covers only half of the first base). Once the first one is firm,
the last Tamiya Universal Plate is screwed in the same way, next to the plate
that was just placed (in the remaining space on the second “floor”). Now there
is twice as much space on the second “floor” as there was on the first base of
the robot.
7. The code is written on the computer and then inserted in the Arduino Uno
motherboard.
8. The motherboard is connected to the motor shield in the proper slots.
9. Now, the combined Arduino Uno motherboard and motor shield are attached to
the second floor of the base.
10. The motor shield and motherboard are adequately connected to the DC motors.
11. The power source (which consists of 8 AA batteries) is connected to the Arduino
products to give the robot life. This is done at an earlier stage in order to test
the robot and code for any mistakes.
12. Since the power source is now connected a button to turn the power on and off
comes next.
13. Later, the Analog Feedback Micro Servo is attached to the front of the robot,
and then it is connected to the Arduino products.
14. Once the servo is in place, the Ultrasonic Sensor is connected to the
motherboard.
- 12 -
15. After all connections of the sensor with the motherboard are secure, the sensor
is gently attached to the servo motor’s “head”, which has the shape of the two
wings of an airplane.
16. For further improvement: Once the servo is adequately connected, the
Breadboard is placed on the second floor of the robot as well.
17. For further improvement: Once the breadboard is in place, the TTL Serial
Camera is connected to it and to the Arduino motherboard. The camera will
take pictures of the terrain around it on command, and it will wirelessly send
them to an SD card, so that the images can be viewed through a computer later
on.
18. The Bluetooth transmitter is now connected to the Arduino Motor Shield in the
adequate slots. After that, it is placed on the first base of the robot to save
space.
19. Once everything is connected, a free program called Tera Term is installed on
the Asus N series laptop. With this program the machine will be able to send
data to the computer, so that the data can be visualized wirelessly. The robot
and laptop communicate through Bluetooth transfer.
20. After all components of the robot are in place, the Maze is build. To construct
the maze, the maze walls, which are separated into 24 pieces, are connected
together as the viewer wishes.
21. The robot is placed in the maze and now the results of its movement and
output data are recorded.
- 13 -
Results and Discussion
Overall, the project was a success and all of our goals have been accomplished.
The hypothesis has been confirmed. The Maze Robot successfully dodges all obstacles
in its path and manages to solve all maze-like structures as long as it can physically
pass through their corridors. The ultrasonic sensor successfully calculates the distance
between itself and the nearest wall and it gives that information to motherboard.
From then the code tells the robot to instantly stop once the distance between it and
the object is too little. Then, the sensor turns left and right and decides which way to
go (it automatically aims for the direction in which there is more distance). After it
reaches another obstacle the process is repeated. Each step along the way, the robot
visualizes the distance it’s going in centimeters and gives the user feedback on when
it stops or turns. The Maze Robot can successfully explore new and undiscovered
terrains and return safely to the user.
Sources of Error:

It is possible that some of the measurements of different materials or of the
maze are slightly different than the ones listed either in the paper or on the
instruction manuals of the individual components.

Errors introduced by the working environment. Even though our robot works
adequately on our working place and in more stable environments. However,
since it is only a prototype it has not been designed to work as good in nature.
It is possible that it will react differently in different circumstances.

It is possible that the wheels that push the continuous track and that the track
itself have small physical differences. Such differences may occur as a result of
their factory production.

Since there is only one ultrasonic sensor it would be wrong to say that the robot
has no blind spots. It is possible that some part of the environment falls within
this blind spot and that the sensor won’t be able to detect it. This can lead to
the robot slightly bumping into walls or objects that are not within the range of
the sensor.
- 14 -
Ways to Improve the Project

The best way to improve the project is to add a TTL serial camera to output
actual footage of what the robot “sees”. This way it will give better feedback to
the viewers and it will be more useful for them. Not only that, but an SD card
can be added so that images get recorded in by the robot instead of simply live
stream a video. Further improvements to this camera option would be to have a
wireless connection, so that the viewer can tell the robot when to take an
image, as opposed to taking images over periods of time.

Another improvement would be to add a variety of sensors to the robot, so that
it can give more accurate measurements of the environment it is in. For
example, a temperature sensor would be useful in different geographical
locations. Sensors, which can detect various elements and gases, would be
highly values, because they will be able to check if there are any poisonous
materials in the environment. A sensor for radiation would also be highly useful,
because it will notify the users that they need protective suits in order to
explore that are. Of course, there are many other sensors that can be added
later on.

The robot could not only display what it sees on a computer screen, but it could
also draw a map of its trajectory. This way if the robot gets stuck or lost, the
user will have a map to help them retrieve it from that place.

The project could also be more durable. Better protection of the parts would
help it survive longer. Not only that, but if it is made with waterproof protection
it will be able to go in rather humid environments without having any issues.

If the robot is smaller in size it is likely to go through more places, thus giving
researchers a greater variety of exploration.

In order to remove the robot spots of the robot, either more sensors have to be
added or an alternative to the ultrasonic sensors must be found.

In order to be efficient in dark places, the robot should have a flashlight as well.

Tera Term is a console application program, so if the results were displayed in a
better way, they would be more clear and user-friendly.
- 15 -
Application
The Maze Robot in its
current
form
has
limited
applications, because it is only
a
prototype.
efficiently
Currently,
demonstrates
it
the
concept of ultrasonic sensors
and their functions. They have
a wide application in everyday
life in factories, for example,
which means that it is useful to
know and explore their uses
even more. The project also demonstrates the concept and working principal of DC
motors. Since the robot is powered by two DC motors it shows their work in action and
demonstrates how they can be used in vehicles. It also shows how important weight
distribution and balance are in similar devices since if the materials were not properly
placed (all of them on one side, for example) the machine would tilt and drift towards
a particular side, instead of going straight. Apart from visualizing a variety of concepts
that are important to the engineering world, the robot also has a more practical
application. In more stable environments it can be used to solve puzzles and mazes,
such as the one we have prepared for demonstration. In more dynamic and dangerous
areas, the prototype is likely to do poorly. However, if all the above listed
improvements to the device are made it can be used widely by researches or even
tourists. Researchers can use it for exploration and a variety of measurements due to
all of the sensors that will be attached to it. On the other hand, it can also be used by
amateur explorers and tourists, because they can take many interesting pictures with
it and show them to their friends. The Maze robot has many applications both in
illustrating concepts and in helping people in practice.
- 16 -
Summary
The Maze Robot is a device that incorporates multiple principles of the
engineering, technology, computer science and physics spheres. Some of those
principals are the work of DC Motors, the communication between the motherboard
and all other components through our code, the work of ultrasonic sensors and so on.
The main purpose of the robot and our hypothesis is that the ultrasonic sensors can
guide it past obstacles, thus illustrating another application of these sensors. The
robot is composed of many different materials. However, the most vital ones are
from the Arduino Company. The motherboard, called Arduino Uno, serves as the brain
of the robot, because it contains the code which controls all other elements. On the
other hand, the Motor Shield is in charge of controlling the DC motors, with which the
robot moves. The construction of the Maze Robot was a complete success and it
achieved its purpose. It is able to solve the maze it has been placed in and it does not
bump into any of the maze walls. Not only that, but it also gives feedback to the user
about the distance it is going and about the turns it is taking. This way, anyone can
follow the trajectory of the robot. Our hypothesis was confirmed and the invention is
well designed for its purpose. The ultrasonic sensors prove to be an efficient tool in
directing the device. The robot is only a prototype and it is not so well adapted to go
into very dangerous environments, however, it works perfectly in more stable
environment. In order to work well into more dynamic areas, there are many
improvements that can be applied such as the addition of a camera (to give the user
better feedback), the addition of a variety of sensors (temperature sensor, radiation
sensor, humidity sensor, etc.), the addition of a flashlight and so on. Once all these
improvements are made the Maze Robot can be an efficient tool both for researchers
and for amateur explorers or tourists.
- 17 -
Technical Drawings and Further Explanation
1. Tank Tread
8. The Battery
2. One of the main wheels (with
9. The base on the second floor,
spikes)
which is identical to that of the
3. 3 smaller identical wheels
first
4. The frame which hold the axis of
10. The Arduino R3 Motor Shield
the wheels
11. The Arduino Uno motherboard
5. The second main wheel (with no
12. The Servo
spikes)
13. The Ultrasonic Sensor
6. The gearbox which spin the axis
14. The on and off switch
7. The DC motors which spin the
*Note: This layout is subject to change
gear
Arduino Uno Motherboard
- 18 -
Motor Shield
- 20 -
Gearbox assebly and inner side of one DC motor from the Double Gearbox
- 21 -
Gearbox
Assembly
One of the
two
assembled
gearboxes
with a DC
motor (black)
The Code
- 22 -
#include <NewPing.h>
#include <Servo.h>
Servo myservo;
int pos = 90;
int count = 0;
#define trigPin 7
#define echoPin 4
#define MaxDistance 100
unsigned int duration;
unsigned int distance;
unsigned int FrontDistance;
unsigned int LeftDistance;
unsigned int RightDistance;
unsigned int Time;
NewPing sonar(trigPin, echoPin, MaxDistance);
void setup() {
Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(12, OUTPUT); //Initiates Motor Channel A pin
pinMode(9, OUTPUT); //Initiates Brake Channel A pin
//Setup Channel B
pinMode(13, OUTPUT); //Initiates Motor Channel A pin
pinMode(8, OUTPUT);
//Initiates Brake Channel A pin
myservo.attach(5);
}
void loop() {
/*long duration, distance;
digitalWrite(trigPin, LOW);
// Added this line
delayMicroseconds(2); // Added this line
- 23 -
digitalWrite(trigPin, HIGH);
//
delayMicroseconds(1000); - Removed this line
delayMicroseconds(10); // Added this line
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
*/
scan();
FrontDistance = distance;
if(FrontDistance%10==0){
Serial.println("Distance before obstacle ");
Serial.print(distance);
Serial.println(" cm");
}
if ((FrontDistance < 20)&&(FrontDistance>1)) {
On/Off happens
// This is where the LED
Serial.println("Stop");
analogWrite(3, 0);
//Spins the motor on Channel A at half speed\
//Motor B backward @ half speed
analogWrite(11, 0);
//Spins the motor on Channel B at half speed
for(pos = 90; pos < 180; pos += 1)
{
// goes from 0 degrees to 180 degrees
// in steps of 1 degree
myservo.write(pos);
variable 'pos'
// tell servo to go to position in
delay(15);
position
// waits 15ms for the servo to reach the
}
delay(315);
scan();
LeftDistance=distance;
- 24 -
Serial.println("Distance to the left ");
Serial.print(LeftDistance);
Serial.println(" cm");
for(pos = 180; pos>=1; pos-=1)
// goes from 180 degrees to 0 degrees
{
myservo.write(pos);
variable 'pos'
// tell servo to go to position in
delay(15);
position
// waits 15ms for the servo to reach the
}
delay(315);
scan();
RightDistance=distance;
Serial.println("Distance to the right ");
Serial.print(RightDistance);
Serial.println(" cm");
for(pos = 1; pos<90; pos+=1)
// goes from 180 degrees to 0 degrees
{
myservo.write(pos);
variable 'pos'
// tell servo to go to position in
delay(15);
position
// waits 15ms for the servo to reach the
}
if((LeftDistance>RightDistance)&&(LeftDistance>17))
{
Serial.println("Turning left");
right();
}
else if((RightDistance>LeftDistance)&&(RightDistance>17))
{
Serial.println("Turning right");
- 25 -
left();
}
else
{
Serial.println("back");
back();
}
}
else {
digitalWrite(12, HIGH); //Establishes forward direction of Channel A
digitalWrite(9, LOW);
analogWrite(3, 70);
//Disengage the Brake for Channel A
//Spins the motor on Channel A at full speed
digitalWrite(13, HIGH); //Establishes forward direction of Channel B
digitalWrite(8, LOW);
analogWrite(11, 70);
//Disengage the Brake for Channel B
//Spins the motor on Channel B at full speed
}
}
void scan()
//This function determines
the distance things are away from the ultrasonic sensor
{
delay(50);
Time = sonar.ping();
distance = Time / US_ROUNDTRIP_CM;
}
void left()
{
digitalWrite(12, HIGH); //Establishes forward direction of Channel A
digitalWrite(9, LOW);
analogWrite(3, 120);
//Disengage the Brake for Channel A
//Spins the motor on Channel A at full speed
digitalWrite(13, LOW); //Establishes forward direction of Channel B
- 26 -
digitalWrite(8, LOW);
//Disengage the Brake for Channel B
analogWrite(11, 120);
//Spins the motor on Channel B at full speed
delay (243);
}
void back()
{
digitalWrite(12, HIGH); //Establishes forward direction of Channel A
digitalWrite(9, LOW);
analogWrite(3, 120);
//Disengage the Brake for Channel A
//Spins the motor on Channel A at full speed
digitalWrite(13, LOW); //Establishes forward direction of Channel B
digitalWrite(8, LOW);
//Disengage the Brake for Channel B
analogWrite(11, 120);
//Spins the motor on Channel B at full speed
delay (440);
}
void right()
{
digitalWrite(12, LOW); //Establishes forward direction of Channel A
digitalWrite(9, LOW);
analogWrite(3, 120);
//Disengage the Brake for Channel A
//Spins the motor on Channel A at full speed
digitalWrite(13, HIGH); //Establishes forward direction of Channel B
digitalWrite(8, LOW);
//Disengage the Brake for Channel B
analogWrite(11, 120);
//Spins the motor on Channel B at full speed
delay (243);
}
Bibliography
- 27 -
1. "11 Applications for Ultrasonic Sensors." Ultrasonic Sensors. N.p., n.d. Web. 23 Nov.
2014.
2. "Arduino - ArduinoBoardUno." Arduino. N.p., n.d. Web. 7 Mar. 2015.
3. "Arduino - ArduinoMotorShieldR3." Arduino. N.p., n.d. Web. 7 Mar. 2015.
4. Brian, Marshall. "How Electric Motors Work." HowStuffWorks. N.p., n.d. Web. 7
Mar. 2015.
5. Calin, Dragos. "Wheels vs Continuous Tracks: Advantages and Disadvantages |
Into Robotics." Into Robotics. N.p., 11 Nov. 2013. Web. 7 Mar. 2015.
6. Ihara, Ikuo, and Nagaoka University Of Technology. Ultrasonic Sensing: Fundamentals
and Its Applications to Nondestructive Evaluation (a Draft) (n.d.): n. pag. Web.
7. Khamis, Fika. "Advantages and Disadvatages of AC/DC Motor." SlideShare. N.p.,
n.d. Web. 7 Mar. 2015.
8. Paradkar, Prashant. "Ultrasonic Sensor HC-SR04 Interfacing with 8051
Microcontroller." Robotics_Projects_C/C++_Android. N.p., n.d. Web. 7 Mar.
2015.
9. "WHAT IS ARDUINO?" Arduino. N.p., n.d. Web. 7 Mar. 2015.
- 28 -
Download