Using the VEX Robotics system

bendembarrassElectronics - Devices

Nov 2, 2013 (3 years and 8 months ago)

201 views

Using the VEX Robotics system


A machine capable of carrying out a complex
series of actions automatically, esp. one
programmable by a computer.


A
robot

is a mechanical contraption which
can perform tasks on its own, or with
guidance.


In
practice a robot is usually an
electromechanical machine which is shown
what to do by computer and electronic
programming

There is no consensus on which machines
qualify as robots but there is general
agreement among experts, and the public, that
robots tend to do some or all of the following:


move around


operate
a mechanical
limb


sense
and manipulate their
environment


and
exhibit intelligent
behavior


especially
behavior which mimics humans or other
animals.

For us, a robot will have 3 features:



a
mechanical device that can move around
and manipulate its environment


uses
a
microcontroller


requires
a computer program to
operate


The robots we build may not be technically
considered true robots, primarily because they
will generally be controlled by us.


Remote Control


Wireless using some type of joystick


Uses radio frequencies to communicate


Autonomous


Performs without human guidance


A computer program tells it what to do


Has sensors to respond to its environment


Tethered


Remote but wired control


Our primary power source will be a battery


Portable


Heavy


Steady DC voltage


Needs to be recharged or replaced


May need multiple batteries with different
voltages


One for propulsion (motors), one for the controller
(joystick), one for the microcontroller


Wheels and pulleys use DC motors


A DC motor continuously rotates (
360⁰
)


Speed is controlled by the amount of DC voltage


Direction is controlled by polarity of DC voltage


Arms and grippers can use servo’s


A servo goes to a position and holds there


Typically minus 90 degrees to plus ninety degrees


Position is controlled by an electronic signal


Voltage amount given
by pulse width
modulation


Longer “on” time
means higher voltage


Higher voltage equals
higher
speed


Direction of rotation
controlled by polarity


2 wire motor connects directly to
the Cortex ports 1 and 10


2
-
Wire Motor 269, #276
-
2181, $
12.99


Requires a motor controller to
connect to any 3 wire port


Motor Controller
29, #276
-
2193, $9.99


3 wire ports produce a servo type
RC signal output


Ports 1
-
8 on the VEX PIC


Ports 2
-
9 on the VEX Cortex




Free Speed
: 100
rpm


Stall Torque
: 8.6
in
-
lbs


Stall Current
: 2.6A


Free Current
: 0.18A


All
motor
specifications are at 7.2
volts


Custom designed to connect to the
VEX structural system


Square drive shaft


2 screw connections


Note that screw connections are 6
-
32, not the more common 8
-
32


A servo is a motor
connected to a
built
-
in electronic
control unit


The control unit
coverts the input
signal to a position


The input signal is
a form of pulse
width modulation


Pulses are always 20 ms apart


50 pulses per second


Pulse width varies between 1 and 2 ms


18
-
19 ms of “dead time”


A DC motor getting this signal would spin very slowly,
if at all


The pulse width determines the servo position


1 ms = full ccw (usually
-

90⁰)


1.5 ms = middle (or null) position


2 ms = full cw (usually + 90⁰)


3 wire servo connection


Orange wire is +5 VDC power


ALWAYS the middle wire


Black wire is ground (0 VDC)


White wire is PWM signal


#276
-
2162, $
19.99


Connects directly to ports
1
-
8
on the VEX
PIC or ports
2
-
9 on
the VEX Cortex




Rotation
: 100
degrees


Stall Torque
: 6.5
in
-
lbs


Voltage
: 4.4
-

9.1 Volts


Motor
life will be reduced operating outside
this
range


Current
Draw
: 20mA
to 1.5 A per
Servo



2
screw connections


Square drive shaft


Requires a clutch


so gears don’t strip


Computers only talk in binary numbers,
which are digital signals (on or off)


Motors and servo’s use analog signals


A microcontroller can create the analog
signal, but it must use a digital to analog
converter


An 8 bit binary number is usually used to
determine or generate the analog pulse



The decimal values for the 8 bit binary
number have a range from 0


255


Decimal 0 = 00000000


Decimal 255 = 11111111


Decimal 128 = 10000000


This is the full range of speed control for both
motors and servo’s


0 = full ccw (servo) or full speed reverse (motor)


255 = full cw (servo) or full speed forward (motor)


128 = null (servo) or off (motor)


The “brains” of the robot


#276
-
2170, $149.99


All
electronic
system components
must
connect
to the
controller


The
Microcontroller contains the
robot's
program


P
rocesses
all
signals


F
rom human operators


From onboard
sensor
systems


M
anages all power on the robot


Directly
controls the motors.



Wireless
communication


75 MHz
receiver and
transmitter


(8) Motor
and/or servo ports


3 wire connections


Provides higher current than I/O ports


(16) multipurpose input/output ports for sensors


(6) Interrupt I/O


(1) Serial
Port


For use
with the VEX Programming Kit


Programmable with
easyC V2,
ROBOTC, or
MPLAB


More powerful than the PIC


Advanced STMicroelectronics
ARM
Cortex
-
M3 microprocessor


#276
-
2194, $249.99


Programmable with
EasyC

V4


VEXnet

wireless technology


E
thernet
communications protocol
802.11 b/g


USB
Adapter Keys




Built
-
in VEXnet Technology


Wireless driving, wireless debugging, and wireless
program downloading


(8) standard 3
-
wire Motor or Servo ports


(2) high current 2
-
wire Motor ports


(8) high
-
res Analog Inputs, (12) fast Digital I/Os


A
ll can be
used as interrupts


S
upport for two 75 MHz transmitters and receivers


Rx1
and Rx2
Ports


I2C Smart Sensor
Port


Will
connect to multiple new smart sensors in the
future



Gears are used for several things:



To increase the speed of rotation


To increase the torque, or the rotating force
applied to a load


Gears trade one for the other



If you use gears to increase speed, torque
will decrease


If you use gears to increase torque, speed
will decrease


Gears use teeth to transmit torque


Teeth must be the same size, even on different
size gears


The number of teeth varies for different size
gears


A smaller gear has fewer teeth


A larger gear has more teeth


A big gear driving a small gear increases speed


A small gear driving a big gear increases torque


The ratio of the number of gear teeth equals
the ratio of the torque




{ Assume gear one (g
1
) driving gear two (g
2
) }


𝑔
1
𝑔
2

=

1

2



The ratio of gear teeth equals the inverse
ratio of the speed


𝑔
1
𝑔
2

=

2

1



The structural subsystem of the robot
is responsible for physical
support.


H
olds
everything in
place


T
he
durable “skeleton” of the robot to
which all the other subsystems are
attached.


The
Structure and Motion
sub
-
systems
are
tightly
integrated

to
form the chassis of the robot.


2 types of screw


6
-
32 and 8
-
32


Keps nuts


Square drive shaft


Bearing flat


Spacers and friction reducers


Metal sized by number of holes

5 X 15

1 X 25


Allen wrench (also called an L
-
wrench)


2 sizes:
5
64


” and
3
32





Open ended wrench


Screwdrivers


Flat head and Phillips


Needle nose pliers and diagonal cutters


Crescent wrench


Vice


Dremel

tool to cut and smooth metal


Start with the 2005 VEX Inventors Guide


http://
content.vexrobotics.com/docs/inventors
-
guide/main/vex
-
inventers
-
guide
-
9
-
27
-
06.pdf


Download this to a computer or flash drive


Build the
S
quarebot following the
instructions starting on page 2
-
6


pg. 19 (of 246) in the pdf


As you build, make sure you read carefully:
there may be some test questions!


Go completely through section 2 of the VEX
Inventors guide


2
-
6 through 2
-
37


3
-
1 through 3
-
14 and 3
-
21 (suggested)


4
-
8


7
-
1 through 7
-
8


If using the PIC, section 6


Adding sensors, section 5



A rubric will be used to assess student
performance



To program the robot you need both software
and
hardware


The
software is the computer program we use
to write the program that goes into the
VEX


T
he
hardware
has two pieces:


T
he
VEX controller
itself


T
he
cable that connects the computer to the
controller
so you can
download the program you
write

into the microcontroller


The VEX Cortex is
programmed with
easyC

V4


easyC

uses graphics based
drag and drop programming


Includes a full
C text editor
for
advanced programming


Download to the robot
wirelessly over
VEXnet

or
directly using
USB





The VEX PIC is an older, less powerful
microcontroller than the Cortex


Uses a Microchip microcontroller


PIC is an acronym that stands for
Programmable Interface Controller


It could also mean Peripheral Interface
Controller


Programmed with
easyC

V2


Not

compatible with
easyC

V4



The programs you write are a form of user code
called project
files


A robot only does what the program tells it to do


Select
“new project” to
create
a brand new
program


S
elect
“open project” to open an existing
project


VEX
includes a couple of programs built in to
EasyC


T
he
default code and the test
code


These
programs will set up or restore your robot to an
“out of box”
condition

Screenshot of
easyC

V4 startup window

Opens IFI/
Intelitek

Loader window

Click here to set COM port

Function Block Window

Drag and drop these into the
programming window

Block Programming Window

Shows your code in a graphic block
diagram format

“C” Code Window

Shows code in text format


These are some of the basics


You are now ready to practice


Download the programming guide:
http
://
content.vexrobotics.com/docs/inventor
s
-
guide/programming
-
guide.pdf


Copy to hard drive or flash drive


This guide is for the PIC. At this time, there is
no equivalent guide for the Cortex


Programming is very similar




Programming practice starts on page 8
-
20


If
the software is already installed


To check the COM port see pages 8
-
11 and 8
-
12


To download test code see pages 8
-
13 through 8
-
19


The first user program starts on page 8
-
23


Complete programs one and two


Your first objective: make the robot drive
straight for 5 seconds



Before moving on to program 3, add a second
objective:


Drive completely around a table and stop at
exactly the same place you began



You have to make the robot turn 4 times
and

go
straight 4 times


Students do not need sensors for these objectives


Add sensors per section 5 in the inventors
guide for programs 3 and above


Program 3 adds bumper sensors


Your robot is still autonomous


It only does what the program tells it to do


Your robot needs to move away from the obstacle


The use of sensors requires the use of
program loops


The simplest sensor has only 2 conditions


A

simple loop can respond to 2 conditions
easily


A program that runs the same section of code
over and over


Necessary when waiting for an input while
performing other tasks


Generating video while waiting for user input


Driving around until bumping into an object


Performing a particular task only when a specific
condition is present


Most programs involve one or more loops


Infinite loops


Usually the main program loop


Can also be the result of programming error


Example:
while


Counting loops


Performs a specified number of times


Example:
for


Conditional loops


Performs a specific action as a result of a specific input


Example:
if, else


A variable must be defined before you can use it


During initialization, before the main program loop


Anytime you have a condition to evaluate you
have data


Data requires a name and a memory location


Defining a variable does both of those things


Data size is both how big the number can be and
the amount of memory used to store it


Char = 8 bits (0
-
255),
int

= 16 bits (0
-
65,535)


Complete programs 3 through 6 in the
programming guide


Pages 8
-
32 through 8
-
49


Demonstrate your working robot to the
teacher after completion of each program


Track your progress in your lab notebook


Congratulations, you are now an official
roboticist
!