Friday, September 20, 2019

Mobile Robotic Arm Motivation Computer Science Essay

Mobile Robotic Arm Motivation Computer Science Essay Robotics is technology that deals with the design, construction and operation of  robots  that are used in numerous applications is called robotics. It has become an unstoppable force in the development of modern machinery as they make life easier. It is an interesting topic to dwell in as it is the future of mankind. Although we know them as recent inventions, the idea of automated or controlled machines has fascinated humans. With this fascination it motivated me to work on this project, building and programming a mobile robotic arm. It is my hunger to learn and attain knowledge that drives me towards this field of study for my project. C:UsersDanDesktopImages21042010(002).jpg Figure 1.1.1 : Mobile Robotic Arm 1.2 Introduction to Robotics Robotics is an interesting topic of research. Basically it is an engineering field that is concerned with research and creation of robots for various applications. Robots are machines that consist of electronic and mechanical parts such as gears and cogs put together for performing tasks in place of humans. They can be programmed to perform a whole range of tasks with ease. They are most desired for certain functions because they never tire, they can endure harsh physical conditions that is possibly life threatening and they never get bored or distracted from repetitious work. The number of robots has begun to increase in numbers everywhere as they make human labour almost non-existent with their efficiency and throughput. They can work with the simplest of materials to the most dangerous such as radioactive materials. They can be found more commonly in industrial use from production lines of factories to harvesting of fruits in orchards. In domestic use, from vacuum cleaning to lawn mowing where these domestic tasks have become boring for a human to undertake and would rather leave it to robots. In the more modern military use, robots play an important role to reduce human casualties from dangerous jobs such as bomb defusal and not forgetting space exploration where it might not be possible for humans to explore and for collecting terrain sample from foreign planets. For exploring enemy territories unmanned aerial vehicles are used from which these pilotless drones can search terrains for hostiles and fire on targets. Robots are meant to complete tasks that it is programmed to do. Programs can always be altered to suit the task at hand. As robots become more advanced they gain more features such as sensors and artificial intelligence as they become more human like. Examples of sensors include motion sensors, temperature sensors, light and many more various types. For example, in pathfinder robots we usually find a motion sensor which aids a robot in avoiding obstacles. In other applications for example in a water tank when the water has reached a certain level the sensor enables the robot to stop the flow of water. It can be used in industrial applications such as gripping objects from conveyor belts or it can be used in a more advanced role such as bomb defusal, where it would be dangerous for a human to interact. With camera attachments, humans can control these machines from a safe distance while completing the task at hand in a safe and efficient manner. In the medical field where a more delicate touch is required, a robotic arm can perform tiny incisions for a less invasive method. With a robotic arm jobs can be done with ease and efficiency and thus eliminate human errors and the costs that come with those errors. http://www.engr.colostate.edu/~dga/mech324/handouts/linkage_stuff/Mars_rover.png Figure 1.2.1 : Mars Rover 1.3 Objectives The aim of this project is to build a robotic arm for the purpose of lifting and moving small objects. It is just like a human arm with joints to facilitate movement. The end attachment features a gripper which is able to grab and hold objects and also a probe light in order to work in low light scenarios. The arm is controlled via wired remote. It is rested on a mobile base which is fitted with 2 rear wheels and 2 robot castors at the front. This allows the robot to move to the desired location where the object is. The objectives of this project are: To understand and develop core knowledge in robotics. To apply the knowledge of robotics and design a prototype. To implement the designs and build an actual prototype. Figure 1.3.1 : Project Layout End Insert Instruction Codes into PIC Test Prototype Evaluate Coding in relation to hardware design Write Codes Discuss Movement Concept Propose Objectives1.4 Design Stage Figure 1.4.1 : Design Flow Chart This simple flowchart can explain the overall process involved in this project. After the objectives have been proposed the robot movement and motion concept is discussed and after that the codes are written. It is downloaded into the microcontroller for testing. If testing fails we return to the code stage and evaluate the coding. The process reaches the end after testing passes. Chapter 2: Robot Overview 2.1 Hardware Design This aim of this project is to design a mobile robotic arm. The arm part consists of two joints which enable 2 degree of movement and at the end of the top joint is a gripper which enables objects to be gripped by the attachment. The base has two wheels at the back and at the front two robot castors which has ball bearings underneath. This project involves two parts which is hardware and software. However both parts are intricately connected and it is hard to actually separate them completely. This report will focus more on the software aspect. There will be some minor hardware introduction as understanding of the hardware is required to work with the software. Here is the component list for the hardware: Component Amount Microcontroller PIC18F4520 1 Motor Driver SN754410 1 4.7k Ohm Resistor 1 1uF Capacitor 4 0.33uF Capacitor 1 0.1uF Capacitor 1 L7805 Voltage Regulator 1 20MHz Oscillator 1 9 Volt Battery 1 C40R Servo Motor 3 C55R Servo Motor 1 Servo Holder 4 Servo U Bracket 2 SPG10 Geared Motor 2 42mm Wheels 2 Robot Castors 2 Table 2.1.1 : Hardware Components To write the software one must be familiar with the hardware functionality, configuration and settings. The hardware of significant importance would be the microcontroller as the program is stored there. It sends the signal to the pins where other devices are connected. One of those devices is the servo motor. It is what controls the arm and base. Actual control of the servos is by buttons. Those buttons are connected to the microcontroller and is able to control the servo thru programming of the microcontroller. It is done by generating and manipulating PWM signals which will be discussed later. PROJECT BOARD 20.0 cm 24.0 cm 10.0 cm 25.6 cmTOP PROFILE.jpg Figure 2.1.1 : Robot Layout 2.2 Software Design After the purpose and specifications are determined it is time to plan and design the software. Most modern robots are controlled by sophisticated software. Creation and modification of the software is crucial to make machines work the way we want it to. There are many ways a machine can be programmed. The software is usually stored in the heart of the machine which is either a microprocessor or a microcontroller depending on what the machine does and how it works. That device is the brains of the robot as all the instructions are stored there. The software is the link for the user to the hardware as the program relays the instructions to the robot in machine code. The user writes the program in computer language which will then be converted into machine code by the compiler. There are many computer languages available to write programs such assembly, C, Pascal, BASIC and FORTH. For this project the microcontroller that is used is Microchips PIC18F4520. The language used to program the microcontroller is C. C is a simple and procedural language and it has influenced many later languages such Java. It is generally variable and function based. Values are stored in variables for easy access and it is structured by defining and calling functions to perform tasks. C allows precise control of the input and output. The input and output can be easily directed to the microcontroller terminals. The IDE (integrated development environment) that is used for this project is MPLAB which is a 32bit program used for the software development of this project along with the MPLAB C18 compiler add-on to allow the codes to be written in C . This is the screenshot of the development environment: C:UsersDanDesktopFYP ReportimagesUntitled.jpg Figure 2.2.1: MPLAB IDE The general idea of writing the program is to control the pins of the microcontroller. The robot arm mechanism and the base mechanism will be separated for easier explanation. The arm is made up of the 1st stage, 2nd stage, the left gripper and the right gripper. Control of the servos is by generating PWM signals which will be discussed in detail in chapter 4. By manipulation of these PWM signals we can control the servo movement to a certain angle with great precision. For the DC motors in the base, it is controlled via motor controller. By manipulating logic combinations we will be able to control the movement and direction of the base. Infinite loop to check for button press A button is pressed Necessary routine or function is called to move servo/ DC motor End Figure 2.2.2 : General Software Flowchart This is a general flowchart to represent the program flow. A while loop with an infinite condition is used to continuously check if a button has been pressed. If a button is pressed it will call the necessary function to run the specific device whether it is the servo or the DC motor. Chapter 3: Hardware Information 3.1 Microcontroller This project makes use of Microchip Technologys PIC18F4520 microcontroller. Lets discuss in detail what is a microcontroller and how it makes this project work. Notice that a microcontroller is chosen instead of a microprocessor for this project for a number of reasons. To make the choice, one must know the difference between a microcontroller and a microprocessor in terms of functionality and application. Both are typically a small computer in the form of an integrated circuit which contains things like registers, memory, I/O, interrupts and timers. They vary in terms of number of I/O, registers, clock speed and memory size. Microcontrollers are usually for cases that involve a lot of input output devices in contrast to a microprocessor which is usually used for heavy data applications. So that means microcontrollers dominate the robotics and automation industry. Lets examine closely what it looks like and the detailed features for this particular microcontroller, the PIC18F4520. Its versatility, robust nature and features contributed to the choosing of this IC. The detailed features along with its operation can be found in the datasheet for the microcontroller. C:UsersDanDesktopFYP ReportimagesPIC18F4520IP.jpg Figure 3.1.1 : PIC18F4250 Parameter Name   Value   Program Memory Type   Flash   Program Memory (KB)   32   CPU Speed (MIPS)   10   RAM Bytes   1,536   Data EEPROM (bytes)   256   Digital Communication Peripherals   1-A/E/USART, 1-MSSP(SPI/I2C)   Capture/Compare/PWM Peripherals   1 CCP, 1 ECCP   Timers   1 x 8-bit, 3 x 16-bit   ADC   13 ch, 10-bit   Comparators   2   Temperature Range (C)   -40 to 125   Operating Voltage Range (V)   2 to 5.5   Pin Count   40 Table 3.1.1 : PIC18F4250 Specifications Peripheral Highlights: à ¢Ã¢â€š ¬Ã‚ ¢ High-current sink/source 25 mA/25 mA à ¢Ã¢â€š ¬Ã‚ ¢ Three programmable external interrupts à ¢Ã¢â€š ¬Ã‚ ¢ Four input change interrupts à ¢Ã¢â€š ¬Ã‚ ¢ Up to 2 Capture/Compare/PWM (CCP) modules, one with Auto-Shutdown (28-pin devices) à ¢Ã¢â€š ¬Ã‚ ¢ Enhanced Capture/Compare/PWM (ECCP) module (40/44-pin devices only): One, two or four PWM outputs Selectable polarity Programmable dead time Auto-Shutdown and Auto-Restart à ¢Ã¢â€š ¬Ã‚ ¢ Master Synchronous Serial Port (MSSP) module supporting 3-wire SPIà ¢Ã¢â‚¬Å¾Ã‚ ¢ (all 4 modes) and I2Cà ¢Ã¢â‚¬Å¾Ã‚ ¢ Master and Slave Modes à ¢Ã¢â€š ¬Ã‚ ¢ Enhanced Addressable USART module: Supports RS-485, RS-232 and LIN 1.2 RS-232 operation using internal oscillator block (no external crystal required) Auto-Wake-up on Start bit Auto-Baud Detect à ¢Ã¢â€š ¬Ã‚ ¢ 10-bit, up to 13-channel Analog-to-Digital Converter module (A/D): Auto-acquisition capability Conversion available during Sleep à ¢Ã¢â€š ¬Ã‚ ¢ Dual analog comparators with input multiplexing) Power Managed Modes: à ¢Ã¢â€š ¬Ã‚ ¢ Run: CPU on, peripherals on à ¢Ã¢â€š ¬Ã‚ ¢ Idle: CPU off, peripherals on à ¢Ã¢â€š ¬Ã‚ ¢ Sleep: CPU off, peripherals off à ¢Ã¢â€š ¬Ã‚ ¢ Idle mode currents down to 5.8 ÃŽÂ ¼A typical à ¢Ã¢â€š ¬Ã‚ ¢ Sleep mode current down to 0.1 ÃŽÂ ¼A typical à ¢Ã¢â€š ¬Ã‚ ¢ Timer1 Oscillator: 1.8 ÃŽÂ ¼A, 32 kHz, 2V à ¢Ã¢â€š ¬Ã‚ ¢ Watchdog Timer: 2.1 ÃŽÂ ¼A à ¢Ã¢â€š ¬Ã‚ ¢ Two-Speed Oscillator Start-up Flexible Oscillator Structure: à ¢Ã¢â€š ¬Ã‚ ¢ Four Crystal modes, up to 40 MHz à ¢Ã¢â€š ¬Ã‚ ¢ 4X Phase Lock Loop (available for crystal and internal oscillators) à ¢Ã¢â€š ¬Ã‚ ¢ Two External RC modes, up to 4 MHz à ¢Ã¢â€š ¬Ã‚ ¢ Two External Clock modes, up to 40 MHz à ¢Ã¢â€š ¬Ã‚ ¢ Internal oscillator block: 8 user selectable frequencies, from 31 kHz to 8 MHz Provides a complete range of clock speeds from 31 kHz to 32 MHz when used with PLL User tuneable to compensate for frequency drift à ¢Ã¢â€š ¬Ã‚ ¢ Secondary oscillator using Timer1 @ 32 kHz à ¢Ã¢â€š ¬Ã‚ ¢ Fail-Safe Clock Monitor: Allows for safe shutdown if peripheral clock stops Special Microcontroller Features: à ¢Ã¢â€š ¬Ã‚ ¢ C compiler optimized architecture: Optional extended instruction set designed to optimize re-entrant code à ¢Ã¢â€š ¬Ã‚ ¢ 100,000 erase/write cycle Enhanced Flash program memory typical à ¢Ã¢â€š ¬Ã‚ ¢ 1,000,000 erase/write cycle Data EEPROM memory typical à ¢Ã¢â€š ¬Ã‚ ¢ Flash/Data EEPROM Retention: 100 years typical à ¢Ã¢â€š ¬Ã‚ ¢ Self-programmable under software control à ¢Ã¢â€š ¬Ã‚ ¢ Priority levels for interrupts à ¢Ã¢â€š ¬Ã‚ ¢ 8 x 8 Single-Cycle Hardware Multiplier à ¢Ã¢â€š ¬Ã‚ ¢ Extended Watchdog Timer (WDT): Programmable period from 4 ms to 131s à ¢Ã¢â€š ¬Ã‚ ¢ Single-supply 5V In-Circuit Serial Programmingà ¢Ã¢â‚¬Å¾Ã‚ ¢ (ICSPà ¢Ã¢â‚¬Å¾Ã‚ ¢) via two pins à ¢Ã¢â€š ¬Ã‚ ¢ In-Circuit Debug (ICD) via two pins à ¢Ã¢â€š ¬Ã‚ ¢ Wide operating voltage range: 2.0V to 5.5V à ¢Ã¢â€š ¬Ã‚ ¢ Programmable 16-level High/Low-Voltage Detection (HLVD) module: Supports interrupt on High/Low-Voltage Detection à ¢Ã¢â€š ¬Ã‚ ¢ Programmable Brown-out Reset (BOR With software enable option Here is a list of pins and how they are connected in the circuit. Pin Name Pin Number (PDIP) Functions MCLR 1 Reset RA1 3 Servo PWM Input RA2 4 Servo PWM Input RA3 5 Servo PWM Input RA4 6 Servo PWM Input VDD 11 +5V VSS 12 Grounded OSC1 13 Oscillator Crystal/External Clock Input OSC2 14 Oscillator Crystal/External Clock Input RC0 15 IN2 of Motor Driver RC1 16 IN1 of Motor Driver RC3 18 IN4 of Motor Driver RD0 19 IN3 of Motor Driver VSS 31 Grounded VDD 32 +5V RB0 33 Motor Push Button RB1 34 Motor Push Button RB2 35 Motor Push Button RB3 36 Motor Push Button RB4 37 Servo Arm Push Button RB5 38 Servo Arm Push Button RB6 39 Servo Arm Push Button RB7 40 Servo Arm Push Button Table 3.1.2 : Pin Connections C:UsersDanialDesktopFull Schem.JPG Figure 3.1.2 : Full Schematics 3.2 Motor Driver Figure 3.2.1 : SN754410 Motor Driver The SN754410NE is a quadruple half-H driver. The SN754410 can operate a pair of DC motors at the same time. It gives the robot bidirectional movements. It carries the peak output currents up to 1 ampere at a voltage range of 4.5 to 36V. The SN754410 has a minimum logic voltage of 4.5V and a maximum logic voltage of 5.5V. This driver is made to operate from a -400C to 850C. Drivers are enabled in pairs. Driver 1 and driver 2 are enabled by 1,2EN. Driver 3 and driver 4 are enabled by 3,4EN. When the input is low, the drivers are disabled and the outputs are off. If the input is high, the drivers are enabled and the outputs are on. Figure 3.2.2 : SN754410 Motor Driver Pinout Pin 1 (1,2EN) enables/ disables the motor Pin 2 (1A) is a logic pin for the motor Pin 3 (1Y) is for Motor A Pin 4, 5 are for grounding Pin 6 (2Y) is for Motor A Pin 7 (2A) connected to the motor Pin 8 (VCC2) connected to source for motor power Pin 9 (3,4EN) enables/ disables the motor Pin 10 (3A) connected to the motor Pin 11 (3Y) is for Motor B Pin 12, 13 are for grounding Pin 14 (4Y) is for Motor B Pin 15 (4A) connected to the motor INPUTS OUTPUT Y H = High Level L = Low Level X = Do Not Matter XX = OFF A EN H H H L H L X L XX Table 3.2.1 : SN754410 Function Table C:UsersDanialDesktopMotor.JPG Figure 3.2.3 : Motor Schematics 3.3 DC Motor This project will use the SPG10 Geared Motor that has 1.3 kg/cm torque. This motor is light enough to not weigh down the robot and only weighs 10 grams. It runs at 45 rpm. Figure 3.3.1 : SPG10 Motor C:UsersDanDesktopImages23042010(001).jpg Figure 3.3.2 : Motor Wheel 3.4 Servo Motor A servo is a mechanism used in robotic control systems. It is a mechanism that the user can set and forget. This is because of its ability to make corrections to return to its preset state if any changes occur. This is thanks to feedback operations. A servo is a casing that contains a DC motor, some gears with an output shaft, a variable resister that is connected to the output shaft, and a control board. The sensor mechanism allows the control circuit to monitor the current. The motor, through a series of gears, turns the output. The control circuit calculates the difference from the intended position from the current position the shaft is in. This makes the motor turn to its new position. If the control circuit senses that the position is accurate, it brings to a halt the motor. There are three connections to a servo; the power line, the ground line and finally the control signal. The servo needs to be told when to move and wont do so even if power is provided directly. The servo utilizes pulse width modulation (PWM) stream to indicate its position. Specification Servo Motor Model At 5 Volts Speed (s/60o) 0.19 Torque (Kg.cm) 6.00 Signal To Control Angle TTL PWM PWM At Min Angle (ms) 0.54 PWM At Max Angle (ms) 2.40 Operating Voltage (VDC) 4.8-6.0 Operating Frequency (Hz) 50.0 Moving Range(degree) 0-180 Wiring (Black/Brown Wire) Ground Wiring (Red Wire) 4.8-6.0 Volts Wiring (Orange/Other Wire) PWM Signal Table 3.4.1 : Servo Specifications C:UsersDanialDesktopUntitled.jpg Figure 3.4.1 : Servo Motor C:UsersDanialDesktopServo.JPG Figure 3.4.2 : Servo Schematic Chapter 4: Software Coding 4.1 PWM Generation PWM is simply the short form for pulse-width modulation. It is an efficient way to provide intermediate amounts of electrical power between fully on and fully off. This means PWM signals are digital, because at any instant given instant of time, the full DC supply is either fully on or fully off. PWM is employed in a wide variety of applications, ranging from measurement and communications to power control and conversion. Many microcontrollers include on-chip PWM controllers, like the one which is used this project, which makes this easy for controlling the servos for this project. One of the advantages of PWM is that the signal remains digital all the way from the processor to the controlled system and no digital-to-analog conversion is necessary. By keeping the signal digital, noise effects are minimized. Noise can only affect a digital signal if it is strong enough to change logic 1 to logic 0, or vice versa. PWM is the basis of controlling the servos in this project. Lets examine some basic theory. C:UsersDanDesktopFYP Reportimagespwm.gif Figure 4.1.1 : PWM Square Wave The diagram above shows a PWM signal that changes between 0 and 5 volts which is equivalent as digital logic 0 and 1. Notice that the waves are symmetrical. The uptime and downtime is 10ms when added together we get the period which is 20ms. Now that the basics are out of the way, lets look at how a normal servo signal input looks like. C:UsersDanDesktopFYP Reportimagespwm_servo.gif Figure 4.1.2 : PWM Wave Note that the servo runs at 50Hz frequency and therefore the period is 20ms. The uptime is what determines the angle of which the servo motor moves to. In simple words, we can tell the servo where to move with great precision. These are some examples for 180 ° servos. t = 0.9ms T = 20ms Angle = 0 ° t = 1.5ms T = 20ms Angle = 90 ° t = 2.1ms T = 20ms Angle = 180 ° The next step is to create these PWM signals using the PIC microcontroller. The PWMs is in this switch statement: switch(count){ //Choose which servo to modify case 1: PORTA = 0x02; // First Stage WriteTimer1( servo3 ); break; case 2: PORTA = 0x04; // Left Gripper WriteTimer1( servo1 ); break; case 3: PORTA = 0x08; //Right Gripper WriteTimer1( servo0 ); break; case 4: PORTA = 0x10; // Second Stage WriteTimer1( servo2 ); break; } Figure 4.1.3 : Switch Statement The operations for the timers are split in to 4 possible cases of how to generate PWM signal to the pins to power the servos. This is what the statement does:   Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  //INTERRUPT CONTROL #pragma code InterruptVectorHigh=0x08 void InterruptVectorHigh (void) { _asm  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  //assembly code starts goto InterruptHandlerHigh   Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  //interrupt control _endasm  Ã‚  Ã‚  //assembly code ends } #pragma code #pragma interrupt InterruptHandlerHigh   Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  Ã‚  //end interrupt controlCase 1 turns PortA1 On and resets the timer1.   Case 2 turns PortA1 Off, PortA2 on and resets the timer1. Case 3 turns PortA2 Off, PortA3 on and resets the timer1. Case 4 turns PortA3 Off, PortA4 on and resets the timer1. Figure 4.1.4 : Interrupt Handler The switch statement is nested in the interrupt handler function. The interrupt handler handles the timer operations. The interrupt control runs assembly code and then calls the go-to function which is InterruptHandlerHigh. The interrupt controller is set at high priority 0x08. Once the interrupt control is correctly implemented interrupts is sent to the interrupt handler where we can do whatever operation necessary depending on the type of interrupt.   4.2 Arm Control void move(int one,int two,int three,int four, int five) { if(one) servo0 = one; // Right Gripper if(two) servo1 = two; // Left Gripper if(three) servo2 = three; // Second Stage Link if(four) servo3 = four; // First Stage Link }A move function is declared to make things easier when linking with buttons. The arguments of the move function are the respective position the servo moves to when it is called upon. Figure 4.2.1 : Move Function After the move function is declared it can be called when the specific button is pressed. //Arm Control if(PORTBbits.RB7==1) move(0xF03B,0xF477,0,0,0); //GRIP! if(PORTBbits.RB6==1) move(0,0,(servo2-0x0250),(servo3+0x0100),0); //MOVE AWAY if(PORTBbits.RB5==1) move(0,0,(servo2+0x0250),(servo3-0x0100),0); //MOVE TOWARDS if(PORTBbits.RB4==1) move(0xFA77,0xEE07,0,0,0); //UNGRIP! Figure 4.2.2 : Arm Button Check There are 4 buttons that control the movement of the arm. PortB pin 0: Close the gripper PortB pin 1: Move arm away PortB pin 2: Move arm towards PortB pin 3: Open the gripper C:UsersVictorDesktopImagesClose Gripper.jpg Figure 4.2.3 : Close Gripper This picture depicts a closed gripper state that is triggered by the button. The following figure is how the robotic arm will look when it is triggered to open both grippers. C:UsersDanDesktop22042010(007).jpg Figure 4.2.3 : Open Gripper 4.3 Base Control The only thing that needs to be controlled in the base is the 2 DC geared motors. It is linked with the microcontroller through the H-bridge. The motors rotational direction is determined by a combinational logic code as seen in the data sheet of the motor driver. It is the same with the servo, when a button is pressed certain commands will be executed. //Base Control if(PORTBbits.RB3==1) { //Forward control PORTCbits.RC1=1; PORTCbits.RC0=0; PORTDbits.RD0=1; PORTCbits.RC3=0; } if(PORTBbits.RB2==1) { //Reverse control PORTCbits.RC1=0; PORTCbits.RC0=1; PORTDbits.RD0=0; PORTCbits.RC3=1; } Figure 4.3.1 : Base Button Check (Forward/Reverse) if(PORTBbits.RB1==1) { //Left control PORTCbits.RC1=0; PORTCbits.RC0=1; PORTDbits.RD0=1; PORTCbits.RC3=0; } if(PORTBbits.RB0) { //Right Control PORTCbits.RC1=1; PORTCbits.RC0=0; PORTDbits.RD0=0; PORTCbits.RC3=1; } Figure 4.3.2 : Base Button Check (Left/Right) There are 4 buttons that control the movement of the base. PortB pin 4: Forward PortB pin 5: Reverse PortB pin 6: Move right PortB pin 7: Move left 4.4 Simulation C:UsersDanDesktopUntitled.jpg Figure 4.4.1 : Watch Simulation The MPLAB software allows a minimal amount of simulation to show that the program is written correctly. Due to software limitation on the PIC18F4520 it is unable to correctly show port activities. However it does show variable activity like in the figure by using the watch feature in the MPLAB. This screenshot shows the stepping when reaching the OpenTimer1 function. A separate window opens to show the function and it will continue to step through the function until it is done. C:UsersDanDesktopUntitled1.jpg Figure 4.4.2 : Program Stepping The stepping continues while opening the necessary functions in a separate window and steps though it until it is done. It reaches the while loop and it keeps looping as it waits for a button to be pressed. Figure 4.4.3 shows the final stage of the program stepping. C:UsersDanDesktopUntitled3.jpg Figure 4.4.3 : Final Stepping Chapter 5: Conclusions and Recommendation 5.1 Summary This project has further expanded my interest and knowledge in the field of robotics. A project that is very hands on like this helps with the development of certain skills that would certainly help when I go on to become a professional engineer. The most important skill would be planning the stages of the project. To conclude, this project involved two phases which is the hardware design and software design. This report covered the software aspect in detail. In the early stages of this project different methods was planned for the outcome. At the start, the use of a PLC (programmable logic controller) was planned. However it proved to be infeasible in terms of cost and size. In the end it was decided that a PIC microcontroller was to be use as it is easier to implement with respect to the project and provides a great deal of functionality. The programming was made easier with the addition of the C compiler thus enabling the use of a higher level language which is C. With the use of a language of higher level it would be easier to implement features that were not possible using the PLC. 5.2 Recommendations In this project, certain improvements can be made in order to make things work more efficiently. For example, the quick movements seen in the arm is because of the incrementer seen in the codes and lack true control software. By revising the software and introducing more control oriented design it is possible to fine tune the speed. Instead of the 2 robot castors that make up the front motion it could be replaced with wheels and a servo in between them to make the movement and control similar to remote controlled cars. The wired controller could be replaced with a wireless RF controller to allow more freedom to the user. The body work could be improved by using sturdier and lightweight materials such as aluminium. Some sensors could be added to enhance the normal usage of the arm.

No comments:

Post a Comment