Line Tracking Robot Racer- Experimenting with IR Sensors

To conclude level 5 Engineering science we have been asked to combine our knowledge of Programming and Electronics and Mechanical Engineering, and apply them to efficiently design and make a device that can complete a 10-meter course by tracking a line whilst carrying a raw egg.  

We began by creating a list of components which we thought we would need to create an accurate and fast moving line tracking robot. Out of all the components our first priority was selecting the most accurate sensor for the job we were facing. We came to the conclusion that using two IR sensors would work well. We could attach the digital sensors to each side of the car and they will then hopefully they will be able to sense the light difference between the flooring and the black tape. Therefore the Racer will be able to follow the line.

The IR sensors function using digital pins, therefore we can use the digital read function to see if they are  HIGH or LOW using the serial monitor. This was extremely useful in the development of our Racer design as it gave as an idea of how sensitive the sensors were the the light and dark floor surfaces, providing us with the essential information of how high from the floor surface the sensors would need to be to work. We wrote some basic code in order for us to test this:

int leftSensor = 7;
int rightSensor = 8;

void setup() {
Serial.begin(9600);
pinMode(leftSensor, INPUT);
pinMode(rightSensor, INPUT);
}

void loop() {
int sensorValL = digitalRead(leftSensor);
int sensorValR = digitalRead(rightSensor);
Serial.println(sensorValL);
Serial.println(sensorValR);
delay(1);
}

IR Sensors

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s