Tuesday, June 4, 2019
Mobile Robotic Arm Motivation Computer Science Essay
Mobile Robotic Arm Motivation Computer Science EssayRobotics is technology that deals with the end, construction and transaction of automatonsthat are employ in numerous applications is called robotics. It has become an unstopp fitting force in the ripening of mod machinery as they make life easier. It is an interesting publication to dwell in as it is the future of mankind. Although we know them as recent inventions, the vagary of automated or pick upled 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.CUsersDanDesktopImages21042010(002).jpg digit 1.1.1 Mobile Robotic Arm1.2 universe to RoboticsRobotics is an interesting topic of re seek. 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(prenominal) as gears and cogs put together for performing tasks in place of humans. They female genitalia be programmed to perform a whole range of tasks with ease. They are most desire for reliable puzzle outs because they never tire, they can endure harsh physical conditions that is possibly life threatening and they never get bored or distracted from reiterative work. The number of robots has begun to increase in numbers everywhere as they make human labour almost non-existent with their efficacy and throughput.They can work with the simplest of materials to the most precarious such as radioactive materials. They can be found more than 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 usage to reduce human casualties from dangerous jobs such as bomb defusal and non 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 go they gain more features such as sensors and artificial intelligence as they become more human resembling. Examples of sensors include motion sensors, temperature sensors, light and many more various types. For deterrent 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 t o stop the flow of water. It can be used in industrial applications such as grip fleur-de-lisg 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 dominance these machines from a safe distance plot of land completing the task at hand in a safe and efficient manner. In the medical field where a more delicate raise up 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 omen 1.2.1 Mars Rover1.3 ObjectivesThe aim of this project is to build a robotic arm for the purpose of lifting and abject small objects. It is just standardized a human arm with joints to facilitate faecal matter. The end attachment features a gr ipper 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 outdoor stage 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 areTo understand and develop center 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 LayoutEndInsert Instruction Codes into paintingTest PrototypeEvaluate Coding in relation to ironware designWrite CodesDiscuss Movement ConceptPropose Objectives1.4 Design gunpointFigure 1.4.1 Design Flow ChartThis simple flowchart can explain the overall process involved in this project. After the objectives have been proposed the robot try and motion concept is discussed and after that the codifications are written. It is download ed into the microcontroller for testing. If testing fails we return to the regulation stage and evaluate the coding. The process reaches the end after testing passes.Chapter 2 Robot Overview2.1 Hardware DesignThis aim of this project is to design a mobile robotic arm. The arm part consists of two joints which enable 2 degree of trend 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 product product. However twain parts are intricately attached and it is hard to actually separate them completely. This physical composition will focus more on the software aspect. on that point 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 hardwareComponentAmountMicrocontroller PIC 18F45201 travel Driver SN75441014.7k Ohm Resistor11uF galvanising capacity40.33uF Capacitor10.1uF Capacitor1L7805 potential Regulator120MHz Oscillator19 Volt Battery1C40R Servo beat back3C55R Servo Motor1Servo Holder4Servo U Bracket2SPG10 Geared Motor242mm Wheels2Robot Castors2Table 2.1.1 Hardware ComponentsTo write the software one must be familiar with the hardware functionality, configuration and settings. The hardware of significant greatness 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 servomechanismmechanism beat back. It is what controls the arm and base. Actual control of the servos is by push 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 BOARD20.0 cm24.0 cm10.0 cm25.6 cmTOP PROFI LE.jpgFigure 2.1.1 Robot Layout2.2 parcel DesignAfter 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 variety 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 book of 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 calculating machine 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 th at 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 broadly unsettled 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 introduce and output. The input signal 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 environmentCUsersDanDesktopFYP ReportimagesUntitled.jpgFigure 2.2.1 MPLAB IDEThe general idea of writing the program is to control the pins of the microcontroller. The robot arm mechanism and the base mechanism will be separat ed for easier explanation. The arm is made up of the first 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 transaction to a certain angle with great precision. For the DC motors in the base, it is controlled via motor controller. By manipulating logical system combinations we will be able to control the movement and direction of the base.Infinite draw in to check for button pressA button is pressedNecessary routine or function is called to move servo/ DC motorEndFigure 2.2.2 General Software FlowchartThis 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 prolong the specific device whether it is the servo or the DC motor.Chapter 3 Hardware Informa tion3.1 MicrocontrollerThis project makes use of Microchip Technologys PIC18F4520 microcontroller. Lets discuss in detail what is a microcontroller and how it makes this project work. neb 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 amongst a microcontroller and a microprocessor in terms of functionality and application. Both are typically a small computer in the form of an integrated roofy which contains things like registers, storehouse, I/O, severs 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 microcontrol ler, 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.CUsersDanDesktopFYP ReportimagesPIC18F4520IP.jpgFigure 3.1.1 PIC18F4250Parameter discloseValueProgram Memory TypeFlashProgram Memory (KB)32CPU Speed (MIPS)10RAM Bytes1,536Data EEPROM (bytes)256Digital parley Peripherals1-A/E/USART, 1-MSSP(SPI/I2C)Capture/Compare/PWM Peripherals1 CCP, 1 ECCPTimers1 x 8-bit, 3 x 16-bitADC13 ch, 10-bitComparators2Temperature Range (C)-40 to 125Operating Voltage Range (V)2 to 5.5Pin Count40Table 3.1.1 PIC18F4250 SpecificationsPeripheral Highlights High-current sink/source 25 mA/25 mA Three programmable remote interrupts Four input change interrupts Up to 2 Capture/Compare/PWM (CCP) staffs,one with Auto-Shutdown (28-pin devices) Enhanced Capture/Compare/PWM (ECCP)module (40/44-pin devices only) One, two or quartette PWM outputs Selectable polarit y Programmable dead time Auto-Shutdown and Auto-Restart Master Synchronous Serial Port (MSSP) modulesupporting 3-wire SPI (all 4 modes) and I2CMaster and Slave Modes Enhanced Addressable USART module Supports RS-485, RS-232 and LIN 1.2 RS-232 operation using internal oscillatorblock (no external crystal required) Auto-Wake-up on Start bit Auto-Baud Detect 10-bit, up to 13-channel Analog-to-DigitalConverter module (A/D) Auto-acquisition capability mutation available during Sleep Dual analog comparators with input multiplexing)Power Managed Modes Run CPU on, peripherals on Idle CPU pip, 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-upFlexible Oscillator Structure Four Crystal modes, up to 40 MHz 4X Phase Lock Loop (available for crystal andinternal 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 speedsfrom 31 kHz to 32 MHz when used with PLL User tuneable to compensate for frequency drift thirdhand oscillator using Timer1 32 kHz Fail-Safe Clock Monitor Allows for safe shutdown if peripheral clock stopsSpecial Microcontroller Features C compiler optimized computer architecture Optional extended instruction set designed tooptimize re-entrant code 100,000 erase/write cycle Enhanced Flashprogram memory typical 1,000,000 erase/write cycle Data EEPROMmemory 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- tote up 5V In-Circuit Serial program (ICSP) via two pins In-Circuit Debug (ICD) via two pins Wide operating potential drop range 2.0V to 5.5V Programmable 16-le vel High/ low-voltageDetection (HLVD) module Supports interrupt on High/Low-VoltageDetection Programmable Brown-out Reset (BOR With software enable optionHere is a list of pins and how they are connected in the circuit.Pin NamePin anatomy (PDIP)FunctionsMCLR1ResetRA13Servo PWM InputRA24Servo PWM InputRA35Servo PWM InputRA46Servo PWM InputVDD11+5VVSS12GroundedOSC113Oscillator Crystal/External Clock InputOSC214Oscillator Crystal/External Clock InputRC015IN2 of Motor DriverRC116IN1 of Motor DriverRC318IN4 of Motor DriverRD019IN3 of Motor DriverVSS31GroundedVDD32+5VRB033Motor jab ButtonRB134Motor raise ButtonRB235Motor Push ButtonRB336Motor Push ButtonRB437Servo Arm Push ButtonRB538Servo Arm Push ButtonRB639Servo Arm Push ButtonRB740Servo Arm Push ButtonTable 3.1.2 Pin ConnectionsCUsersDanialDesktopFull Schem.JPGFigure 3.1.2 Full Schematics3.2 Motor DriverFigure 3.2.1 SN754410 Motor DriverThe SN754410NE is a quadruple half-H driver. The SN754410 can work a pair of DC motors at th e analogous 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 switch 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 PinoutPin 1 (1,2EN) enables/ disables the motorPin 2 (1A) is a logic pin for the motorPin 3 (1Y) is for Motor APin 4, 5 are for groundingPin 6 (2Y) is for Motor APin 7 (2A) connected to the motorPin 8 (VCC2) connected to source for motor powerPin 9 (3,4EN) enables/ disables the motorPin 10 (3A) connected to the motorPin 11 (3Y) is for Motor BPin 12, 13 are for groundingPin 14 (4Y) is for Motor BPin 15 (4A) conn ected to the motorINPUTSOUTPUT YH = High LevelL = Low LevelX = Do Not MatterXX = polish offAENHHHLHLXLXXTable 3.2.1 SN754410 Function TableCUsersDanialDesktopMotor.JPGFigure 3.2.3 Motor Schematics3.3 DC MotorThis 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 MotorCUsersDanDesktopImages23042010(001).jpgFigure 3.3.2 Motor Wheel3.4 Servo MotorA 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 o f 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.SpecificationServo Motor ModelAt 5 VoltsSpeed (s/60o)0.19Torque (Kg.cm)6.00Signal To Control AngleTTL PWMPWM At Min Angle (ms)0.54PWM At Max Angle (ms)2.40Operating Voltage (VDC)4.8-6.0Operating frequency (Hz)50.0Moving Range(degree)0-180Wiring (Black/Brown Wire)GroundWiring (Red Wire)4.8-6.0 VoltsWiring (Orange/Other Wire)PWM SignalTable 3.4.1 Servo SpecificationsCUsersDanialDesktopUntitled.jpgFigure 3.4.1 Servo MotorCUsersDanialDeskto pServo.JPGFigure 3.4.2 Servo SchematicChapter 4 Software Coding4.1 PWM GenerationPWM 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. umteen 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 weapons-grade enough to change logic 1 to log ic 0, or vice versa. PWM is the basis of controlling the servos in this project. Lets examine some basic theory.CUsersDanDesktopFYP Reportimagespwm.gifFigure 4.1.1 PWM Square WaveThe 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.CUsersDanDesktopFYP Reportimagespwm_servo.gifFigure 4.1.2 PWM WaveNote 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.9msT = 20msAngle = 0t = 1.5msT = 20msAngle = 90t = 2.1msT = 20msAngle = 180The next step is to create these PWM signals using the PIC microco ntroller. The PWMs is in this switch statementswitch(count) //Choose which servo to modifycase 1 PORTA = 0x02 // First StageWriteTimer1( servo3 )breakcase 2 PORTA = 0x04 // left over(p) GripperWriteTimer1( servo1 )breakcase 3 PORTA = 0x08 // proficient GripperWriteTimer1( servo0 )breakcase 4 PORTA = 0x10 // Second StageWriteTimer1( servo2 )breakFigure 4.1.3 Switch StatementThe 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 CONTROLpragma code InterruptVectorHigh=0x08void InterruptVectorHigh (void)_asm//assembly code startsgoto InterruptHandlerHigh//interrupt control_endasm//assembly code endspragma codepragma 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 th e timer1.Figure 4.1.4 Interrupt HandlerThe 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 Controlvoid move(int one,int two,int three,int four, int five)if(one)servo0 = one // Right Gripperif(two)servo1 = two // Left Gripperif(three)servo2 = three // Second Stage Linkif(four)servo3 = four // First Stage LinkA 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 FunctionAfter the move function is declared it can be called when the speci fic button is pressed.//Arm Controlif(PORTBbits.RB7==1)move(0xF03B,0xF477,0,0,0) //GRIPif(PORTBbits.RB6==1)move(0,0,(servo2-0x0250),(servo3+0x0100),0) //MOVE AWAYif(PORTBbits.RB5==1)move(0,0,(servo2+0x0250),(servo3-0x0100),0) //MOVE TOWARDSif(PORTBbits.RB4==1)move(0xFA77,0xEE07,0,0,0) //UNGRIPFigure 4.2.2 Arm Button CheckThere are 4 buttons that control the movement of the arm.PortB pin 0 Close the gripperPortB pin 1 Move arm awayPortB pin 2 Move arm towardsPortB pin 3 circularise the gripperCUsersVictorDesktopImagesClose Gripper.jpgFigure 4.2.3 Close GripperThis 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.CUsersDanDesktop22042010(007).jpgFigure 4.2.3 Open Gripper4.3 Base ControlThe only thing that needs to be controlled in the base is the 2 DC geared motors. It is relate with the microcontroller through the H-bridge. The motors rotational direction is de termined 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 Controlif(PORTBbits.RB3==1)//Forward controlPORTCbits.RC1=1PORTCbits.RC0=0PORTDbits.RD0=1PORTCbits.RC3=0if(PORTBbits.RB2==1)// contain controlPORTCbits.RC1=0PORTCbits.RC0=1PORTDbits.RD0=0PORTCbits.RC3=1Figure 4.3.1 Base Button Check (Forward/Reverse)if(PORTBbits.RB1==1)//Left controlPORTCbits.RC1=0PORTCbits.RC0=1PORTDbits.RD0=1PORTCbits.RC3=0if(PORTBbits.RB0)//Right ControlPORTCbits.RC1=1PORTCbits.RC0=0PORTDbits.RD0=0PORTCbits.RC3=1Figure 4.3.2 Base Button Check (Left/Right)There are 4 buttons that control the movement of the base.PortB pin 4 ForwardPortB pin 5 ReversePortB pin 6 Move rightPortB pin 7 Move left4.4 seemingCUsersDanDesktopUntitled.jpgFigure 4.4.1 Watch SimulationThe MPLAB software allows a minimal amount of simulation to show that the program is written correctly. Due to software conf inement on the PIC18F4520 it is unable to correctly show port activities. However it does show variable activity like in the figure by using the tick 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.CUsersDanDesktopUntitled1.jpgFigure 4.4.2 Program SteppingThe 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.CUsersDanDesktopUntitled3.jpgFigure 4.4.3 Final SteppingChapter 5 Conclusions and Recommendation5.1 SummaryThis project has further grow 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 RecommendationsIn this project, certain improvements can be made in order to make things work more e fficiently. 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.