COST ROBOT CAROLINE TRIPPEL Software Design Considerations
Dec 14, 2015
Abstract
Design and build a compact robot to traverse a maze
Use the robot to generate an ASCII representation of the entire maze
Mark light locations on map as they are discovered
Revisit lights intelligently throughout the maze in a user-defined order
Software Design Considerations
PIC18F4550 Microcontroller InterfacesGeneral Purpose I/OA/D sensorsPWM motor controlCommunication with compass via I2CData transfer via USB
“Flag”-driven Design Embedded C
General Purpose I/O
5 registers for general purpose I/O PORTx registers refer to pin TRISx registers:
0 – output1 – input
3X Single-colored LEDs 1X RGB LED (3 pins) 2X Pushbuttons 4X Motor direction control
A/D Sensors
13 A/D Channels Conversion process
Set channel to corresponding ANx pinSet GO_DONE bit to 1Conversion complete when GO_DONE bit = 0
1X RGB Color Sensor (3 pins) 3X Short-range sensor 1X Long-range sensor
PWM
PWM enable by setting bits 2 and 3 of the CCPxCON registerCCP1CCP2
Motor speed control Alter duty cycle to change speed
I2C / USB
Communication between compass and microcontroller via I2C
Data transfer to computer with USBByte-by-byte transfer of dataData structure decoded by PC
Maze Mappingtypedef struct _mazeNode {
/* bits 7-5: 000 = normal node 001 = red 010 = green 011 = blue bits 4-0: location from -10 to 10*/
char locX; // holds X location char locY; // holds Y location
// holds the path description /* bits 7 & 6: 00 = nothing 01 = entrance 10 = return 11 = unused
bits 5-0: index of the next node in mazeNode array */ char Npath; char Spath; char Epath; char Wpath;} mazeNode;