Report - Line Following Robot


Published on

Report for line following robot

  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Report - Line Following Robot

  1. 1. 202CDE Coventry University Assignment 1 GROUP BTP Divay Khatri - 4073084 Aleksandr Fedunov - 3238989 Cagdas Degirmenci - 3052983[EMBEDDED MICROPROCESSOR GROUP PROJECT]To design a robotic vehicle using a PIC18F4520 microcontroller board, stepper motors, Darlington driver,photo reflective optical sensors and a proximity sensor such that it can follow a black line over a whitesurface and can perform a 180 degree turn sensing an obstacle from 15 cms away.
  2. 2. Index Contents Page No.Introduction 3–4Design Process - Hardware Design 5–7 - Software Design 8 – 11Implementation 12 – 16 - The Code 17 – 20Components used 21Test Methodology 22 – 24Conclusion 25References 26 Page | 2
  3. 3. Introduction:To be useful in real world, robots need to move safely in unstructured environments and achievetheir given goals despite unexpected changes in their surroundings. The environments of real robotsare rarely predictable or perfectly unknown so it does not make sense to make precise plans beforemoving.The robot is left on a path and it approximates/ follows its path with the help of line followingsensors called photo reflective optical sensors and avoids obstacles with the help of distancemeasuring sensor called the opto proximity sensor.This task is to use a PIC18F4520 microcontroller board to control a robotic vehicle consisting of twostepper motors that control the locomotion aspect of the vehicle via a Darlington driver, two photoreflective optical sensors for a line following task and a single opto proximity sensor for obstacleavoidance tasks. We are given a robotic vehicle which we have to program such that it follows ablack line that is placed or drawn on a white background. Also it should perform a 180 turnfollowing the track in the opposite direction when it reaches at an approximate distance of 15 cmfrom any obstacle.We were given three weeks to complete this project both from the hardware and software aspects.During the first week, we set up the hardware using the stepper motors and the photo reflectiveoptical sensors and studied the movement of the stepper motor and noted down the pattern of thesame.The second week, we attached the opto proximity sensors to the hardware using ADC at PORTA ofthe PIC microcontroller board, assigned the hexadecimal values of 15cms away from the obstacle tothe code and tested it along with the previous week’s code. When it worked fine, then we shiftedthe hardware over the robotic vehicle. Connected the stepper motors accordingly and it workedfine. Now only the 180 turn was left to implement.For the week three, our objective was to make the robot turn 180 if it reaches at an approximatedistance of 15 cms from the obstacle. But because someone took away our robotic vehicle also thePC we used to sit on was occupied by someone else so we could not even access the code that wewrote and then setting up the hardware again took most of the time and we could not complete it.So we went to work on this in our free time and completed the task.Objectives that we were trying to achieve and were successfully completed: Stepper motor 1 should rotate in anti-clockwise direction Stepper motor 2 should rotate in clockwise direction at the same time as motor 1 Photo reflective optical sensors should be able to sense the black line and white line separately According to the optical sensors response, stepper motors should make changes to their movements. Page | 3
  4. 4. Opto proximity sensor should be able to sense the obstacle from approximately 15cms apart To perform 180 turn when an obstacle approaches.The image below is an overview of what exactly needs to happen. The robotic vehicle should movealong with the black line and as it gets out of it, the vehicle should stop one of its motor and movethe other accordingly so as to keep the vehicle in control and within the black line. This diagram isnot accurate but roughly gives an idea about the concept.We made two videos of our robotic vehicle which can be found on the linksbelow: 1. 2. Page | 4
  5. 5. Design ProcessHardware Design:Below is the figure that shows the set-up of the hardware, all the components together (includingthe PIC development board, sensors and the motors) Page | 5
  6. 6. To understand more about this let us have a look at the UML activity diagram for the hardwaredesign. UML activity diagram for Hardware Design Page | 6
  7. 7. From previous classes we figured out that for a full step sequence in a clockwise direction, the valuesfor the steps should be: STEP 1 0x09 STEP 2 0x05 STEP 3 0x06 STEP 4 0x0AAnd thus for the full step sequence in an anticlockwise direction, the values for the steps should bereversed: STEP 1 0x0A STEP 2 0x06 STEP 3 0x05 STEP 4 0x09This sequence applies only for one stepper motor but if we have to make two stepper motors movesimultaneously then the stepping sequence will be: 1. Make both the motors move in clockwise direction: STEP 1 0x99 STEP 2 0x55 STEP 3 0x66 STEP 4 0xAA 2. Make both the motors move in anti-clockwise direction: STEP 1 0xAA STEP 2 0x66 STEP 3 0x55 STEP 4 0x99 3. Make one motor in anti-clockwise direction and the other in clockwise direction STEP 1 0xA9 STEP 2 0x65 STEP 3 0x56 STEP 4 0x9AThis was the general idea of how to make the motors move. In our Project we have connected 4-7bits of PORTD with Motor 1 and 0-3 bits of PORTD with Motor 2. Now let us have a look at thesoftware design. Page | 7
  8. 8. Software Design: After making the connections according to the circuit as shown above, MPLAB was launched and a new project was created so as to program the PIC18f4520 through the ICD 3. We started programming the PIC in C language. 1. a. First we configured the operational parameters of the PIC by setting OSC mode to HS high speed clock. b. Then the watchdog timer was set to OFF. c. Low Voltage Programming was also set to OFF. d. And a state to compile without extra Debug compile code was set. 2. Header files (Include files) were included in the program a. #include <p18f4520.h> - device used is the PICF4520 b. #include <delays.h> - to include the delay routines c. #include <adc.h> - to include the files used in the analogue to digital conversion d. #include <stdio.h> - this describes the interface to the library which contains basic I/O functions 3. The stepping sequence was figured out in the previous classes and according to that stepping sequence where the stepper motors did a clockwise and anti-clockwise turn; the steps were assigned hexadecimal values. We know that 0x00 For the 0-3 bits of the PORTUsed to represent hexadecimalvalues For the 4-7 bits of the PORT Thus to make a robotic vehicle move in the forward direction, we need to make one motor move in anti-clockwise direction (i.e. Motor 1) and the other motor in clockwise direction (i.e. Motor 2) and we have to make changes in the directions of both the motors according to the response from the photo reflective optical sensors and the proximity sensors. For that we have assigned appropriate hexadecimal values to the steps and they are: Page | 8
  9. 9. STEP 1 0xA9 STEP 2 0x65 STEP 3 0x56 STEP 4 0x9A STEP 5 0xA0 STEP 6 0x60 STEP 7 0x50 STEP 8 0x90 STEP 9 0x09 STEP 10 0x05 STEP 11 0x06 STEP 12 0x0A4. Then we initialized all the bits (0-7) of PORTD for outputs and all the bits of PORTC and PORTA for inputs. Also included a while loop (with while = 1) such that the code can run forever.5. Then we included the code for the Analogue and Digital conversion and transferred that converted digital value to output.6. Now starts the main logic to control the locomotion aspect of the vehicle using 1 proximity sensor and two photo reflective optical sensors. a. First we check that whether the value from the proximity sensor which is now in output. If it is not within 340 and 390 decimal values then it will sense the photo reflective optical sensors (defined as LED1 and LED2 in the program). According to their values we have given some steps in sequence with appropriate delay. Four combinations arise and they are: i. When LED1 == 1 && LED2 == 1 ii. When LED1 == 1 && LED2 == 0 iii. When LED2 == 1 && LED1 == 0 iv. When LED1 == 0 && LED2 == 0 b. But if this is not the case, as in if the value from the photo reflective optical sensor is within the range of 340 and 390 (15 cm or less) then it will go to the else part of the program where we have given repeated commands with a condition for a 180 degree turn. This 24 number was calculated from the step angle given in the stepper motor documents. Page | 9
  10. 10. Step angle (given) = 7.5 degree Thus, And this comes out to be 24. This was a way to do but this was not much efficient so found another way and that was to take the robot out of its way and then keep rotating it by making one motor stop and the other rotate until both the LED’s (photo reflective sensors) get the sense 1.7. Step 5 and step 6 were repeated as we used a while loop to make the code run forever.All these steps are presented through a UML activity diagram, please seebelow. Page | 10
  11. 11. UML Activity Diagram for Software Design Page | 11
  12. 12. Implementation of the DesignImplementation of the design wasn’t as challenging as we expected and this is due to all theexercises we have carried out since the start of the module. Because we have been introduced anew component weekly; setting up the connection and understanding how the circuit worked wasquiet easy. When we came across a problem; such as unresponsive equipment, it did not take uslong to figure out what the problem was because we were familiar with the equipment.Having these advantages we quickly setup the circuit. We have explained below how we setup thecircuit step by step and the explained further the reason of these connections. D C1 G A B B C1 D 12V C2 D A C2 D 12V F D F E EAbove is our initial connection of the circuit which later on we slightly modified, such as using theDarlington Connector instead of the PIC Port. Page | 12
  13. 13. About the hardware set up: a) Firstly we connected the PIC I/O board and the PIC development board with a 10-pin ribbon cable. This connection was made from the PIC I/O board to Port D on the development board. Using this connection we were able to cross-over 8-bit of information. b) Then with an 8-way connected wire, we have connected I/O board with the microcontroller’s input. c) The output of the microcontroller is then connected to the stepper motors. 0-3 bits to one of the stepper motor and 4-7 bits into the other stepper motor. d) After completing the main connections, we moved on and to power supply connections where 5V were connected to most of the boards and 12V was only connected to the stepper motors. e) We then connected the optical sensors to the sensor board which was already powered by 5V. f) We have connected the sensor board to Port C on the PIC board. g) Finally with an RJ11 cable, we connected the PIC board to MBLAB ICD3 (programmer and debugger) device. Page | 13
  14. 14. Power Supply Power Supply +5 V 0V 0V +12 V Distance Sensor To be placed in front of the vehicle Port E Port A RJ11 connector to MBLAB ICD 3 PIC 18 Port C Port D Port B Darlington Stepper Connector Motor on the robotic vehicleSensor Interface Board Stepper Motor on the robotic vehicle Page | 14 Optical Sensors to be placed under the vehicle
  15. 15. Implementation (further explained)While connecting the circuit we did encounter simple problems. They are seen simple because weeasily found solutions to it. For example when we were planning on how to move the robotic vehicleand how to keep it going constantly, we come across logical difficulties. At first we didn’t know howthe keep the vehicle on the black tape when the tape was curved to a different direction. Then wetalked and confirmed on mutual decisions which is explained further down in the report.The simple circuit shown above is the complete version which we used on our robotic vehicle. Asseen above the so called ‘brain` of this circuit is the PIC18f4520 and it has been programmed with aC language code which we have wrote and it works according to our preferences.Firstly we have connected the Darlington board with the Port D on the PIC. The port D on the PIC isan output interface and we use this output to control the stepper motors. The pins 0-3 areprogrammed to use the Sensor 2 (mentioned LED 2 in the program) and the pins 4-7 are for Sensor 1(mentioned LED1). The pins 9 and 10 are for ground connections. A 5V power supply was connectedto the PIC Board.The other end of the Darlington driver is used to connect the Stepping motors on the robotic vehicle.The wires coming out windings of the stepping motors had to be individually connected on theDarlington board. At first we connected the wires incorrectly and we got to know this as thecomponents were behaving strange but then after carefully checking them we were able to putthem in correctly. The Darlington driver was powered with 12Volts.The stepping motors surely needed power to run so we also connected the two with 12Voltsthrough +Vmotor connection.The next connection we made was connecting the two Optical sensors to the PIC board. Weconfigured our program in such way that each sensor was assigned to a stepping motor. In simplicityeach sensor acted as an eye for the motor it was assigned to. We did this connection by using thehelp of a Sensor Interface board. The output cable from the sensors are connected through the connections shown as ‘Connector S1’ and ‘Connector S2`. The Vcc and the 0V are for the power connections and the sensor output connections 1 and 2 are directed to Port C. Figure 1i – Panos Abatis Page | 15
  16. 16. The Sensor output 1 and 2 are connected to the Port C (as they were the input senses for theprogram) on the PIC Board and these inputs are configured in the program so the motors act onthese values. There are only two output values on these connections which are 0 or 1. 1 while nolight reflected (on black tape) and 0 when light is received (white area). The Sensor board is alsopowered by a 5V supply which also supplies the sensors.We have connected another sensor; Opto proximity sensor (distance sensor), in order to make therobotic vehicle do a 180° turn as shown on the criteria. We have mounted the Sensor in the front ofthe circuit so when the vehicle reaches an approximate distance of 15 cm to an object, it will stopand do a turn.We have connectedIn the Picture above the blue circled is the distance sensor mounted at the front of the roboticvehicle. The output of the sensor is maximum 5 volts depending on the object reflecting theInfrared. As the sensor approaches the object while on the vehicle, the voltage output changes.Because this is an analogue output, we modified the program in such way that certain voltage rangewill make the vehicle move, stop or turn around.The output of this sensor was connected to Port A on the PIC board which is also configured as aninput and this input was an analogue voltage signal.After completion of the component connection, we connected all the equipment with the necessarypower supplies and placed them on top of the robot. Then we plugged in the RJ11 in to the PICboard and programmed it using a MBLAB ICD3 programmer. Page | 16
  17. 17. We then wrote the following program and uploaded it to the PIC microcontroller through the ICD3//*****************************************************************************************/* Assignment 1 - Group BTP *//* Group Members: Divay Khatri, Aleksandr Fedunov, Cagdas Degirmenci *///*****************************************************************************************#pragma config OSC = HS // set osc mode to HS high speed clock#pragma config WDT = OFF // set watchdog timer off#pragma config LVP = OFF // Low voltage Programming off#pragma config DEBUG = OFF // compile without extra debug compile code#include <p18f4520.h> // device used is the PICF4520#include <delays.h> // Include the delays routines#include <adc.h> // include the ADC#include <stdio.h>// defining the line following sensors; LED1 = right side; LED2 = left side#define LED1 PORTCbits.RC0 // compliment bit C0 of port C (change from logic 0 to 1 and vice versa#define LED2 PORTCbits.RC1// when led 1 and led 2 = 1unsigned char STEP1 = 0xA9; // Assign hex value A9 to step 1unsigned char STEP2 = 0x65; // Assign hex value 65 to step 2unsigned char STEP3 = 0x56; // Assign hex value 56 to step 3unsigned char STEP4 = 0x9A; // Assign hex value 9A to step 4// when led 1 = 0 and led 2 = 1unsigned char STEP5 = 0xA0; // Assign hex value A0 to step 5unsigned char STEP6 = 0x60; // Assign hex value 60 to step 6unsigned char STEP7 = 0x50; // Assign hex value 50 to step 7unsigned char STEP8 = 0x90; // Assign hex value 90 to step 8// when led 1 = 1 and led 2 = 0unsigned char STEP9 = 0x09; // Assign hex value 09 to step 9unsigned char STEP10 = 0x05; // Assign hex value 05 to step 10unsigned char STEP11 = 0x06; // Assign hex value 06 to step 11unsigned char STEP12 = 0x0A; // Assign hex value 0A to step 12int output = 0;void main (void) { LATD = 0x00; // Initialise Port D TRISD = 0x00; // 0x00 for output TRISC = 0xFF; // 0xFF for input TRISA = 0xFF; // 0xFF for input Page | 17
  18. 18. while(1) // runs forever { // to convert analogue signal to digital, i.e. ADC (analogue to digital conversion) OpenADC(ADC_FOSC_32 & ADC_LEFT_JUST & ADC_0_TAD,ADC_CH0 & ADC_INT_OFF &ADC_VREFPLUS_VDD & ADC_VREFMINUS_VSS, 0b1011); SetChanADC(ADC_CH0); /* Selects the pin used as i/p to the */ Delay10TCYx(20); /* delay for 200 instruction cycles */ ConvertADC( ); /* start A/D conversion */ while(BusyADC( )); /* wait for completion */ output = ReadADC(); /* reads the converted digital value // main logic if(output <= 340 || output >= 390) { if(LED1 == 1 && LED2 == 1) { LATD = STEP1; // Send first step value to Port D Delay10KTCYx(12); // short delay LATD = STEP2; Delay10KTCYx(12); LATD = STEP3; Delay10KTCYx(12); LATD = STEP4; Delay10KTCYx(12); } else if(LED2 == 1 && LED1 == 0) { LATD = STEP5; Delay10KTCYx(12); LATD = STEP6; Delay10KTCYx(12); LATD = STEP7; Delay10KTCYx(12); LATD = STEP8; Delay10KTCYx(12); Page | 18 }
  19. 19. else if (LED1 == 1 && LED2 == 0) { LATD = STEP9; Delay10KTCYx(12); LATD = STEP10; Delay10KTCYx(12); LATD = STEP11; Delay10KTCYx(12); LATD = STEP12; Delay10KTCYx(12) } else if (LED2 == 0 && LED1 == 0) { while(LED1 != 1 && LED2 != 1) // keep moving one wheel till both the line following sensors are not onblack line { LATD = STEP5; Delay10KTCYx(12); LATD = STEP6; Delay10KTCYx(12); LATD = STEP7; Delay10KTCYx(12); LATD = STEP8; Delay10KTCYx(12); }} }else if(output > 340 && output < 390) { LATD = STEP5; Delay10KTCYx(12); LATD = STEP6; Delay10KTCYx(12); LATD = STEP7; Delay10KTCYx(12); Page | 19
  20. 20. LATD = STEP8; Delay10KTCYx(12); LATD = STEP5; Delay10KTCYx(12); LATD = STEP6; Delay10KTCYx(12); LATD = STEP7; Delay10KTCYx(12); LATD = STEP8; Delay10KTCYx(12);while(LED1 != 1 && LED2 != 1) { LATD = STEP5; Delay10KTCYx(12); LATD = STEP6; Delay10KTCYx(12); LATD = STEP7; Delay10KTCYx(12); LATD = STEP8; Delay10KTCYx(12); } }}} Page | 20
  21. 21. Project ComponentsThe components we used are given below along with their pricing and from where to buy. Component Cost Link Name 1 Proximity £9.33 Sensor Components/Distance-measuring-sensor-digital- output-81725/?sid=90f23f20-646b-4706-a66a- 17487f1d1fc5 1 PIC18f4520 £4.72 microcontroller Components/PIC18Fwxyz-Enhanced-Flash- microcontroller-64435/?sid=2fbad005-5de5-4e06- b030-abb943273caf 2 Photo 2x £4.30 = £8.60 Optical blIa22dKKR%2F8%2FPojtStag%3D%3D&cm_mmc=findc Sensors hips-_-na-_-na-_- na&extra=index=4%7Cquery=OPB743%7Cqty=02 Stepper Motors 2x£8.35 = £16.70 Phase-Bipolar-Stepper-Motor-12v-37- 0507/?sid=09feedbc-9699-47dc-9868-df23ccdca7f3 Copper Wire £2.83 wire-83192/?sid=369bfaaf-db6a-464f-a38f- 04f214c6ae63Darlington Driver £5.09 t/darlington-driver-serial-8bit-5841/dp/1202821Microchip ICD 3 £124.88 evaluation-icd3/dp/1664878In total by spending £172.15 + miscellaneous charges (power supply) we can build thisrobotic vehicle and program it as well. Page | 21
  22. 22. Test Methodology:This design was not built at once. We did it in parts and noticed how the thing works and thenreversed it and then saw how it worked and we noted down the changes.First we set the hardware with just one stepper motor and saw the movement.And programmed PORTD 0-3 bits according to this pattern STEP 1 0x09 STEP 2 0x05 STEP 3 0x06 STEP 4 0x0AThis made the stepper motor move in a full step sequence in a clockwise direction. And reveringthese values made the stepper motor move in a full step sequence in an anti-clockwise direction. STEP 1 0x0A STEP 2 0x06 STEP 3 0x05 STEP 4 0x09We understood that on reversing the code the movement of the stepper motor changed. Now weattached another stepper motor to PORTD 4-7 bits and tried making both the motors move at thesame time. Since we knew the concept thus changed the values of steps to: Page | 22
  23. 23. STEP 1 0xA9 STEP 2 0x65 STEP 3 0x56 STEP 4 0x9AWe kept one value to be ‘9’ and other to be ‘A’ because when a car moves we know that the tires ofthe car moves in the same direction but the motor which makes them move actually rotate inopposite directions. The same concept we applied here and while making changes to thehexadecimal values of the steps we kept in mind to make one motor rotate in clockwise directionand the other in anti-clockwise direction.When we completed the investigation of the stepper motors then we started dealing with the photoreflective optical sensors and started testing them on the black line and on other surface as well andfound that when they were faced down on some other surface then get the light in the receiver andthus completes the connection and returns a value of ZERO, but when placed faced down on a blacksurface, the receiver receives no light and the connection doesn’t get complete and returns a valueONE. So we were sure that when placed on a black surface the sensors return a value 1 and when onother surface it returns a value 0. We then connected sensors to PORTC bits 0 and 1. We definedright sensor of the vehicle as LED1 and the left one as LED2 on PORTC bit 0 and PORTC bit 1respectively. Then we did the coding by using if-else conditional statements. Some part of the codelooks like:if(LED1 == 1 && LED2 == 1) else if(LED2 == 1 && LED1 == 0) { { LATD = STEP1; LATD = STEP5; Delay10KTCYx(12); Delay10KTCYx(12); LATD = STEP2; LATD = STEP6; Delay10KTCYx(12); Delay10KTCYx(12); LATD = STEP3; LATD = STEP7; Delay10KTCYx(12); Delay10KTCYx(12); LATD = STEP4; LATD = STEP8; Delay10KTCYx(12); Delay10KTCYx(12); } }We compared both the LED1 and LED2 senses to assign them a pattern of stepping sequence. Thiswas just a bit of the whole code to give an idea how the conditions were made. Page | 23
  24. 24. Then since we had to make the vehicle turn 180 when it sense an obstacle another condition wasgiven in the code. Proximity sensor senses the obstacle by checking the voltage. This analogue signal(voltage) needs to be converted to digital signal to check it through the PIC microprocessor.This was done by Analogue to Digital conversion code.OpenADC(ADC_FOSC_32 & ADC_LEFT_JUST & ADC_0_TAD,ADC_CH0 & ADC_INT_OFF &ADC_VREFPLUS_VDD & ADC_VREFMINUS_VSS, 0b1011); SetChanADC(ADC_CH0); /* Selects the pin used as i/p to the */ Delay10TCYx(20); /* delay for 200 instruction cycles */ ConvertADC( ); /* start A/D conversion */ while(BusyADC( )); /* wait for completion */ output = ReadADC();Now output contains the converted digital signal which we need to compare with our decimal valuesfor proximity sensor value of 15 cm or closer which isOutput should be greater than 340 and less than 390 to be considered for an obstacle and to make a180 turn.We got these values from the calculation: We know that 5 volts = 1024 decimal value. Using a programmer calculator we found out these values. Analogue voltage Decimal Value 10-bit binary value Hexadecimal value 5 volts - 1024 - 1111 1111 11 - 0x3FF 2.5 volts - 511 - 0111 1111 11 - 0x1FF 1.9 volts - 388 - 0110 0001 00 - 0x184By clubbing the stepping sequence, the photo reflective optical sensors and the proximity sensorcode the main function of the .c file was written. We have already talked about the 180 turn butonce again see at that logicThis was the design process and the testing methodology including the UML activity diagrams forHardware and Software design for the robotic vehicle. Page | 24
  25. 25. Conclusion:The group assignment we carried out helped us have a wider view on electronics and its integrationwith software. We got an idea of ‘The World of Logic and Circuits’ and understood how thisintegration works. Now we feel that we stand a step closer to be an engineer and proved toourselves that this was the right choice for our professional life. This situation may seemexaggerating but a ‘Big Success’ has many small steps in the way. This project also made us feelmore confident on practical basis, where we felt as if we were working with this equipment for along time.Working as a group in this project contributed in our success, because we all were not familiar withevery aspect of the requirements. One of us was good with programming, one with the hardwarepart as in the circuit part and one with both. Logical thinking is a very important aspect to build anycircuit that has no idea of what environment it is going to deal with, and this aspect was in all threeof us. We always thought a problem logically first, worked that logic out on paper and one of usdecided how we will work this in coding, the other decided how this will work with the hardwareand we started setting up the hardware and writing the code so as not to waste any time. By doingthis project together we ended up getting knowledge and information on the areas we were weak inthrough sharing our ideas and thoughts with each other.During the last three weeks where we carried out several tasks, we came across some problems. Forexample at one point the sensor we were using was not working so we couldn’t get the car moving.It took us a bit of time to find out it was the sensor which wasn’t working, as we had to individuallytest every component and wire connections. Other than that we didn’t encounter any majorproblems, and carried out the required tasks easily.After we built the circuit and programmed the PIC we decided to test the robotic vehicle. It would’vebeen amazing if everything went perfect at first stage, but unfortunately this didn’t happen. We hadto modify a lot of little things like, the distance between the sensors and the surface, change thecoding as the vehicle was moving faster than it should and sometimes it got out of its track (blacktape). As mentioned before with a bit of modifying and adjustments these problems were overcome.Finally when we finished the robotic vehicle and was satisfied with the design and the coding, wethought we gave our best shot. So we placed a nice and straight black tape on the table with coupleof curves which leaded to a cardboard (acted as an object for the distance sensor). Then we placedthe robot and made it run and this time we were really satisfied as it smoothly went along the blacktape and did a 180° turn in the end. This made us feel good as all the hard work we put in, resultedin our success. Page | 25
  26. 26. References:1 ADC conversion code: Chart the configuration settings of the PIC the delay functions used in the code the MCC18 C compiler the sensors the stepper motors Page | 26