Download - Derbot
![Page 1: Derbot](https://reader033.vdocuments.net/reader033/viewer/2022042702/563db8b9550346aa9a965cd8/html5/thumbnails/1.jpg)
1 | P a g e
The Derby University School of Art, Design and Technology
Markeaton street campus
By: Mohammed Allarit
Date: 27/12/2011
![Page 2: Derbot](https://reader033.vdocuments.net/reader033/viewer/2022042702/563db8b9550346aa9a965cd8/html5/thumbnails/2.jpg)
2 | P a g e
Table of Contents 1 Introduction ........................................................................................................................ 3
2 Team plan ............................................................................................................................ 3
2.1 Design plan-A: .............................................................................................................. 3
2.2 Design plan-B: .............................................................................................................. 4
3 Circuit design ....................................................................................................................... 4
4 Build details ......................................................................................................................... 6
5 Programming..................................................................................................................... 11
6 Testing and evaluation ...................................................................................................... 15
7 Comments ......................................................................................................................... 15
8 Conclusion ......................................................................................................................... 15
Appendices
Team mate assessment form
Figure 1: seven segment counter circuit diagram ...................................................................... 5
Figure 2: seven segment counter driver printed circuit board (PCB) ........................................ 5
Figure 3: 7-segment counter circuit board copper-top view ..................................................... 5
Figure 4: 7-segment counter circuit board copper-bottom view .............................................. 5
Figure 5: modified 7-segment counter circuit board copper-top view ..................................... 5
Figure 6: actual 7-segment counter circuit board copper-bottom view ................................... 5
Figure 7: front and rear conveyor motor driver circuit taking from
(C_Derbot_18F2420_Prog_Manual) .......................................................................................... 6
Figure 8: conveyor motor driver (PCB) ....................................................................................... 6
Figure 9: dual belt pulley dimension schematics ....................................................................... 7
Figure 10: Derbot rear view ....................................................................................................... 7
Figure 11: Derbot right-side view ............................................................................................... 8
Figure 12: Derbot top view......................................................................................................... 8
Figure 13: Derbot left-side view ................................................................................................. 8
Figure 14: Derbot front view ...................................................................................................... 8
Figure 15: Derbot parts identification (rear view) ..................................................................... 9
Figure 16: Derbot parts identification (front & top view) .......................................................... 9
Figure 17: Derbot parts identification (Left & Right side-view) ............................................... 10
Figure 18: Derbot parts identification (bottom view) .............................................................. 10
Figure 19: Derbot main program function flow chart .............................................................. 11
Figure 20: Derbot code section two ......................................................................................... 13
Figure 21: Derbot code section three ...................................................................................... 14
Figure 22: Derbot code section four ........................................................................................ 15
![Page 3: Derbot](https://reader033.vdocuments.net/reader033/viewer/2022042702/563db8b9550346aa9a965cd8/html5/thumbnails/3.jpg)
3 | P a g e
1 Introduction This report is based on the Derby university robot called Derbot.
The tasks of the assignment were to design and build add-on modules on Derbot robot to
perform task functions of given aims listed below.
Aims of the assignment;
1. Follow a white line (track) on mat black background, from start to finish.
2. Detect an object on the track.
3. Detect light emitting from an object.
4. Remove object to right side of the track if lit.
5. Remove object to left side of the track if not lit.
6. Count and display total object detected on seven-segment display
2 Team plan The main objective of the team was to finish the given aims as fast as possible and as
accurate as possible.
All work carried out by the team had to be agreed and allocated, according to each
members; experience, knowledge and ability to perform the given task comfortably. During
design process most critical issues were discussed, the most important concerns were as
follow;
Simplicity
Cost
Speed (quickest way to perform each task)
Easy integration of add-on modules
Time required for design and build
Time required for test and development
Taking the above in consideration, two different designs and build plans were considered.
2.1 Design plan-A:
The Derbot project work plan1 was broken down into five tasks. The order of each task was
in accordance to its importance for a successful completion of Derbot project. Each week a
team meeting was held to tackle any issues related to any task, relevant plans and solutions
were discussed to overcome any issues. This design required the use of servo motor and
ultra-sound detector.
1 See appendix A (Project work plan)
![Page 4: Derbot](https://reader033.vdocuments.net/reader033/viewer/2022042702/563db8b9550346aa9a965cd8/html5/thumbnails/4.jpg)
4 | P a g e
2.2 Design plan-B:
This is a backup plan to overcome any major failure in plan-A. The plan-B design and build is
based around nineteenth-century conveyor system for faster processing of obstacle removal
without the need to compromise the speed of Derbot.
Brief description of work plan:
Two motors used had 1:1 ratio, one motor to drive front conveyor belts and the other motor
is to drive rear conveyor belts. This design eliminates the use of ultra-sound and servo
motor.
Due to unforeseen circumstance plan-B was used to complete the assignment.
3 Circuit design Two circuit boards needed to be designed; the 7-segment display driver circuit board had to
be design and built using surface-mount devices (SMD) and a motor driver circuit.
Problems:
1. The counter PCB had some issues with seven segment display pin-out connections,
during PCB testing of tracks and pin-out of integrated circuit (IC) reveled that seven
segment display connections pins did not correspond to PCB layout.
2. The reset push-button connection pins did not correspond to PCB layout. The
problem being that reset was on permanently rather than action been preformed
through push-button.
3. The front conveyor motor operation proved problematic for counter circuit, every
time the front conveyor motor was turned on, the counter circuit operation became
erratic.
Solutions:
1. A further assessment of the seven segment display problem showed that software
been used for electronic CAD simulation (National Instruments Multisim ver.11) does
not provide PCB footprint for seven-segment display. The PCB design software
(National Instruments Ultiboard ver.11) has only limited range of seven-segment
display footprints, none which could be used for components available. The only way
around this problem was to rewire the required connections (Figure 5) manually to
correct the problem and save time.
2. The reset push-button (Figure 5) was rewired from positive connection through
push-button to all reset pins on 74LS290D chip for correct operation, so when the
bush-button is pressed, the display counter resets.
3. The front conveyor motor created electrical noise which interfered with digital circuit
of 7-segement counter. To overcome this issue all circuit on Derbot had to be
grounded to one common ground and any connection wires size was reduced as well
![Page 5: Derbot](https://reader033.vdocuments.net/reader033/viewer/2022042702/563db8b9550346aa9a965cd8/html5/thumbnails/5.jpg)
5 | P a g e
as wires were twisting together to reduce induced magnetic felid picked up by the
wires.
Figure 1: seven segment counter circuit diagram
Figure 2: seven segment counter driver printed circuit board (PCB)
Figure 3: 7-segment counter circuit board copper-top view
Figure 4: 7-segment counter circuit board copper-bottom
view
Figure 5: modified 7-segment counter circuit board
copper-top view
Figure 6: actual 7-segment counter circuit board copper-
bottom view
![Page 6: Derbot](https://reader033.vdocuments.net/reader033/viewer/2022042702/563db8b9550346aa9a965cd8/html5/thumbnails/6.jpg)
6 | P a g e
A motor driver circuit (Figure 7) was design and built base on Derbot left and right motor
driver circuit. Only one motor is bi-directional which is used for rear conveyor.
Figure 7: front and rear conveyor motor driver circuit taking from (C_Derbot_18F2420_Prog_Manual)
Figure 8: conveyor motor driver (PCB)
4 Build details The design and build required careful planning and execution to bring everything together
and make it work.
A custom made duel belts Pulley2 was made from nylon material. At each end of pulley has
teethed gear cog3 to line-up centre hole so that steel rod sets dead centre to prevent any
vibrations
2 See Figure 9: dual belt pulley dimension schematics
3 See Figure 16: Derbot parts identification (front & top view)
![Page 7: Derbot](https://reader033.vdocuments.net/reader033/viewer/2022042702/563db8b9550346aa9a965cd8/html5/thumbnails/7.jpg)
7 | P a g e
Figure 9: dual belt pulley dimension schematics
Final snap shots of Derbot show what was the outcome and gives a prospective view of
Derbot.
Figure 10: Derbot rear view
![Page 8: Derbot](https://reader033.vdocuments.net/reader033/viewer/2022042702/563db8b9550346aa9a965cd8/html5/thumbnails/8.jpg)
8 | P a g e
Figure 11: Derbot right-side view
Figure 12: Derbot top view
Figure 13: Derbot left-side view
Figure 14: Derbot front view
![Page 9: Derbot](https://reader033.vdocuments.net/reader033/viewer/2022042702/563db8b9550346aa9a965cd8/html5/thumbnails/9.jpg)
9 | P a g e
The Derbot parts identification Figure 15 to Figure 18 are shown below.
Figure 15: Derbot parts identification (rear view)
Figure 16: Derbot parts identification (front & top view)
![Page 10: Derbot](https://reader033.vdocuments.net/reader033/viewer/2022042702/563db8b9550346aa9a965cd8/html5/thumbnails/10.jpg)
10 | P a g e
Figure 17: Derbot parts identification (Left & Right side-view)
Figure 18: Derbot parts identification (bottom view)
![Page 11: Derbot](https://reader033.vdocuments.net/reader033/viewer/2022042702/563db8b9550346aa9a965cd8/html5/thumbnails/11.jpg)
11 | P a g e
5 Programming The Derbot software development required a use of function oriented approach which
made use of functions to execute given tasks; each task was treated as a function to make it
easier to integrate or remove any function within the main programme of Derbot when
developing and implementing the C langue code.
Figure 19: Derbot main program function flow chart
The main4 program of Derbot had been split into four sections (C1 to C4)5.
First section (C-16) declares all headers, C language library files and variables required to
execute the program successfully.
4 See appendix B (Derbot code)
5 See appendix B (Derbot code)
6 See appendix B (Derbot code)
![Page 12: Derbot](https://reader033.vdocuments.net/reader033/viewer/2022042702/563db8b9550346aa9a965cd8/html5/thumbnails/12.jpg)
12 | P a g e
Second section (C-2) of the code is where main program starts, first special function
registers (SFR) were initialised by using TRIS (line 40 to 43) command; zero and third bits
were set to inputs on port A, port B bits three, four and five were set to inputs and port C
bit seven was set as input.
Analogue and digital convertor’s ADCON1 first four port bits were set to inputs then all ports
are reset to low state i.e. zero.
To test the that program is running correctly, a diagnostic()7 function is called to flash
indicator LEDs which alternate for two seconds. A 7-segemnt counter is reset to zero by
calling led_reset()8 function.
The Timer2 library function; is enabled and Timer2 interrupt is disabled (TIMER_INT_OFF),
prescaler is set to 1:1 ratio (T2_PS_1_1) and postscaler is set to 1:1 ratio (T2_POST_1_1).
PWM (pulse-width modulator) period is determined by following formula:
4
6
Timer oscillator frequency
2 Timer2 prescaler value
period 1 4 2 prescaler
1 period 255 1 4 1 2.56 10 256
4 10
OSC
OSC
T
TMR
PWM period T TMR
PWM s
For both PWM (Figure 20, line 60 – 61) frequency was set to maximum, the following
formula shows PWM frequency;
4
1 1Frequency Hz 3906.25 3.9
period 2.56 10kHz
PWM
An ADC9 (analogue to digital convertor) is configured to following parameters;
Oscillator frequency 4
ADC conversion time per bit
4Clock source: _ _ 4
4
Results justification: _ _ Results in least Significant bits
Acquistion time select:
FOSC MHz
TAD
MHzADC FOSC
ADC RIGHT JUST
_ 2 _ 2
ADC channel selection: _ 0 channel zero is selected
Interrupts: _ _ interrupts disabled
Voltage reference source: _ _ positive supply rail
Voltage reference
ADC TAD Tad
ADC CH
ADC INT OFF
ADC VREFPLUS VDD
source: _ _ negative supply rail
Port configuration bit is set to: 14
ADC VREFMINUS VDD
7 See appendix B (Derbot code) diagnostic section, (F-8) line 234-241
8 See appendix B (Derbot code) 7-segment counter section, (F-5) line 190-197
9 See Figure 20, (C-2) line 63
![Page 13: Derbot](https://reader033.vdocuments.net/reader033/viewer/2022042702/563db8b9550346aa9a965cd8/html5/thumbnails/13.jpg)
13 | P a g e
Figure 20: Derbot code section two
Third section (C-3) is set to loop forever by using while(1) command see Figure 21. The first
two functions leftmost_fwd()10 and rightmost_fwd()11 are called to move the Derbot
forward at maximum speed allowed.
LDR value is obtained through ldr_status() function, this function stores current data into
global ldr_value variable to check against set condition later on in the program.
Conditional if statement is used to verify set conditions;
First condition is to check if right IR sensor is active, if this condition becomes true then call
correct2left() function.
Second condition is to check if left IR sensor is active, if this condition becomes true then call
correct2right() function.
Third condition is to check ldr_value variable stored data with set condition, if the condition
is true then set port bits one to high otherwise set to low.
Fourth condition is to check the counter IR sensor, if the condition becomes true then
increment counter variable by one and call count12 function to set the counter input high
and display the value on the 7-segment display and switch on right diagnostic LED,
otherwise switch off diagnostic LED and set the counter input to low.
A call to front_conveyor function is made to activate and run the front conveyor motor.
10
See appendix B (Derbot code) section (F-1), line 136 - 142 11
See appendix B (Derbot code) section (F-1), line 143 - 147 12
See appendix B (Derbot code) section (F-5), line 199 - 202
![Page 14: Derbot](https://reader033.vdocuments.net/reader033/viewer/2022042702/563db8b9550346aa9a965cd8/html5/thumbnails/14.jpg)
14 | P a g e
Fifth condition is set to check if both counter IR and LDR sensors are active, if the condition
becomes true then a call to conveyor_R13 function made to rotate the rear conveyor driver
motor clockwise.
Sixth condition is set to check if LDR sensor is active, if condition is true then call conveyor_L
function to rotate the rear conveyor driver motor anti-clockwise.
Figure 21: Derbot code section three
The Section (C-4) of the program is activated when both IR sensors detect white line at the
end of the track, upon activation motor_stop()14 function is called to set the PWM1 and
PWM2 to fifty percent duty cycle, as a result left and right motor speed becomes zero and
Derbot stops moving, and both conveyor motors are switched off. Section (C-4) Line code
(110 – 111) is not used to reduce time to finish the Derbot challenge.
13
See appendix B (Derbot code) section, (F-4) line 178 - 181 14
See appendix B (Derbot code): finish line section, (F-7) line 223-229
![Page 15: Derbot](https://reader033.vdocuments.net/reader033/viewer/2022042702/563db8b9550346aa9a965cd8/html5/thumbnails/15.jpg)
15 | P a g e
A second while(1) loop nested in the main loop to turn on the diagnostic LED A and B and
wait for four seconds and then flash at a rate of half a second, for the count of twenty-five
and keep on repeating this process until the Derbot is switched off or reset.
Figure 22: Derbot code section four
6 Testing and evaluation Throughout the project development test were carried out at each stage of Derbot build.
Line following sensors had to be very close to actual surface to detect the line, any vibration
during opration caused Derbot to not respond in some cases. To overcome these issues a
ball roller (Figure 18) were fixed onto Derbot board to stabilise.
7 Comments The aim of this project was to build the Derbot to perform the given tasks quickly and as
accurately as possible. The assignment was completed successfully and gained third place in
the final competition. First position was lost due to missing an obstacle and Derbot did not
stop exactly within the finish box of the track.
8 Conclusion The final design of the Derbot incorporated mechanical conveyor system, the reason for
using conveyor system is to increase the speed at which obstacle are removed and to
maintain constant forward speed of Derbot and reduces MCU code to aid faster processing.
Belt and pulleys are been used since nineteen-hundred, the industrial revolution and play
vital role in today’s economy, effecting many aspects of modern society all around the
world. The conveyor system proved ideal to perform repetitive task for Derbot challenge.
Over all project aims were completed successfully and satisfactory results were obtained.