Friday, 26 March 2010

Programming the buggy

First meeting (24/03/10)
On Wednesday Andy and I met up to complete the programming of the pickaxe. However the group was informed during Tuesday’s lesson that we could only use two LDRs to guide our buggy as the microchip only has two analogue to digital converters. So we had to re design our initial idea. We decided that the buggy would work by having two sensors, one on the right and the other on the left. We would then programme the buggy using these simple guidelines.

..........................LEFT LDR/ RIGHT LDR
Straight ....................light/ light
Left turn...................dark /light
Right turn ................light/ dark
Stop and reverse ....dark/ dark


Second meeting (26/03/10)
Andy and I met up again to begin programming. We quickly realised that in order for our guidelines to work, we would need to ensure that one LDR controlled one motor and the other LDR controlled the other. To do this we needed to wire up the components so that output pins 1 and 2 controlled one motor, and output pins 3 and 4 controlled the other. Where as before Juan had wired up both motors to pins 1 and 2. Once this was resolved we managed to programme the buggy to fulfil the objectives using a select case function, which went as follows: (was informed by group not to put the whole code in case of plagiarism)

Select case b0
Case (value 1) to (value 2) ; light
High 1
Low 2
Case (value 3) to (value 4) ; dark
Low 1
High 2

The same was also done for b1 using pins 3 and 4

This code says that, when an LDR is exposed to light the corresponding motor should rotate forwards, however when exposed to lower levels of light, the motor should rotate backwards. Therefore when one LDR is on the black line and the other is not, the motors will rotate in opposite directions which will cause the buggy to turn.
Finally we needed to implement a pause so that when the buggy reached the stop sign, It would come to rest before reversing. We did this by inserting two pauses in the dark section of each select case. To do this we had to make the pause in the second select case considerably shorter then the pause in the second select case. This was because it took a few milliseconds for the chip to read the coding between each pause, so pause 1 was shorter than pause 2 to account for the time delay between each pause. This meant that although the two motors did not stop at exactly the same time. They do begin to reverse at the same time.

Our next task is to build a chassis and calibrate the LDRS.

Thursday, 25 March 2010

Circuit



In this opportunity Andrew Daniels and me (Juan Vasquez) we finished the building of the circuit in which we will be using two LDR's in order for the Buggy to follow a black line, we got them running according with the different light sensors. Now we will proceed with the programming.

Monday, 22 March 2010


Mohsin and I (Juan Andres) were in charge of building up the circuit as shown in the picture, and testing it with the light sensor (LDR) for the motors to work. Now the next step will be actually Designing a program in order for the buggy to follow the black line.

Tuesday, 16 March 2010

first meeting

today we decided to use LDR sensors to guide the buggy around the course. we set about dividing the team into two. the first team consisted of juan and mosh created the circuit by using the lecture notes to firstly wire up the motors and then using the input analogue lecture notes to wire up an LDR (thermistor was replaced with LDR). The rest of us started making a simple program so that when the ldr was exposed to low levels of light as it would be when following the black line, the motors would be switched on, however when the ldr is exposed to higher levels of light the motors would be off. this was achieved by using a simple programs as follows:

main:

readadc 1, b1

select case b1

case 40 to 255

low 1

case 0 to 39

high 1

end select

goto main


Middle Sensor
Left Sensor
Right Sensor
Turn left
Read light - 0
Read dark - 1
Read light - 0
Turn Right
Read light – 0
Read light – 0
Read dark - 1
Stop
Read dark – 1
Read dark – 1
Read dark - 1

Important Websites

Guys take a look at this websites for our 1. Color Sensors and 2. Chassis Construction

1. http://www.societyofrobots.com/sensors_color.shtml#programming
2. http://www.societyofrobots.com/mechanics_chassisconstruction.shtml#design

Tuesday, 9 March 2010

blog for ME2055