logo

Arduino Shied-Bot Autonomous Drive

This project entails making the shield robot move about autonomously. This will involve using Arduino software to create a code for the robot to work without being controlled. It will include insertion of proximity and distance sensors and actuators. This article discusses the whole process.

7 Pages6412 Words214 Views
   

Added on  2022-08-16

About This Document

country code 1st author's E-mail address 2nd Author 2nd author's affiliation 1st line of address 2nd line of address Telephone number, incl. country code 2nd E-mail 3rd Author 3rd author's affiliation 1st line of address 2nd line of address Telephone number, incl.

Arduino Shied-Bot Autonomous Drive

This project entails making the shield robot move about autonomously. This will involve using Arduino software to create a code for the robot to work without being controlled. It will include insertion of proximity and distance sensors and actuators. This article discusses the whole process.

   Added on 2022-08-16

ShareRelated Documents
Arduino Shied-Bot Autonomous Drive
1st Author
1st author's affiliation
1st line of address
2nd line of address
Telephone number, incl. country code
1st author's E-mail address
2nd Author
2nd author's affiliation
1st line of address
2nd line of address
Telephone number, incl. country code
2nd E-mail
3rd Author
3rd author's affiliation
1st line of address
2nd line of address
Telephone number, incl. country code
3rd E-mail
ABSTRACT
This project entails making the shield robot move about
autonomously. This will involve using Arduino software to create
a code for the robot to work without being controlled. It will
include insertion of proximity and distance sensors and actuators.
This article discusses the whole process.
Keywords
Arduino software, Shield-Bot, autonomous drive, robotics,
coding.
1. INTRODUCTION
The Shield Bot is a programmable mobile robot that uses an
Arduino board. The robot is programmable using the Arduino
programming environment and provides a breadboard to easily
add your electronic components, sensors or your own electronic
circuits [1].
The Shield Bot is a stackable Arduino Shield that transforms your
Arduino into a fully featured beginner robot. The Shield Bot has
been designed and specially equipped with on board line
following sensors and expansion ports to be the robotic buddy that
will teach you about robotics, electronics, and programming. It is
also packed full of expansion ports so it can also be the perfect
base for any desktop robotics project!
2. PROJECT
2.1. The Approach
The challenge is to make the Shield Bot move autonomously in a
straight line for exactly 2 metres on a track of unknown terrain,
which may also contain inclines or declines, pausing for 5 seconds
and then turning 180o to return to its starting position.
The aim of this project is to create a rover that is able to
independently follow a certain line path traced on the floor. The
identification of the path is done by the five sensors integrated on
the Shield Bot 1.2 rover. Also, a manual mode has been
implemented, to drive through user's command, received via
Serial line.
3. DESIGN
This project is based on the Arduino rover, so you can review
the Assemble the Rover and Electrical Assembly Steps. I have
added detailed directions, as I have changed the orientation of the
Arduino101 mount point and use a second motor controller to
reduce likely hood of loose wires after collisions [2].
Mount the Arduino and Motor Controllers Mount the
Arduino101 onto the acrylic mounting plate and secure it with the
metal screws. Mount the motor controller onto the acrylic
mounting plate and secure it with the small metal screws. Set the
motor controller so that the one mounted in the middle is 1, and
the one in the front is 2.
Figure 1: The shield-Bot
Assemble the power cables – The battery pack splits the output
between the motors and other devices. Assemble the power cables
as shown in the picture.
Power cables and motor wires – Pass the power cables and motor
wires through the acrylic mounting plate. Note the location of the
motor controller terminals; try to route the motor wires closer to
them [3].
Wire motors to motor controllers – There are a total of 8 wires (2
per motor) color coded in pairs. Connect each motor to the motor
controllers based on the following: right side motor wires go to
1
Arduino Shied-Bot Autonomous Drive_1
the motor controller terminals in the middle of the chassis; left
side motor wires go to the motor controller terminals in the front
of the chassis.
Figure 2: The Shield-Bot
Wire power cables Wire the power cables to the motor
controllers (red is positive, black is negative). Make sure to
tighten all terminals to prevent wires from disconnecting [4].
Installing the Grove Shield – Insert the Grove shield onto the
Arduino breakout board. Connect the motor controllers to the
Grove Shield in any I2C labelled port using the Grove cables.
Mounting the Acrylic Plate and Add Sensors – Secure the acrylic
plate to the main chassis using the four brass connectors. Connect
the Grove LED to Grove Shield port D2.
Figure 3: The sensor
Mounting the Aluminum Plate – Secure the aluminum mounting
plate on top of the acrylic. Installing the wheels – Install the 4
wheels onto the drive shaft mounting plate using the screw.
The shield-Bot has some features which include; Easy to start:
The ShieldBot is plug & play, so can be ready to use within a few
minutes; Expandable: solderless grove expansion ports enable
easy attachment of more sensors, and shield headers allow the use
of additional Arduino shields; Open Source: Its designed to be
modified, adapted and transformed into whatever you want, and
Arduino Based: The ShieldBot is an Arduino shield, so the
extensive Arduino community and shield ecosystem will make
your project ideas limitless!
3.1. Programming the Shield-Bot
Connect the DC barrel jack to the Arduino 101. Connect the Li-Po
battery to the Dean’s male Traxxas connection. Connect a USB
programming cable to the Arduino 101 and to your computer.
I use the same Arduino101 and Grove Motor Controller as
the Programming the Arduino101 for a basic rover so check it out
for an overview of how BLE is setup, and the motors are
controlled using the Grove Motor Controller. Since the original
base model code used one motor controller, and two are used
here, there are some basic changes that I had to make.
However, the first major extension that I added was to process the
whole UART transmitted string instead just the first character.
This allows the commands between the rover and the BLE mobile
device to be more human readable. For example, “a” go forward
became: “Auto: Up” and “b” turn left became: “Auto: Left” [5].
To make the BOE Shield-Bot go forward, its left wheel has to turn
counterclockwise, but its right wheel has to turn clockwise.
Remember that a sketch can use the Servo library’s write
Microseconds function to control the speed and direction of each
servo. Then, it can use the delay function to keep the servos
running for certain amounts of time before choosing new speeds
and directions. Here’s an example that will make the BOE Shield-
Bot roll forward for about three seconds, and then stop. Example
Sketch: Forward ThreeSeconds Make sure the BOE Shield’s
power switch is set to 1 and the battery pack is plugged into the
Arduino. Create and save the ForwardThreeSeconds sketch, and
run it on the Arduino. Disconnect the programing cable and put
the BOE Shield-Bot on the floor. While holding down the Reset
button, move the switch to position 3, and then let go. The BOE
Shield-Bot should drive forward for three seconds.
A sketch automatically starts in its setup function. It runs the code
in there once before moving on to the loop function, which
automatically keeps repeating. Since we only want the BOE
Shield-Bot to go forward and stop once, all the code can be placed
in the setup function. This leaves the loop function empty, but
that’s okay. Chapter 4 BOE Shield-Bot Navigation 106
Robotics with the BOE Shield-Bot As with all motion sketches,
the first action setup takes is making the piezospeaker beep. The
tone function call transmits a signal to digital pin 4 that makes the
piezospeaker play a 3 kHz tone that lasts for 1 second. Since the
tone function works in the background while the code moves on,
delay (1000) prevents the BOE Shield-Bot from moving until the
tone is done playing
Next, the servoLeft object instance gets attached to digital pin 13
and the servoRight instance gets attached to pin 12. This makes
calls to servoLeft.writeMicroseconds affect the servo control
signals sent on pin 13. Likewise, servoRight.writeMicroseconds
calls will affect the signals sent on pin 12.
Remember that we need the BOE Shield-Bot’s left and right
wheels to turn in opposite directions to drive forward. The
function call servoLeft.writeMicroseconds (1700) makes the left
servo turn full speed counterclockwise, and the function call
servoRight.writeMicroseconds (1300) makes the right wheel turn
full speed clockwise. The result is forward motion. The delay
(3000) function call keeps the servos running at that speed for
three full seconds. After the delay, servoLeft.detach and
servoRight.detach discontinue the servo signals, which bring the
robot to a stop
After the setup function runs out of code, the sketch automatically
advances to the loop function, which repeats itself indefinitely. In
this case, we are leaving it empty because the sketch is done, so it
2
Arduino Shied-Bot Autonomous Drive_2
repeWant to change the distance traveled? Just change the time in
delay (3000). For example,
Delay (1500) will make the BOE Shield-Bot go for only half the
time, which in turn will make It travel only half as far. Likewise,
delay (6000) will make it go for twice the time, and therefore
twice the distance.
Change delay (3000) to delay (1500) and re-load the sketch. Did
the Shield-Bot travel only half the distance
All it takes to get other motions out of your BOE Shield-Bot are
different combinations of us parameters in your servoLeft and
servoRight writeMicroseconds calls. For example, these two calls
will make your Shield-Bot go backwards.
You can make the Shield-Bot turn by pivoting around one wheel.
The trick is to keep one wheel still while the other rotates. Here
are the four routines for forward and backward pivot turns.
Let’s say that your Shield-Bot gradually turns left. That means the
right wheel is turning faster than the left. Since the left wheel is
already going as fast as it possibly can, the right wheel needs to be
slowed down to straighten out the robot’s path. To slow it down,
change parameter in servoRight.writeMicroseconds (us) to a value
closer to 1500. First, try 1400. Is it still going too fast? Raise it
1410. Keep raising the parameter by 10 until the BOE Shield-Bot
no longer curves to the left. If any adjustment overshoots
‘straight’ and your Shield-Bot starts curving to the right instead,
start decreasing the parameter by smaller amounts. Keep refining
that us parameter until your Shield-Bot goes straight forward. This
is called an iterative process, meaning that it takes repeated tries
and refinements to get to the right value.
3.2. Adding autonomous mode
I added a Grove 80cm Infrared Proximity Sensor to the front of
the rover to detect oncoming obstacles. It is attached to the Grove
shield at port A0 by a Grove cable. By using the code snippet on
the sensor’s wiki, I found that I could detect obstacles with
enough time to react when the analog voltage was >1. With the
second major extension of the base rover code, I added support for
an autonomous mode, where when the UART sends a string
“Auto: Auto” the rover drives forward until an obstacle is
detected, and then the rover will alternate turning left and right for
avoidance [6].
Ultrasonic Distance Sensor on a servo turret mounts on the front
of the Shield-Bot, for autonomous navigation. The ultrasonic
distance sensor detects objects up to 10 feet (3 m) away. When an
obstacle is detected, the Shield-Bot stops, sweeps the sensor from
side to side, and then turns down the clear path. Ultrasonic
distance sensors work well in strong sunlight where infrared
sensors are overwhelmed, making this a good choice for bright
environments or direct sunlight.
In many robotics contests, more precise robot navigation means
better scores. One popular entry-level robotics contest is called
dead reckoning. The entire goal of this contest is to make your
robot go to one or more locations and then return to exactly where
it started. You might remember asking your parents this question,
over and over again, while on your way to a vacation destination
or relatives’ house: “Are we there yet?” Perhaps when you got a
little older, and learned division in school, you started watching
the road signs to see how far it was to the destination city. Next,
you checked the car’s speedometer. By dividing the speed into the
distance, you got a pretty good estimate of the time it would take
to get there. You may not have been thinking in these exact terms,
but here is the equation you were using;
time= distance
speed
You can do the same exercise with the BOE Shield-Bot, except
you have control over how far away the destination is. Here’s the
equation you will use:
servo run time= shield bot distance
shield bot speed
Create, save, and run the sketch ForwardOneSecond. Place your
BOE Shield-Bot next to a ruler. Make sure to line up the point
where the wheel touches the ground with the 0 in/cm position on
the ruler.
Press the Reset button on your board to re-run the sketch.
Measure how far your BOE Shield-Bot traveled by recording the
measurement where the wheel is now touching the ground
here:_______________ (in or cm).
The distance you just recorded is your BOE Shield-Bot’s speed, in
units per second. Now, you can figure out how many seconds
your BOE Shield-Bot has to travel to go a particular distance.
Keep in mind that your calculations will be in terms of seconds,
but the delay function will need a parameter that’s in terms of
milliseconds. So, take your result, which is in terms of seconds,
and multiply it by 1000. Then, use that value in your delay
function call. For example, to make your BOE Shield-Bot run for
2.22 seconds, you’d use delay (2220) after your
writeMicroseconds calls.
The light sensors in your Robotics Shield Kit respond to visible
light, and also to an invisible type of light called infrared. These
sensors can be used in different circuits that the Arduino can
monitor to detect variations in light level. With this information,
your sketch can be expanded to make the Shield-Bot navigate by
light, such as driving toward a flashlight beam or an open
doorway letting light into a dark room.
A transistor is like a valve that regulates the amount of electric
current that passes through two of its three terminals. The third
terminal controls just how much current passes through the other
two. Depending on the type of transistor, the current flow can be
controlled by voltage, current, or in the case of the
phototransistor, by light. The drawing below shows the schematic
and part drawing of the phototransistor in your Robotics Shield
Kit. The brightness of the light shining on the phototransistor’s
base (B) terminal determines how much current it will allow to
pass into its collector (C) terminal, and out through its emitter (E)
terminal. Brighter light results in more current; less-bright light
results in less current.
The phototransistor looks a little bit like an LED. The two devices
do have two similarities. First, if you connect the phototransistor
in the circuit backwards, it won’t work right. Second, it also has
two different length pins and a flat spot on its plastic case for
3
Arduino Shied-Bot Autonomous Drive_3

End of preview

Want to access all the pages? Upload your documents or become a member.