Download presentation
Presentation is loading. Please wait.
1
CAM FRITH CRAIG MARTIN DAVID LAING MILESTONE 2: LINE FOLLOWING and BARCODE READING SEVERED LIMB
2
ANALOG-to-DIGITAL CONVERSION Using photocells and the IR Control Module, we wrote simple test code to test analog-to-digital conversion. A-to-D conversion tests gave adequate results (readings in the range of 0x70 for dark and 0xB0 for light) by simply shading the photocell and then holding it to the light.
3
LIGHT SENSING We opted to use photo-transistors and photo-emitters because of their rapid response times. Photo transistors provided an excellent range of digital values from black to white, in the order of 0x10 to 0xF0. We opted to fabricate our own harness for the sensors: IR Control Module uses 100kΩ bias resistors; our testing used 15kΩ bias resistors and produced extremely promising results. SEVERED LIMB'S ORIGINAL SENSOR UNIT
4
SENSOR MOUNTING The light sensor unit initially consisted of 4 diode pairs on a foamcore platform mounted directly below the axle of Severed Limb. Each diode pair had to be mounted such that the emitter directed light straight at the receiver. Height of the diode pair had to be taken into consideration when determining angles for mounting. Any deviation from a perfect light path from emitter to receiver resulted in a significant drop in digital sensing range. Hot glue was used to keep the diodes correctly situated. 2 inside pairs were centred approximately 25mm apart, so that they would straddle the 18mm white line. 2 outside pairs were mounted at the extreme edges of the robot for barcode detection. Foamcore platform was skirted to exclude any ambient light sources. Light sensing unit was screwed to bottom of Severed Limb for testing.
5
SENSOR TESTING A digital camera was used to ensure that all emitters were functioning properly. Once mounted, digital sensing range diminished. Values received were in the order of 0x50 to 0xD8 Extra resistors were added in parallel to increase infrared light emissions. This restored our digital sensing range to approximately 0x20 for black and 0xF0 for white.
6
INITIAL LINE FOLLOWING CODE Our main loop polls four ADC registers. Digital values are stored as variables. Initial code used continuous sensor data (rather than binary). Motor speeds were determined by the amount of white light reaching each sensor. As a line sensor read more white, opposite motor speed was increased. As white values dropped, motor speed returned to the base value. Multiplier was used for calibration. Regardless of multiplier, this approach resulted in a set pattern of correction, and then over-correction, increasing in amplitude until Severed Limb completely lost the line. Sample code: : FIX EC00 L-S @ 40 * - R-WHEEL ! E500 R-S @ 40 * - L-WHEEL ! ;
7
NEW SENSOR UNIT We determined that our inability to follow the line was due to a lack of sensory input. A new sensing unit was fabricated to accommodate 6 diode pairs: 4 line following pairs and two barcode reading pairs For durability, the sensor unit platform was made from perfboard. Electrical components remained identical, except for the addition of two more pairs of diodes. Hot glue was again used to secure the diodes. Foamcore was utilized for a skirt. SEVERED LIMB'S NEW SENSOR UNIT.
8
NEW LINE FOLLOWING CODE We now used six sensor variables: LIS (Left inside line sensor) LOS (Left outside line sensor) RIS (Right inside line sensor) ROS (Right outside line sensor) LBS (Left barcode sensor) RBS (Right barcode sensor) The code was similar to the previous code except that when the outside line sensors saw the line the wheels remained stopped. Results were exactly the same as previous attempts: Over-correction in increasing amplitude until the line was lost.
9
MORE NEW LINE FOLLOWING CODE New approach to line following: STOP adjacent wheel when a white threshold value is detected. This causes the robot to pivot around that wheel moving the robot closer to the line. This still caused the robot to lose the line so we mounted the sensor unit closer to front. These measures resulted in a robot capable of reliable line following, through straight and curved sections. Although line following was reliable, the path of the robot was still not as direct as we desired. To smooth the forward motion, we added a second white threshold. When this threshold was breached the adjacent wheel was slowed, allowing the robot to correct without jerking to a stop.
10
BARCODE READING Values of 4, 2, and 1 are assigned respectively to the first, second and third bits of the barcode, corresponding to the three bits in the barcode. These values are stored in the variable bcode. The RBS (Right Barcode Sensor) is polled in the main loop. When it detects a sync line it increments a counter variable and checks the LBS (Left Barcode Sensor). If the LBS detects a line, 4, 2, or 1 is added to bcode, depending on the counter value. When the counter reaches 3, the robot stops and sounds the value of the barcode (0 through 7) via the beeper. We opted to stop the robot for this signalling process, as the beeper demands all of the processor time. This setup would sometimes read a sync bar twice, resulting in faulty readings. To fix this we added a flag variable, which is set after incrementing bcode. The flag is cleared when RBS detects black. bcode cannot be updated if the flag is set.
11
INVERTER Severed Limb's wheels would start turning whenever it was reset. To remedy this problem, an inverter was built. By shunting the signal to the Motor Control Module via the inverter the initial state of the wheels was stopped. The code had to be modified so that OC1D cleared OC4 and OC5, rather than set them as we had previously done. SEVERED LIMB'S INVERTER
12
CONCLUSIONS Severed Limb performed admirably in the demo. Although this milestone consumed large amounts of time, the basic tasks (A-to-D conversion and light sensing) were relatively straightforward. Our biggest stumbling block in this milestone was deriving an algorithm which produced reliable line following, and determining how and where to mount the sensors. Photodiodes were chosen for the speed of their reaction to changes in light; however, we are extremely happy with the large voltage swings (and subsequent digital range) that they provide. Dead reckoning is bad; active feedback is good.
13
TIME LOG Milestone 2 proved to be extremely time-consuming. Construction and wiring 12 hours Coding 8 hours Testing25 hours
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.