|
R/C Servo driven robot |
SpectroTECH Hardware: |
| |
SpectroBUS18 - Robot glue |
| SpectroSMC - Servo Motion Controller |
| SpectroLCD - Liquid Crystal Display controller |
| SpectroKEY - Matrix KEYpad controller |
| Other Hardware: |
| |
Two standard servos (Pan & Tilt assembly) |
| Pan & Tilt servo brackets |
| 4 "AA" cell battery pack for SpectroBUS18 |
| 5 "D" cell battery pack for servo's |
| Robot base kit with modified servos and wheels |
| SRF08 - Range Finder Sonar |
| PACTEC PS47-200 plastic enclosure |
|
Click for larger image |
Click for larger image |
|
Click for larger image |
Click for larger image |
|
General |
Robotics has become an extremely popular subject in the past several
years, this is in part due to the readily available mechanical
hardware and powerful micro controllers that can pack a whole lot of
punch for the buck. With interest growing, magazines such as “Servo”
are dedicated exclusively to the construction of robots and various
systems used in robotics, additionally these magazines provide a wealth of great
information and resources for finding robot parts.
Spectro Technologies, Inc. provides all of the
primary control components required to build a sophisticated “brain”
for your robot with the ability to integrate many third party
components with ease. The robot project discussed here will
demonstrate just how easy it can be to put together a great little
mobile robot using readily available parts and systems and then
integrate them simply using SpectroBUS18 as the “glue”.
Some of the main features of this robot include:
● Two wheel drive system using servos
modified for continuous rotation.
● Trailing caster third wheel.
● Two individual rechargeable ni-mh
battery packs, one for the servo
power and the second for the control system (SpectroBUS18, Smart
Device modules and Sonar).
● Collision avoidance system using a
SRF08 sonar range finder.
● Sonar pan and tilt mechanism
using two servos.
● User interface including a twelve key
matrix key-pad and a sixteen by two row liquid crystal display (LCD).
The first of our pictures below shows the underside of the hex platform and the
two servo drive system.
|
|
Hardware |
|
Click for larger image |
All of what you see in the picture to
the left comes in a kit from Hobby Robotics. The kit includes:
- One Base
- Two upper decks
- Two servos modified for continuous rotation
- Two servo wheels with rubber o-ring tires
- Two sets of servo mounting brackets
- One small metal caster
- All required nuts, bolts, spacers and screwsThe picture shows
the assembled underside of the three wheeled robot. At the front of the base
are
two standard size servos that have been modified for continuous
rotation, these servos are responsible for forward and backward
motion as well as the steering. The trailing caster supports the
rear of the robot and will allow the robot to turn within it's own
length. |
| Looking
at the topside of the base you can see the five D cell ni-mh
batteries,
these cells combined
yield a total of 6 Volts with each cell producing 9000 mAh. The five D cells are used to
power the two drive servos and the pan and tilt servos used for the
sonar range finder which is mounted on the top deck. Now, notice the black battery
pack to the right of the four D cell pack, this pack holds four AA cell
ni-mh batteries producing 4.8 volts total and is used to power the SpectroBUS18,
SpectroTech smart device modules and the
SRF08 range finder.
To facilitate connectivity from deck to deck we
made a small circuit board and connected the wires from both battery
packs that ultimately terminated at two
2-pin male square post headers. This acted as a "quick connect"
making it easy for the removal of the
upper deck where the brains are mounted. The circuit board also
hosts
a power on LED and a DPDT slide switch used as the master on/off for both power systems. |
Click for larger image |
|
Click for larger image |
Mounted on the top deck is
the base of a PACTEC @@@ plastic enclosure, inside the base we mounted the SpectroBUS18 development system. Looking at the left-most
side of the picture, SpectroLCD has been placed into slot "A", next
to that is SpectroKEY, slot "C" is empty, our prototype SpectroSMC
occupies slot "D" and finally SpectroIA-3 has been placed into the
last slot, slot "F". The black and white
wires connected to the SpectroSMC servo are used for the 6 Volt
supply from the five D cell batteries and power the servos. The
black and red wires located to the front of SpectroBUS connect the 4.8
volts that powers SpectroBUS and all SpectroTech device modules.
This connection is made using a 2-pin female housing and connects
to the Vdd and Gnd of the BMON connecter. |
|
The top of the PACTEC enclosure has been fitted with the 2 x 16
character display as supplied with SpectroLCD. Mounted below the LCD
is a 12 key pushbutton matrix keypad available from Jameco. Located
at the front of the enclosure is the pan and tilt assembly
supporting the SRF08 range finder. The LCD and the keypad connect to
the SpectroBUS using the 12 and 8 conductor ribbon
cables as supplied with SpectroLCD and SpectroKEY respectively. The other wires in the picture are for the sonar and the
tilt servo. The pan and tilt assembly is
available from several sources on the internet or you can build your
own with a few pieces of plastic and a little time. The wires for
the sonar and the tilt servo are run through a piece of black 1/2 inch
split loom tubing. |
Click for lager image |
|
Click for larger image |
Looking at the
inside of the PACTEC enclosure the backside of the LCD can be seen
with the LCDA2 adapter card and ribbon cable. Directly above the LCD
notice the vertically mounted KPA2 keypad adapter board. The pins
from the 12 button keypad were bent to 90° and
the KPA2 adapter board mounted vertically. This was necessary to
facilitate the placement of both the 16 x 2 LCD and the 12 button
keypad in such close proximity. Mounted at the front of the
enclosure is a standard sized servo
which is used to drive the pan mechanism of the sonar.
The connections for the tilt servo and
the SRF08 sonar are all routed through the split loom tubing and can
be seen entering the enclosure just about dead center. |
|
Control Systems |
|
Lets talk about
the control systems and how they all interact to make this object
avoiding robot. The "glue" for this robot is the SpectroBUS18
development system.
● SpectroBUS18 has
been configured to use the SpectroXTAL oscillator card running at 16mHz, with the
HOST clock speed not being critical in this application you could
use any speed SpectroXTAL or SpectroCLK card. It is suggested
however, that you use a SpectroXTAL card as SpectroXTAL requires less power
to operate and as with any battery application power requirements
are always a concern.
SpectroBUS18 Configurations: The SpectroBUS18
and all device modules utilized the factory default port
settings of Port B. This allowed us to use Port A and
specifically the analog-to-digital capabilities of Port A of the
PIC16F88 MCU. The LED jumper can be removed as the LED is not visible
when the PACTEC enclosure is assembled and more importantly will
increase the un-necessary battery drain. For convenience the BMON
connector was used to connect the power-in connection as follows;
the BMON GND pin was connected to the negative (-) and
the VDD terminal was connected to the (+) side of the 4.8 volt
AA battery pack. When the SpectroBUS slide switch is in the OFF position the
SpectroBUS18 on-board voltage regulator circuit will be isolated and
protected from any reverse voltage damage. As mentioned earlier, a SpectroXTAL
oscillator card running at 16 MHz was used to clock the HOST
PIC16F88 on the SpectroBUS18. The HOST clock speed is not critical for
the robot performance so any clock oscillator speed will work fine. SpectroXTAL oscillator cards only use a few milliamps and
consequently are the best choice for power conscious projects like
this. Please see the
SpectroBUS18 user manual for more
information. Additionally, please see the
SpectroXTAL user manual
for details on the oscillator card.
● SpectroLCD was used with the
factory supplied backlit 16 character by 2 row liquid crystal
display and was mounted on top of the PACTEC enclose as discussed
earlier. SpectroLCD has the built-in ability to generate a bar-graph display
and is used to show
a graphical status
of the control battery power. This was simply a mater of using one
of the on-board
analog-to-digital converters (ADC) port pin A0 of the PIC16F88. By
simply running a short wire from the SpectroIA3 interface
adapter VDD screw terminal to the PORT A0
screw terminal, a few lines of code and we have all that is needed
to monitor an display the status of the battery pack. Later you will
see the PICBasic Pro code responsible for reading the
voltage present at port pin A0 and then sending that value to
the SpectroLCD using the appropriate bar-graph command decimal 47.
SpectroLCD Configurations:
No custom firmware settings were needed so SpectroLCD only required
the dip switches to be set for the desired device address.
Please see the
SpectroLCD user manual for more
information.
● SpectroKEY and a
twelve button matrix keypad available from Jameco and other electronic suppliers
was used for user input. Various robot behavior programs can be selected, exercising each of the servos
and selecting what status information
is to be displayed on the LCD are all selectable using the matrix keypad. SpectroKEY Configurations:
The table 2 option was used so the appropriate ASCII character is
returned for the corresponding key instead of the default decimal 1
through 12 values. The table option was set using bits 11 through
9 of the DCPA parameter word with a value of binary 010.
Please see the
SpectroKEY user manual for more
information. ● SpectroSMC
is the servo controller and has the ability of controlling up to
eight radio control (RC) servos. Typically servos are designed for
applications that use only about 90° of motion and sometimes less
than that. The actual ability of a servo may be closer to 180° and
in some robotic applications a modified servo allowing continuous
rotation may also be required. SpectroSMC is an extremely powerful
servo controller and is capable of controlling servos through their
entire range of actual motion, 180° or more. Additionally two servos
that have been modified for continuous rotation can be controlled
making them ideal for robot mobility systems. Even very small servos have
lots of power and can quite easily move heavy robot systems,
additionally, R/C servos can very
accurately move in small increments for precision applications.
SpectroSMC makes controlling modified servos easy, sending commands like
"F", "B" and "S" for forward, backward and stop respectively.
Sending a value in the range of 400 to 1600 to most standard servos
will move them from their leftmost potion to their rightmost
position. Unlike most commercially available controllers SpectroSMC
has the ability to move all servos simultaneously which allows
multiple servos to move with fluid like movements. Most other
controllers can only move one servo at a time this can yield very
mechanical type movements. Consider a robotic arm with four degrees
of movement (4 servos) Shoulder, Elbow, Wrist and Gripper. Now, you
need to move three servos to positions so as to correctly align the
gripper. SpectroSMC will allow you to send position values to all
servos at the same time, this is called a group move, all servos
will begin to move at the same time and then all finish at the
same time, this is regardless of how far any individual servo may
need to move. A servo that needs to move 10° will start and
finish moving at the same time as a servo that is commanded to move
180° within the same group move.
The group command can be turned of if
desired, this will cause each command to be executed one at a time
or sequentially.
There are many commands available including the ability to set the
starting position of each servo with the "P" command. Using the "H" command will move all
servos to the Home position as previously set with the "P" command.
Please see the
SpectroSMC user manual for more
information.
|
|
To the right is a code fragment the shows the main range finding
loop that simply turns the robot to the left if an object is
encountered within the specified range. To see the entire code
listing, Please see the
Object avioding PIC Basic Pro code for more
information. |
' Variable and
Pin assignment
LIGHT VAR BYTE
RANGE VAR WORD
MOVE VAR WORD
VER VAR BYTE
SDA VAR PORTA.0
SCL VAR PORTA.1
SRF08 CON $E0MAIN:
i2cwrite 0,[81]
PAUSE 70
i2cread SDA,SCL,$E0,0,[VER,LIGHT,RANGE]
IF RANGE > 20 THEN
BUF[0]="L" : BUF[1]="F"
' Left Wheel
Forward
BUF[2]="R" : BUF[3]="F"
' Right Wheel
Forward
DPL = 4
' Set Buffer length
ELSE
BUF[0]="L" : BUF[1]="B"
' Left Wheel
Backward
BUF[2]="R" : BUF[3]="S"
' Right Wheel Stop
DPL=4
ENDIF
DEVICE = 2
' SpectroSMC device
id GOSUB
WRITE_DEVICE
' Send commands
GOTO MAIN |