Thursday, February 2, 2012

Flame Sensor

Installing the flame sensor involved a very simple wiring. The negative end of the sensor was wired to the data input of the microcontroller. The positive end is wired to the positive end of the microcontroller. Lastly a 10kOhm resistor is used between the positive and the ground.

The sensor was then set up in robotC. A basic principle of coding a flame scanning routine was thought up. The robot would turn until it sees the flame. This can simply be coded as such:

while(SensorValue[flame] < 200)
 {
   motor[motorL]=50;
   motor[motorR]=-50;
}

The first trial of this coded proved to be difficult. The sensor would not pick up a value greater than 80 even when. A 50kOhm resistor was then tried to increase the sensitivity of the sensor. This allowed the sensor to reach ~200 in direct flame. However, this is still well below the 0-1000 range suggested in the handout. After some thought, the polarity of the sensor was flipped. This fixed our issues and our sensor worked great. The code also worked. The robot turned until it was met with the flame and it stopped.

However, there was still some issues. Sometimes the robot would miss it and would only find it the 2-3rd time around. The code was then tweaked to slow the rotation of the robot. 

while(SensorValue[flame] < 200)
 {
   motor[motorL]=50;
   motor[motorR]=-50;
  wait1000Msec(200);
   motor[motorL]=0;
   motor[motorR]=0;
   wait1000Msec(100);
}

This made the flame scanning work very well. However, the code only worked if the flame sensor was directly level with the flame. If the flame was just higher or lower by an inch, the sensor readings would vary greatly. To deal with this, the flame sensor was mounted on a set of alligator clips where the height of the sensors can be quickly adjusted.


No comments:

Post a Comment