by
Randy Innerarity
Physics 476.001
Summer II, 2003
The original Word file and other documents can be found here:
http://observe.phy.sfasu.edu/courses/phy475/Innerarity2003/Phy476/
The project began with a remote controlled H1 Hummer replica manufactured by Enertec. The Enertec Hummer is a good choice for a basic robotics platform because of its simple steering mechanism. Many RC vehicles use servo motors to steer the front wheels. The Hummer, on the other hand, uses a small permanent magnet motor to drive a slip clutch mechanism that moves a tie rod to the front wheels. This arrangement is more complex from a mechanical point of view but much simpler to control electrically. The Hummer is driven by a permanent magnet motor through a two speed, switch selectable gearbox. A 9.6-volt rechargeable Ni-Cd battery pack provides power for the vehicle. The center section of the vehicle houses the original circuit board that functions as an RF receiver and motor control bridge. The Hummer also has independent front suspension and coil spring rear suspension.
Enertec RC Hummer.
The Hummer's rf/motor control circuit board contains a single 18-pin IC that controls the steering and drive motors in response to remote control radio signals. Pins 3, 4, 15, and 16 control the forward, reverse, right, and left functions, respectively. Each of these IC pins produce 2.8 volts when activated. These pins feed their respective motor control circuit through a 2.2k resistor. To save money on the project, the original motor control circuits were used by de-soldering the IC ends of the resistors from the board and attaching wires to them. R14 and R18 connect to right and left steering while R22 and R23 connect to forward and reverse. This effectively disconnects the RF section and IC from the rest of the circuit. The wires lead to the driver board mentioned below. This board takes signals from the logic board and produces the 2.8-volts needed to activate the motors. The new wires are secured to the circuit board with a drop of hot glue to act as a strain relief.
Using a remote controlled vehicle for a robotics base has one major drawback. These vehicles are much too fast for most robotics applications. For this reason, a 10 Ohm, 10-Watt power resistor is used to reduce the drive motor speed.
An acrylic carrier board is used in place of the Hummer body to provide a mounting area for circuit boards and future equipment.
The figure below shows the new wires attached to the de-soldered resistor ends.
Two single pole-single throw momentary switches provide sensory input to the robot. The switches are attached to each end of an acrylic strip which is mounted to the front bumper of the Rover. A spring steel strip is mounted ahead of the switches to provide a wider contact point and offer some protection for the switch plungers. The wiring for the switches is shown on the logic board schematic. The photo below shows the sensor assembly.
|
Sensor assembly. |
The motor control circuits on the original circuit board require 2.8 volts to
activate the steering and drive motors.
The driver/regulator board transforms the 5-volt logic level signal
supplied by the microcontroller to the 2.8-volt driver level for the motor
controls. The schematic for the
driver/regulator board is shown below.
It consists of four identical emitter follower stages, one for forward,
reverse, right, and left. The emitter
resistors form a voltage divider that provides the required 2.8-volts when the
transistor is fully on. A 7805 voltage
regulator is also provided to supply 5-volt power to the drivers and a
microcontroller or other equipment.
The photo below shows the completed driver/regulator board. Note the blue PC mount terminals for the
5-volt power, motor board, and logic board wiring. This allows different microcontrollers and other equipment to be
quickly connected and disconnected.
A PIC 16F84-04P microcontroller serves as the brain of the system and can be found on the logic board. This chip contains 68 bytes of RAM and 1k of program memory. The PIC accepts inputs from the sensor switches and routes the appropriate forward, reverse, right, and left signals to the driver board. A schematic diagram for the logic board is shown below.
The logic board was assembled on a RadioShack universal printed circuit board and provides an 18-pin IC socket for the PIC. The following photo shows the completed logic board.
The Rover program continuously scans the sensors in an infinite loop. When an obstacle is encountered, the program calls either the ALO subroutine to "Avoid Left Obstacle " or the ARO subroutine to "Avoid Right Obstacle". These subroutines stop the vehicle, turn the wheels in the proper direction, reverse the motor for a time, and finally continue on a straight path. Two time delay subroutines are called by the AOL and AOR subroutines as needed to smooth the operation of the robot. The program is written in PIC Assembly language. A complete program listing and documentation is shown below.
SFA Rover Program Listing.
--------------------------------------------------------------------------------------------------------------------------------------------
;File: SFARover.asm
;Version: 1.3
;Program function:
;This program monitors two front impact switches and executes an appropriate
;collision avoidance routine.
;CPU Configuration
;PIC16F84, RC Oscillator, Watchdog timer Off, Power-up timer ON.
processor 16f84
include <p16f84.inc>
__config _RC_OSC &_WDT_OFF &_PWRTE_ON
;Variable declaration
J equ H'1E'
K equ H'1F'
;Main program
org 0 ;Start program at address zero.
;Initialize Ports
;PORTA: RA0 = Left switch, RA1 = Right switch.
;PORTB: RB0 = Drive Fwd, RB1 = Drive Rev, RB2 = Left turn, RB3 = Right turn.
;Make sure that all PORTB lines are off.
clrf PORTB ;Clear PORTB.
;Set port functions.
movlw B'00011' ;Move binary 00011 to w register.
banksel TRISA ;Select bank with TRISA in it.
movwf TRISA ;Set PORTA for input on pins RA0 and RA1.
clrf TRISB ;PORTB all zeros (all pins are outputs).
banksel PORTB ;Go back to bank 0.
;Set initial port values.
clrf PORTB ;PORTB set to all zeros.
movlw B'00000001' ;Move binary 1 to w register.
movwf PORTB ;Move binary 1 to PORTB (Wheels straight, drive on).
;Scan input switches.
scan btfsc PORTA,0 ;Is PORTA, pin 0 high?
call ALO ;Call Avoid Left Obstacle subroutine.
btfsc PORTA,1 ;Is PORTA, pin 1 high?
call ARO ;Call Avoid Right Obsatcle subroutine.
goto scan ;Check switches again.
;Subroutines follow ***********************************************************************
;Avoid Left Obsatcle
ALO clrf PORTB ;Stop the motor.
call DELAY1 ;Stop delay here.
movlw B'00000110'
movwf PORTB ;Turn left, reverse motor.
call DELAY2 ;Run delay here
clrf PORTB ;Stop the motor.
call DELAY1 ;Stop delay here.
movlw B'00000001' ;w = binary 1.
movwf PORTB ;Wheel straight, motor on.
return ;Return to main program.
;Avoid Right Obsatcle
ARO clrf PORTB ;Stop the motor.
call DELAY1 ;Stop delay here.
movlw B'00001010'
movwf PORTB ;Turn right, reverse motor.
call DELAY2 ;Run delay here
clrf PORTB ;Stop the motor.
call DELAY1 ;Run delay here.
movlw B'00000001' ;w = binary 1.
movwf PORTB ;Wheels straight, motor on.
return ;Return to main program.
;Time delay for stops.
DELAY1 movlw D'50' ;w = decimal 50.
movwf J ;J = 50.
j1loop movwf K ;K = 50.
k1loop decfsz K,f ;K = K - 1.
goto k1loop
decfsz J,f
goto k1loop
return
;Time delay for reverse runs.
DELAY2 movlw D'40' ;w = decimal 40.
movwf J ;J = 40.
j2loop movwf K ;K = 40.
k2loop decfsz K,f ;K = K - 1.
goto k2loop
decfsz J,f
goto k2loop
return
end