Proposed Solution

advertisement
Automated Drag Racer
1/18/07
Alex Kubacki
EET396
Dr. Barnett
Problem Statement
The goal of this project is to design and produce the main controller for a drag racing
robot. It must consist of a micro controller that is powered by 3.3V, and an LCD that is
powered by 5.0V. The microcontroller must interface with an external real time clock so
that it can time the race runs, accurate to 10ms as well as display the date and time on the
LCD. The time and date function should remain accurate even if the main power is
removed, thus a backup battery is needed for the crystal and RTC chip. The controller
will receive an encoded 2 bit TTL signal that indicates the condition of the starting tree,
which it uses to know when to start driving and timing the run. The controller must also
be able to receive TTL level signals that indicate the wall contact status, and generate the
proper motor control signals at TTL levels to complete the drag race without going out of
its lane. The controller will also be able to stop the racer at the end of the track based
upon the wall contact status data.
Difficulties encountered in this project include learning how to use the Cypress PSoC
Designer software for the microcontroller, as well as the functionality and programming
of the PSoC. Ensuring the controller block will interface flawlessly with any properly
designed power or signal block also proved to be a design challenge.
Most other similar products that have been investigated lacked the ability to time its
progress, as well as do an automated starting sequence via a light tree.
The requirement that the micro be powered by a 3.3V source, while the input and output
signals are required to be 5V level almost doubles the amount of circuitry needed. Simply
allowing either a 3.3V or 5V powered microcontroller would alleviate this burden.
Literature Search
Autonomous robot competitions, like the DARPA Challenge, have “spurred numerous
advances in robot control schemes”(1). Innovations in Robot Mobility and Control
discusses not only physical schemes to improve a robots mobility, but delves into how
proper control algorithms can greatly increase maneuverability(1). This is very pertinent
to the goal of the main controller, as the race specifications are very narrow, and control
must be precise to ensure quality, repeatable operation. As discussed in Embedded
Robotics: Mobile Robot Design and Applications with Embedded Systems(2), a system
with few inputs from the physical world either needs complex programming to
extrapolate more information than is readily apparent. However, simple line following
robots often need not employ complex control systems such as PID motor control(3),
such as David Cook’s designs(4).
Possible Overall Approaches
For the main controller, there are several areas that could be approached in different
ways. For the microcontroller, there are several possibilities, including the Atmel
ATmega8L, which is functionally identical to the ATmega16, and the Microchip
PIC16F685, both of which are 3.3V supply-capable chips. Both micros have adequate
PWM and ADC functions to meet the requirements of the project, as well as adequate I/O
ports to interface with the LCD and real time clock. Both chips fall well within the power
budget of 30mA. The ATmega16 would be programmed in the familiar CVAVR
interface, and the PIC could be programmed from any C compiler. Both options use a
simple boot loader for programming. A third option was presented in lecture, which is the
Cypress Programmable System on a Chip. The PSoC is a micro controller and
programmable analog device that is capable providing all the necessary functionality,
including several built in routines for hardware interfacing.
For the LCD, there are a multitude of choices. A character LCD is a must, and sizes for
this project could vary from 8x1 to 20x8. A larger LCD certainly would be capable of
displaying all information pertaining to the control and status of the robot at once, but the
smallest LCD could certainly show just the information pertinent to the current mode of
operation. Both serial and parallel LCDs could be used with both microcontrollers. A
backlight LCD is not considered due to power constraints.
The real time clock can be implemented as single IC, encompassing a backup battery, and
oscillator, and a EEPROM RTC chip in one package. This would eliminate the
complexity of the circuit, as well as ensure interoperability. Several interfaces, such as
I2C, serial, parallel, and single-wire communication are available and could be
implemented.
The input and output level conversion for the sensor block and motor controls can be
accomplished several ways. For the input 5V to 3.3V level conversion, a diode could be
placed in series to drop approximately 1.7V, a simple voltage divider could be used, or a
TTL to CMOS converter IC. Output level conversion could be done with a linear op-amp,
a comparator, or a CMOS to TTL converter chip.
Proposed Solution
Introduction
Of the possible solutions, the PSoC chip, development kit, in circuit programmer, and C
compiler license have been made available free of charge for this project. The Cypress
PSoC chip is chosen because the Designer software integrates the LCD control logic, as
well as I2C communication code libraries for the real time clock. This alleviates a
significant portion of coding that would need to be done with other microcontrollers.
Also the chip, development kit, in circuit programmer, and C compiler license have been
made available free of charge for this project. The Lumex SO1602DSR/A 19x2 character
LCD with integrated controller included with the PSoC development kit is sufficient to
display all information pertinent to the current mode. Also, using a voltage follower with
an output pull-up voltage divider ensures that the sensor inputs to the main controller
have a very high input impedance, and will be able to avoid loading issues to other
blocks. The DS1307 I2C real time chip will easily interface with the PSoC(6), and has a
4.096KHz output option that combined with a 32 bit counter would provide adequate run
timing accuracy.
Specifications

Low power drain from 3.3V supply to micro

5V powered LCD

Battery status indicator

Very large input impedance on all inputs

Outputs capable of driving motors without becoming loaded

Battery backup date and time

10ms accurate run timing

Allows for manual race time adjustments
The main controller is operable over all temperature ranges that the user may want to
attempt to run it in. However, the LCD is the limiting factor, and those who do not
extreme temperatures should avoid using the main controller below 0°C, or above 70°C.
The controller will use a simple linear scheme to correct its direction if a wall is detected,
where the angle of incidence equals the angle of reflection. This means the robot will rely
on being able to move straight from the starting line in order to prevent from bouncing
off the walls repeatedly, or having an irrecoverable angle of attack.
Appearance
The main controller will reside on a square perf-board (Figure 1) that will attach to the
top platform of the cart (Figure 2). This gives the user access to all the control functions
and an easy view of the LCD, even while the robot is moving.
Figure 1 – Main controller
Figure 2 – Top mount on robot
User Instructions
Using the attached SuperLOC, stick the main controller to the top of the robot. Connect
the 6 pin header to the 6 pin header on the power block in the middle of the robot, using
the supplied ribbon cable, ensuring pin1 and pin1 are connected. Connect the 4 pin
header to the sensor board on the bottom of the robot with the 2nd ribbon cable, ensuring
the pin numbers coincide. Flipping the switch upward will enable the micro to accept
inputs from the sensor block, and thus enable it to race. When the race is over, flip the
switch back to center to end the race mode. If penalties were acquired, toggle the switch
down once for each one second penalty. Setting the switch to enable race mode will clear
the last runs time, and ready it to accept inputs again.
Overall Block Diagram
Output
Buffers
Battery strength
Multple Data lines
Right motor control
Left motor control
16x2 LCD
4
PWMright
Input
Buffers
3
PSoC
PMWleft
2
Real Time
Clock
Figure 3 – Overall block diagram of main controller
I/O Specifications
Table 1 - I/0 Specification for Main Controller
5V Input
Max Current Draw - 25mA
3.3V Input
Max Current Draw - 10mA
Battery level input
High Z impedence, 0-2.5V
Sensor inputs (1-4)
High Z impedence, TTL Level
PWM outputs
TTL level, up to 5mA source
Block by Block Discussion
Input buffers are used to isolate the main controller from the sensor block, and
compensate for any design flaws in the sensor block. They consist of an LM339N
Sensor input 4
Sensor input 3
Sensor iput 2
Sensor input 1
I2C Data bus
1
comparator configured as a voltage, with a potentiometer set on the output pin to pull up
the output voltage to the 3.3V logic 1 that is an acceptable input to the PSoC. The output
is capable of being pulled down to 0.03V for the logic 0 state. This voltage follower has a
very large input impedance to prevent any loading effect on the sensor block. The
potentiometers also allow for fine tune precision of the signal voltage to the PSoC to
ensure the proper voltage can be achieved. This buffer is shown in Figure 4.
Sensor to PSoC
5V
4
5V
1
V+
3
+
Sensor Input
1
-
LM339N
10K
3
11
2
V-
OUT
2
Figure 4 – Input buffer
The output buffers are a TLC2274 Rail-To-Rail comparator, with the rail voltages set to
5.0V and ground. The comparison point is set to ~1V with a voltage divider to trigger
between logic high and logic low. When the input is 0V, it is less than the reference
voltage, and the output is pulled low to 0V. When the input voltage is 3.3V, it is higher
than the reference voltage, and the output goes high to 5V. This circuit alleviates the
PSoC output pin from needing to source the power for the motor drivers.
3
V+
4
5V
PWM lef t f rom PSoC
+
OUT
2
5V
-
TLC2274
11
39k
1
V-
R2
10k
Figure 5 – PWM output buffers.
PWM to motor
The LCD block consists of nothing more than the Lumex SO1602DSR/A, utilizing a 4 bit
data bus with the microcontroller, and voltage divider to control the contrast.
Backlighting is not used.
Figure 6 – LCD block diagram
Modified from Lumex Datasheet (5)
The micro controller is a Cypress PSoC CY8C29466, and controls all the functionality of
the main controller.
Figure 7 – PSoC microcontroller configuration
The real time clock block consists of the DS1307 I2C and a DS32KHZ crystal oscillator.
The oscillator is an active type, with a single TTL level output at 32.678kHz going to the
X1 input of the DS1307. Both chips have a battery backup. The DS1307 communicates
with the micro via 2 wire I2C bus, and also has a secondary output frequency
programmable to 4.096kHz for the stop watch functionality of the controller.
Schedule
For the development of this poject, there are several major milestones. Aa testing board
needs to be created to simulate the signals that the power and sensor block would be
providing. This should be completed by the 3 week of the semester. Also by the 3rd week
of the semester, the PSoC and LCD should be wired up on a protoboard, with input mask
results shown on the LCD, as well as a demonstration that the PWM can output a variable
duty voltage, and the ADC for the battery status can be read and displayed. By the 4th
week, the layout from the protoboard should be soldered in sockets and pin headers on a
perf-board for the final project. By the 5th week, the perf-board circuit should be
complete, as well as the programming to control the operation of the drag racer. At this
point, the main controller should be tested as fully operational using the testing board
created in week 3.
GANTT
Budget
-Cypress PSoC CY8C29466 micocontroller ($35)
-PSoC MiniPROG (included above)
-Lumex SO1602DSR/A 16x2 character LCD with integrated controller (included above)
-DS1307 I2C real time clock chip ($1.70)
-DS32KHZ crystal oscillator chip ($6.92)
-LM339N $1.49
-Copper-clad perf-board $3.49
-DIP sockets, assorted $7.31
Due to several key and expensive parts being donated, as well as an extensive selection of
parts purchased before this project, a total of $12.29 is expected to be spend on this
project
Qualifications
Relevent coursework includes: 109(A), 159(A), 209(B), 309(B) and 368.
Extensive use of the C language.
Soldering experience on perf-boards.
Interest in motorsports.
Bibliography
(1)Srikanta Patnaik, Lakhmi C. Jain, Spyros G. Tzafestas, Germano Resconi, Amit Konar
(2006) Innovations in Robot Mobility and Control (Studies in Computational
Intelligence). Springer
(2)Thomas Bräunl (2006) Embedded Robotics: Mobile Robot Design and Applications
with Embedded Systems. Springer
(3)Warren E. Dixon, Darren M. Dawson, Erkan Zergeroglu, Aman Behal (2000)
Nonlinear Control of Wheeled Mobile Robots (Lecture Notes in Control and Information
Sciences). Springer-Verlag Telos
(4)Cook, David. "Robotics, Electronics, and Schematics." Robot Room. 24 Jan. 2007
<http://www.robotroom.com/>.
(5)“LCM-X02002Dxx Datasheet” Lumex 24 Feb. 2007
<http://www.lumex.com/images/pdf/LCM-S02002DSR-page2.pdf>
"Introduction to PSoC." EasyPSoC. 01 Feb. 2007
<http://www.easypsoc.com/book/chapter1.html#b6>.
Download