Post on 18-Nov-2014
description
Last updated 5/16/2008 P a g e | 1
1 Senior Capstone Project Report
Senior Capstone Project Report Winter/Spring 2008
MICROMOUSE
David Freiberger, Tyler Jones
Eastern Washington University
Department of Engineering and Design
Cheney, WA 99004, USA
Last updated 5/16/2008 P a g e | 2
2 Senior Capstone Project Report
Table of Contents
Section 1: Introduction and Overview ................................................................... 4
1.1 About this project .......................................................................................................... 4
1.2 Design Specifications .................................................................................................... 4
Section 2: Micromouse Configuration Options...................................................... 5
2.1 Power On/Off Header ................................................................................................... 5
2.2 ISP Header .................................................................................................................... 6
2.3 Configuration Header .................................................................................................... 7
2.4 LCD Backlight Enable ................................................................................................... 8
Section 3: External Hardware ............................................................................... 8
3.1 Motors ........................................................................................................................... 9
3.2 Encoders ..................................................................................................................... 12
3.3 Sensors ....................................................................................................................... 13
3.4 LCD Display ................................................................................................................ 14
3.5 Wheels, Chassis and Other Support Framework ....................................................... 15
3.6 Note about Initializing Microcontroller ......................................................................... 15
Section 4: Circuit Schematics ............................................................................. 17
4.1 Microcontroller ............................................................................................................ 18
4.1.1 Atmel ATmega32 8-bit RISC Microcontroller .............................................. 19
4.1.2 Microcontroller Connections Table ............................................................. 19
4.2 Motor Control Section ................................................................................................. 20
4.2.1 Maxim DS2423 4kbit 1-Wire RAM with Counter ......................................... 21
4.2.2 Maxim MAX4701 Dual DPDT Analog Switch ............................................. 21
4.2.3 Freescale MPC17531 700mA Dual H-Bridge Motor Driver ........................ 22
4.3 Power Section ............................................................................................................. 22
Last updated 5/16/2008 P a g e | 3
3 Senior Capstone Project Report
4.3.1 Maxim MAX5091 28V, 100mA high-voltage linear regulator ...................... 22
4.4 Sensor Section ............................................................................................................ 23
4.5 Additional Notes .......................................................................................................... 23
4.5.1 Optional connector for oscillator ................................................................. 23
4.5.2 Breakout connectors for serial port ............................................................. 24
4.5.3 Header for character LCD ........................................................................... 24
4.5.4 Potentiometer for LCD contrast .................................................................. 24
4.5.5 Potentiometer for ADC ................................................................................ 24
Appendix A: PCB Masks .................................................................................... 25
Appendix B: Schematic ...................................................................................... 26
Appendix C: Errata ............................................................................................. 27
References ......................................................................................................... 28
Last updated 5/16/2008 P a g e | 4
4 Senior Capstone Project Report
Section 1: Introduction and Overview
This report presents the design and implementation of a small hardware platform created to meet design
guidelines as specified by the IEEE Micromouse competition rules [1].
1.1 About this project
The impetus for this project comes from the IEEE sponsored Micromouse Competition. Robots
participating under the official rules of the competition must solve a three meter square wooden maze by
finding a route to the center and making timed speed runs, all within an allotted time period. The robots
cannot have human feedback for solving the maze, and any intervention with the robot, for example to
replace batteries, will result in a time penalty [1].
The maze is divided into 16x16 cells, configured before the event so that competitors do not know the
layout. Robots must have the ability to sense walls and cannot touch or run into walls [1]. A great deal of
flexibility is permitted in the design of the robots, with only a few requirements specified in the official
rules.
This particular design is based on a two-wheel concept that has been used by several other groups; however
both the hardware and software are completely original.
1.2 Design Specifications
The micromouse hardware is designed to meet IEEE Micromouse Contest Rules for Region 6 as specified
under section C – Rules for the Micromouse. In addition, we decided our particular design should call for
limited size and weight constraints, to add to the challenge of building the device.
The official rules for the micromouse require that (1) the device should be self-contained, with no remote
controls or pre-loaded maze configurations; (2) the device should not use an energy source requiring
combustible fuel; (3) the device should not leave any part of its body behind while navigating the maze; (4)
the device should not modify or damage the maze, and should not jump or fly over the maze walls; (5) the
device should not have a width x length greater than 25 cm by 25 cm; and (6) the total cost of materials
should not exceed $500.00, using market value for all components [1].
Our additional constraints specified that (1) the device should not have a width x length greater than 12 cm
by 12 cm, and height greater than 5 cm; (2) the device should be capable of speeds of up to 2 m/s and
accelerations of up to 2 m/s2; (3) the device should be capable of running off a single battery for at least 15
minutes at nominal speed; (4) the device should use surface mount technology (SMT) for at least 90% of
on-board components; and (5) the device should provide feedback to the user via an LCD display or similar
character display.
Last updated 5/16/2008 P a g e | 5
5 Senior Capstone Project Report
Section 2: Micromouse Configuration Options
The micromouse uses a variety of headers for configuration and programming purposes. In addition the
device can be put into standby or off mode by placing a jumper across a special header near the power
subsection of the board.
Figure 2-1: Configuration options
Figure 2-1 indicates the position of the ISP header, the power enable header, an 8-pin configuration header,
and a LCD backlight enable.
2.1 Power On/Off Header
The micromouse uses a power regulator chip made by Maxim IC, the MAX5091 28V, 100mA high-voltage
linear regulator device. The documentation for this device is provided in /docs/max5091.pdf on the CD, or
can be found on maxim-ic.com.
The robot can be powered by a 6 to 9V voltage source if it is capable of supplying sufficient current to the
motors, as given approximately by the nominal voltage of the motor divided by its terminal resistance. The
controller circuitry of the board will draw a maximum current of 80mA with the infrared sensors and LCD
backlight on, and a minimum current of 40mA with sensors and LCD backlight off. The device will draw
approximately no current when in standby mode.
A standard 9-volt connector from J4 is provided for supplying power (between 6 and 9V) to the circuit.
Last updated 5/16/2008 P a g e | 6
6 Senior Capstone Project Report
WARNING: DO NOT ATTEMPT TO PROVIDE POWER DIRECTLY TO THE CIRCUIT BY
BYPASSING THE 9-VOLT CONNECTOR, AS THE BOARD HAS THREE SEPARATE
VOLTAGE SOURCES AT VBAT, 5V, and 3.3V, AND COULD BE PERMANETLY RUINED.
The power header at JP2 is connected between EN and GND as specified in the Maxim IC documentation.
When this connection is shorted, the EN pin is pulled low and the voltage regulator goes into shutdown
mode (figure 2-2). The circuit should not leak more than 1uA when it is in the off-state.
Figure 2-2: Power on (left) and off (right)
2.2 ISP Header
Control of the micromouse is accomplished using the ATmega32 8-bit RISC Microcontroller produced by
Atmel. The microcontroller’s In System Programming mode is supported by bringing out the connections
to the ISP Header.
To program the microcontroller, use the AVR MkII ISP USB programmer. The 6-pin header jack J1 should
be connected as in figure 2-3(a) or (c) for proper programming. The programmer should be connected with
a USB cable (figure 2-4) from computer to micromouse, and the micromouse should be ON for
programming. Additionally, jumpers on header JP3 should be REMOVED before programming, or the
operation will fail. A green indicator light will show if the connection is properly made, figure 2-3(c), or a
blinking orange light will show if the connection is improper, figure 2-3(b).
(a) Proper connection, close-up
view
(b) Improper connection
(c) Proper connection
Figure 2-32: ISP Header
Last updated 5/16/2008 P a g e | 7
7 Senior Capstone Project Report
Please see the AVR MkII documentation available from AVR Studio’s help menu for further instructions
and troubleshooting information on programming Atmel 8-bit devices.
WARNING: DO NOT CHANGE THE LOCK BIT OR FUSE BIT
SETTINGS ON THE MICROCONTROLLER UNLESS YOU KNOW
WHAT YOU ARE DOING!
The robot could be permanently disabled if you make an improper fuse or lock
bit setting.
2.3 Configuration Header
The configuration header JP3 is provided as an optional method of setting up to 16 possible configuration
modes on the micromouse. The value of the header is available on register PINB7:4 using the avr-libc
definitions available in AVR Studio. To use this feature, you can check the proper port register in software
to see if it is high. To use up to 16 states, combine the 4 bits of the port configuration header into a single
nibble and make selections based on the binary value up to 2^4 = 16 possible states (example 2-1).
//see Section 3.6 on how to //properly initialize the microcontroller: void initializeDevice(void) … int your_function_name(void) … unsigned int state; state = (ckb(PINB,7)<<3) | (ckb(PINB,6)<<2) | (ckb(PINB,5)<<1) | ckb(PINB,4); switch (state) case 0: //example: turn on indicator led sbi(PORTA,6); break; case 1: //test LCD or something moveToXY(0,0); writeStringToLCD("hello!!!"); break; default: //turn of indicator led, clear LCD cbi(PORTA,6); clearLCD(); break;
Example 2-1: Using configuration header
Figure 2-4: USB cable
Last updated 5/16/2008 P a g e | 8
8 Senior Capstone Project Report
2.4 LCD Backlight Enable
An enable is provided for the LCD backlight so that the backlight can be turned off when battery
performance is an issue. The LCD backlight can draw up to 40mA if enabled. To enable the backlight,
connect a jumper across this header (figure 2-5).
Figure 2-5: LCD backlight enabled
Section 3: External Hardware
The micromouse platform provides several pieces of external hardware to be used in conjunction with the
microcontroller and create a useable mobile device. Among these devices are two DC motors with right-
angle gearboxes and attached wheels, four infrared proximity sensors, and an LCD screen for feedback to
the user.
Figure 3-1: External hardware components
Last updated 5/16/2008 P a g e | 9
9 Senior Capstone Project Report
3.1 Motors
The motors utilized in this design are Faulhaber 1524E 6V motors, with integrated encoders and gearheads,
however the device will support other types of motors of similar ratings. The hardware should support any
DC motor with nominal voltage rating of less than 9 volts and current draw less than 700mA. A Faulhaber
motor and a Portescap 16N210E motor are shown for size comparison in figure 3-2, both motors have been
tested with this hardware.
Figure 3-2: Faulhaber 1524E (bottom), Portescap 16N210E (top)
To ensure proper connection of a motor, you should refer to schematics in Section 4 and the motor
documentation, making sure that all wires match up. Figure 3-3 shows the connections for a pair of
Faulhaber 1524E motors, and table 3-1 gives the port names for motor block inputs and outputs.
Figure 3-3: Motor connections
ATMega32 Pin Description
D2 Motor 1 direction
D3 Motor 2 direction
D4 Motor 1 PWM / OC1B
D5 Motor 2 PWM / OC1A
D7 Encoder data DS2423
Table 3-1: Microcontroller ports for motor
subsystem
Motor control is achieved using pulse width modulation (PWM). PWM is a method for producing an
adjustable average DC voltage output by adjusting the duty cycle of a modulated voltage wave at high
frequency (figure 3-4). At high frequencies a motor will “observe” the average value of the voltage at its
input, hence varying the duty-cycle of the waveform will have the same effect as using a variable DC
voltage source [2].
Last updated 5/16/2008 P a g e | 10
10 Senior Capstone Project Report
Figure 3-4: Pulse Width Modulation
In our design we use the 16-bit Timer/Counter1 peripheral on the Atmega32 chip to generate an adjustable
frequency and adjustable duty-cycle PWM wave [3]. The output compare ports OC1A and OC1B on I/O
pins PD5 and PD4 respectively of the microcontroller are multiplexed into two channels that control the
two DC motors through an H-Bridge circuit. The multiplexer is a Maxim MAX4701 Dual double-pole
double-throw (DPDT) switch. Each of the two DPDT switches connects two ports INxA, INxB of the H-
Bridge to OC1x and GND based on the value of their select inputs (INx) as in figure 3-5. The effect of
changing INx from high to low is to reverse the voltage at the input of the motor.
Figure 3-5: Motor block
The PWM frequency is chosen based on three factors: (1) the PWM frequency needs to be sufficiently high
to create a smooth voltage across the inductor, something above 1000Hz; (2) PWM essentially creates a
small speaker out of the motor due to the oscillations, so the frequency of the PWM needs to be sufficiently
out of the hearing range, and otherwise it creates an annoying sound during operation; (3) rapidly changing
the state of a motor, either by reversing direction, increasing speed, or turning on/off, will draw a large
amount of current, hence the H-Bridge must have charge pumps capable of supply these peak currents and
smoothing out the system response; high frequencies, above 50kHz, will reduce the current draw in the
system when it is overloaded, and should be used.
AVRLib provides a timer library for accessing the timer peripherals with the ATmega chipset. In our
software we use the PWM functions provided with the library. The functions use Timer1 in Fast PWM
Mode, with register ICR1 set as the top count, a prescaler of N=1, and 8-bit resolution. The frequency is
defined with equation 3-1. The duty cycle can be adjusted by changing the value of registers OCR1x,
between 0 and the value of TOP. Setting OCR1x to 0 will result in a small spike, and setting OCR1x to
TOP will result in a constant high output [3].
Last updated 5/16/2008 P a g e | 11
11 Senior Capstone Project Report
_/
1
Equation 3-1
An example of running motor 1 at full speed and motor 2 at half speed is given in example 3-1. AVRLib
and the timer library are used in this example, however this method has not be rigorously tested and the
programmer may want to experiment with other PWM modes on Timer1, such as Frequency and Phase
Correct PWM Mode discussed in [3].
#include "global.h" #include "timer.h" //see Section 3.6 on how to properly initialize the microcontroller: void initializeDevice(void) … int your_function_name(void) … //set PWM frequency divider to 1 (e.g. run at 8MHz or clk_freq) timer1SetPrescaler(TIMER_CLK_DIV1); //set 8 bit resolution timer1PWMInit(8); //set frequency to 78.4 kHz timer1PWMInitICR(0x65); //set direction to forward for motor 1 sbi(PORTD,2); //set direction to forward for motor 2 sbi(PORTD,3); //set top count of PWM to max for motor 1 (full speed) timer1PWMASet(0x65); //set top count of PWM to half for motor 2 (full speed) timer1PWMBSet(0x32); //turn both motors on timer1PWMBOn(); timer1PWMAOn(); … //turn both motors off timer1PWMBOff(); timer1PWMAOff(); …
Example 3-1: Using the motors
3.2 Encoders
Encoders should be integrated into any motor you decide to use, and are connected to the circuit through
the standard motor connectors shown in figure 3-2. The robot is capable of tracking individually up to
approximately 4.2 billion revolutions of each motor through an external counter chip, the Maxim DS2423.
One channel of each motor is connected to one of the two counter input on the DS2423 chip, turning the
motor shaft will cause the counter increment on rising edge of the encoder pulse. The other channel of the
Last updated 5/16/2008 P a g e | 12
12 Senior Capstone Project Report
encoders is not used in this design. Access to the 32 bits of each channel of counter data is provided using a
one-wire interface on the data line connected to microcontroller pin D7. An adapted AVRLib C library is
included to allow easy access to this data in software (example 3-2). For further information on how to
properly access counter registers you should refer to references [3] and [4]. The DS2423 also has 4kbits of
SRAM, which can be accessed through the one-wire interface, see [4] and Section 3.6.
#include "global.h" #include "timer.h" #include "onewire.h" //see Section 3.6 on how to properly initialize the microcontroller: void initializeDevice(void) … int your_function_name(void) uint8_t MCNT[4] = 0; … ow_reset(); ow_reset(); ow_byte_wr(0xCC); //issue "skip rom" command ow_byte_wr(0xA5); //issue "read memory + counter" command //issue low-byte, high-byte of memory address for ENCODER A ow_byte_wr(0xE0); //set TA1 (low-byte of memory address) ow_byte_wr(0x01); //set TA2 (high-byte of memory address) //issue low-byte, high-byte of memory address for ENCODER B /*ow_byte_wr(0xC0); //set TA1 (low-byte of memory address) ow_byte_wr(0x01); //set TA2 (high-byte of memory address)*/ uint8_t i = 0; for (i = 0; i < 32; i++) ow_byte_rd(); //the first 32 bytes are memory MCNT[0] = ow_byte_rd(); //very lowest byte of 32-bit count MCNT[1] = ow_byte_rd(); MCNT[2] = ow_byte_rd(); MCNT[3] = ow_byte_rd(); //very highest byte of 32-bit count …
Example 3-2: Using the encoders
3.3 Sensors
The robot can navigate in a properly lighted environment, such as a maze, with the four onboard infrared
sensors. Each sensor block is comprised of an infrared emitter, the Vishay TSAL6100 device, and a
phototransistor, Vishay BPV11F (figure 3-5). The phototransistor’s collector is connected to an analog-to-
digital converter input on the microcontroller, while the infrared LED is directly controlled by an output
port on the microcontroller.
Last updated 5/16/2008 P a g e | 13
13 Senior Capstone Project Report
Figure 3-5: Sensor block
Microcontroller Pin Description
B0 IR Emitter 1
B1 IR Emitter 2
A1 IR Emitter 3
B3 IR Emitter 4
A0 IR Detector 1
A4 IR Detector 2
A2 IR Detector 3
A3 IR Detector 4
Table 3-1: Microcontroller ports for sensor subsystem
The sensors work on the basis of reflection: an infrared led is turned on, emitting light in the infrared
spectrum, and a reading is made with an adjacent photo transistor and corresponding ADC unit (figure 3-6).
The value that is read varies unpredictably with differing materials, but when used to determine distance
from a constant type of material, it remains steady under normal indoor lighting conditions, and thus is
adequate for navigation in a controlled environment. The material should be sufficiently non-diffusive so
that an adequate amount of light will reflect back to the sensors. Light from adjacent emitters will not pose
a problem if the sensors are used properly, since the phototransistors have a 15 degree field-of-view, and
the emitters can be independently switched. A calibration routine can be created to set up threshold values
for the robot to allow it to predict approximately where adjacent walls are located. Fuzzy logic routines can
be used to make an estimate of distance based on multiple samples with the emitter both on and off, as
describe in [5].
Figure 3-6: Photographs of TSAL6100 infrared emitter LED, and IR light from outdoors
Last updated 5/16/2008 P a g e | 14
14 Senior Capstone Project Report
An example of using the infrared emitters from software is given in example 3-3.
#include "global.h" #include "timer.h" #include "a2d.h" //see Section 3.6 on how to properly initialize the microcontroller: void initializeDevice(void) … int your_function_name(void) uint16_t ir_val; … sbi(PORTA,1); //turn LED emitter 3 on delay_ms(20); //wait a bit //read the converted value from phototransistor 2 ir_val = a2dConvert10bit(ADC_CH_ADC2); delay_ms(20); //wait a bit cbi(PORTA,1); //turn emitter 3 off if (ir_val > 300) //compare with a threshold value… … //do something, like stop motors …
Example 3-3: Using the IR sensors
3.4 LCD Display
An 8 character by 2 line display is provided on the robot for feedback, debugging, and any other functions
the programmer can come up with. The LCD display uses the Hitachi HD44780 communication standard,
and modified libraries are provided from those written by Steven Pickles in [8]. Example 3-4 provides an
example of using the LCD display.
#include "global.h" #include "timer.h" #include "lcd_4bit.h" //see Section 3.6 on how to properly initialize the microcontroller: void initializeDevice(void) … int your_function_name(void) … moveToXY(0,0); writeStringToLCD("Micro"); moveToXY(1,3); writeStringToLCD("Mouse"); //writeIntegerToLCD(52); //there several other useful functions,
Last updated 5/16/2008 P a g e | 15
15 Senior Capstone Project Report
//see lcd_4bit.h for definitions …
Example 3-4: Using the LCD Character Display
3.5 Wheels, Chassis and Other Support Framework
The chassis, or body construction of the robot, is made out of hard plastic, and was cut using a CNC
machine (figure 3-7). Overall chassis dimensions are 5.3 cm x 11.0 cm x 3.5 cm, width x length x height,
excluding wheel protrusion.
Figure 3-7: Plastic material
3.6 Note about Initializing Microcontroller Before entering the main loop of the microcontroller, all ports and peripherals should be properly defined to
prevent shorts or other malfunctions. This means that data-direction registers should be set up properly and
pull-ups disable for input ports. An example code is given in example 3-5.
#include "global.h" #include "timer.h" #include "lcd_4bit.h" #include "a2d.h" void initializeDevice(void) cli(); //disable interrupts //Port Setup PORTA = 0b00000000; DDRA = 0b01000010; //data direction register, 1 = out, 0 = in PORTB = 0b00000000; DDRB = 0b00001011; PORTC = 0b00000000; DDRC = 0b00000000; PORTD = 0b00000000; DDRD = 0b11111110; //End port setup
Last updated 5/16/2008 P a g e | 16
16 Senior Capstone Project Report
sei(); //enable interrupts timerInit(); timer0Init(); timer0SetPrescaler(TIMER_CLK_DIV1024); timerAttach(TIMER0OVERFLOW_INT, handle_timer0); timer1Init(); timer1SetPrescaler(TIMER_CLK_DIV1); timer1PWMInit(8); timer1PWMInitICR(0x65); a2dInit(); a2dSetPrescaler(ADC_PRESCALE_DIV32); a2dSetReference(ADC_REFERENCE_AREF); initializeLCD(); ow_reset();
Example 3-5: Initializing the microcontroller
Last updated 5/16/2008 P a g e | 17
17 Senior Capstone Project Report
Section 4: Circuit Schematics
This section provides some information on devices used on the micromouse hardware, and the circuit
schematics.
Figure 4-1: Board control and power sections
Figure 4-2: Board layout index
Last updated 5/16/2008 P a g e | 18
18 Senior Capstone Project Report
The board layout is shown in figure 4-2. A list of the components is provided below, with external links to
documentation where applicable.
A) Atmel ATmega32 8-bit RISC Microcontroller
B) Maxim DS2423 4kbit 1-Wire RAM with Counter
C) Maxim MAX4701 Dual DPDT Analog Switch
D) Freescale MPC17531 700mA Dual H-Bridge Motor Driver
E) Maxim MAX5091 28V, 100mA high-voltage linear regulator
F) Vishay BPV11F Infrared Phototransistor, TSAL6100 Infrared LED
G) ISP Header
H) Configuration header
I) Motor headers
J) Optional connector for 8 or 16MHz watch crystal
K) Available connections to TX and RX pins of microcontroller for an external serial port controller
L) Header for 8 x 2 character LCD
M) Potentiometer for LCD contrast (currently bypassed)
N) Potentiometer for analog-digital converter (ADC) V¬REF reference voltage on microcontroller.
O) Power enable header
4.1 Microcontroller
Figure 4-3: Microcontroller schematic
4.1.1 Atmel ATmega32 8-bit RISC Microcontroller
Last updated 5/16/2008 P a g e | 19
19 Senior Capstone Project Report
The ATmega32 device is used as a central controller for the micromouse system, and can be programmed
in standard C (recommended), or in Assembly. A set of libraries are available from Procyon AVRlib that
will make some features on this device much easier to use. In addition it is recommended to program this
device in AVRStudio 4 or higher and utilize the included avr-libc libraries. A TQFP package is used in this
design (figure 4-4).
ATMEGA32-16AU
Figure 4-4: ATmega32 TQFP package pinout
4.1.2 Microcontroller Connections Table
Port I/O Pin Connection Description
A 0 37 U$5 (BPV11F), Collector Phototransistor 1
" 1 36 R11 (220Ω) to LED3 (TSAL6100), Anode IR Emitter 3
" 2 35 U$7 (BPV11F), Collector Phototransistor 3
" 3 34 U$8 (BPV11F), Collector Phototransistor 4
" 4 33 U$6 (BPV11F), Collector Phototransistor 2
" 5 32 <NC>
" 6 31 LED6 Indicator LED
" 7 30 SO (MAX5091), Pin 7 Low power indication
B 0 40 R8 (220Ω) to LED1 (TSAL6100), Anode IR Emitter 1
" 1 41 R9 (220Ω) to LED2 (TSAL6100), Anode IR Emitter 2
" 2 42 <NC>
" 3 43 R13 (220Ω) to LED4 (TSAL6100), Anode IR Emitter 4
" 4 44 SS and Configuration Header 0 ISP / Config Header
" 5 1 MOSI and Configuration Header 1 ISP / Config Header
" 6 2 MISO and Configuration Header 2 ISP / Config Header
" 7 3 SCK and Configuration Header 3 ISP / Config Header
C 0 19 DB7 (LCD), Pin 14 LCD
" 1 20 DB6 (LCD), Pin 13 "
" 2 21 DB5 (LCD), Pin 12 "
" 3 22 DB4 (LCD), Pin 11 "
Last updated 5/16/2008 P a g e | 20
20 Senior Capstone Project Report
" 4 23 E (LCD), Pin 6 "
" 5 24 R/W (LCD), Pin 5 "
" 6 25 RS (LCD), Pin 4 "
" 7 26 <NC> "
D 0 9 RXD (PAD2) pad for serial rxd
" 1 10 TXD (PAD1) pad for serial txd
" 2 11 R17 (1kΩ) to IN1,IN2 (MAX4701) Pin 4 Motor 1 direction control
" 3 12 R15 (1kΩ) to IN3,IN4 (MAX4701) Pin 12 Motor 2 direction control
" 4 13 NO1, NC2 (MAX4701) Pins 1, 7 Motor 1 PWM
" 5 14 NO3, NC4 (MAX4701) Pins 9, 15 Motor 2 PWM
" 6 15 <NC> (originally PSAVE (MPC17531) Pin 4) (Power save)
" 7 16 DATA (DS2423) Pin 2 Counter / RAM data 1-wire
4.2 Motor Control Section
There are three main integrated circuits used in the motor control section: one for switching direction; one
for powering the motors; and one for storing encoder data (figure 4-5).
Figure 4-5: Motor control section schematic
4.2.1 Maxim DS2423 4kbit 1-Wire RAM with Counter
Last updated 5/16/2008 P a g e | 21
21 Senior Capstone Project Report
This device is used primarily as a counter for the two motor encoders, as described in 3.2 Encoders.
Additionally, there are 4kbits of RAM memory available through the 1-Wire interface. To use this feature,
see the documentation. A TSOC package is used in this design (figure 4-4).
DS2423
Figure 4-6: DS2423 TQFP package pinout
4.2.2 Maxim MAX4701 Dual DPDT Analog Switch
This device is used to multiplex the only two Timer1 outputs available and GND into the motor driver H-
Bridge chip (Freescale MPC17531) so that direction reversal of the motors is possible. Please see section
3.1 Motors. The device package used is a thin SSOP (figure 4-4).
MAX4701EUE+
Figure 4-7: MAX4701 TSSOP package pinout
4.2.3 Freescale MPC17531 700mA Dual H-Bridge Motor Driver
This device is used to drive two motors off the battery supply, with control inputs from the microcontroller
PWM. See section 3.1 Motors. The device uses a VMFP package, which is equivalent to SSOP (figure 4-
5).
Last updated 5/16/2008 P a g e | 22
22 Senior Capstone Project Report
Figure 4-8: MAX4701 TSSOP package pinout
4.3 Power Section
The chip is powered by the MAX5091 chip, which is capable of regulating 28V to 5V with a maximum
nominal current of 100mA. As mentioned in section 2.1 Power On/Off Header, do not connect more than
9V to the input to this regulator, as this power source is directly supplied to the MOSFET H-Bridge motor
driver MPC17531.
Figure 4-9: Power section schematic
4.3.1 Maxim MAX5091 28V, 100mA high-voltage linear regulator
As mentioned previously, this chip regulates the battery input from around 9V to a steady 5V. The SO
output of this chip is connected to the microcontroller I/O pin A7, and can be used to detect low power
output from the battery. See the device documentation for further information on its operation and
maximum ratings. See Appendix C: Errata for an important note about this chip.
Last updated 5/16/2008 P a g e | 23
23 Senior Capstone Project Report
Figure 4-10: MAX5091 SO-EP pinout
4.4 Sensor Section
Figure 4-11: Sensor section schematic
4.5 Additional Notes
4.5.1 Optional connector for oscillator
In figure 4-2J an optional connector is provided for an external oscillator. To use this feature you should
match capacitor values for C1 and C2 to the proper rating for whatever oscillator you use. Verify that your
oscillator will work beforehand by reading the ATmega32 documentation and preferably testing on another
device. After soldering oscillator and capacitors you will have to change the lock bits to the proper External
Oscillator setting as described in the ATmega32 documentation.
4.5.2 Breakout connectors for serial port
These two connections on PAD1 and PAD2 bring out the nets for TXD and RXD from the microcontroller,
but no serial controller circuitry or pull-downs are provided.
4.5.3 Header for character LCD
The micromouse should work with the LCD unconnected on header JP1. It is very important to connect the
LCD so that the display is facing over the PCB board, as shown in figure 3-1.
Last updated 5/16/2008 P a g e | 24
24 Senior Capstone Project Report
WARNING: CONNECTING THE LCD IMPROPERLY COULD PERMANENTLY DAMAGE OR
DISABLE THE MICROMOUSE DEVICE.
4.5.4 Potentiometer for LCD contrast
Currently this device is bypassed directly to ground, giving full contrast to the LCD display. The LCD may
work with bypass removed and the potentiometer adjusted to the right range, however we had problems
with the display shorting.
4.5.5 Potentiometer for ADC
This potentiometer provides a way to increase the resolution of the photosensors manually. You can do this
adjusting the lower range value of the ADC VREF so that it matches the collector voltage of the BPV11F
phototransistor devices when IR emitters are off. Be careful adjusting this as it is very sensitive.
4.5.6 Indicator LED
This is a small green LED connected to PORTA 6 on the microcontroller, and it can be used for
testing or whatever other purpose you need.
Last updated 5/16/2008 P a g e | 25
25 Senior Capstone Project Report
Appendix A: PCB Masks
Figure A-1: Bottom PCB
Figure A-2: Top PCB
Last updated 5/16/2008 P a g e | 26
26 Senior Capstone Project Report
Appendix B: Schematic
Last updated 5/16/2008 P a g e | 27
27 Senior Capstone Project Report
Appendix C: Errata
The following issues were noted while testing this device:
A) The MAX5091 voltage regulator has a metal pad underneath the device for grounding. Our PCB has
metal vias underneath the chip, as we did not account for this metal pad. To resolve, we placed electrical
tape under the chip. The PCB designs have NOT been updated to mark this change.
B) The potentiometer for LCD contrast (Section 4.5.4) causes a short if turned incorrectly. To resolve, we
bypass the potentiometer to ground, as this does not pose an issue. In the future a fixed resistor should be
connected in series with this and any other potentiometers.
C) A connection was not added to the PCB for the LCD backlight power (LED+ and LED-). To resolve
LED+ (pin 15 on LCD) is connected through a makeshift header and 220Ω resistor to +5V (VCC). See
section 2.4.
D) In the schematics phototransistor 2 is labeled incorrectly as connecting to pin B2 of the microcontroller.
It should be labeled PA4.
Last updated 5/16/2008 P a g e | 28
28 Senior Capstone Project Report
References
[1] “MicroMouse Competition Rules,” IEEE Region 6 Central Area Spring Meeting 2008. Accessed: May
29, 2008 <ewh.ieee.org/r6/central_area/micromouse_rules.pdf>.
[2] "Pulse-width modulation." Wikipedia, The Free Encyclopedia. 20 May 2008, 08:58 UTC. Wikimedia
Foundation, Inc. 29 May 2008 <http://en.wikipedia.org/w/index.php?title=Pulse-
width_modulation&oldid=213664042>.
[3] “ATmega32 Datasheet.” Atmel Inc. Accessed: May 29, 2008
<http://atmel.com/dyn/resources/prod_documents/doc2503.pdf>
[4] “DS2423 Datasheet.” Maxim Integrated Products, Dallas Semiconductor. Accessed: May 29, 2008
<http://datasheets.maxim-ic.com/en/ds/DS2423.pdf>
[5] Jianwei Zhang, F. Wille, A. Knoll, "Fuzzy logic rules for mapping sensor data to robot control,"
eurobot, p. 29, 1st Euromicro Workshop on Advanced Mobile Robots (EUROBOT), 1996