Joe O'Reilly

AI - Task Sheet 3

16 Jan 2012


Familiarisation with detecting distance


Use ultrasonic sensors to avoid obstacles in the arena, including walls

  1. We conducted a test to see what ultrasonic sensor orientation would allow our roboot the best view of its suroundings, if you look below it's obvious that fixing it parallel to the floor is optimum.
-30° -60° -90°
15cm 19 20 23 7
30cm 31 32 41 7

While I probably wont have time to investigate this I think a factor that could be more curcial to how well the ultrasonic sensors behave would be sensor elevation and maze wall height. If the sesnor is too high it could easily read over the wall. If the sensor is positioned too near to the ground it could mean lots of scattered sound and potentialy unreliable readings. I would suggest a test where a ultrasonic sensor is mounted at four or five heights at 100mm, 150mm, 200mm and 250mm to ascertain the best position.

  1. The robot when navigating the maze with just its ultra sonic sensor had some issues, mainly related to acuracy of measurements. We tried two configurations, first with the sensor to the left, so it could follow a wall and find turns and second with the sensor facing dead ahead so we could detect walls. Both configurations ran into problems. Configuration one frequently got stuck in locations where there was no left turn at the end of a coridor

Configuration two would often run into walls infront of it causing the sensor readings to go out of bounds then it would find turning hard as it was too close to the wall. We encountered a showstopping flaw in both configurations, the robot would easily become caught in loops. If the robot enters a loop similar to the one in the diagram to the right it will become trapped. Because the exits are never located to the left hand side of the robot inside the loop the sensors which only look forwards and to the left will never be able to detect them.


Familiarise Yourself With Line Detection and Following

Here are the blocks we used to complete the challenge brief.

Detail on the sensor/wait block.

The first block causes the robot to move forwards indefinitely. In order to find the light we pause the program's execution with a wait block, it will only continue when a certain condition has been met. You can see in the detailed view above for the wait block we used the light reading 33 be a dark line (we did a short test to ascertain the best number), if this is ever the case the the program continues executing and then stops the motors.

The configuration for this task


Use the Light Sensors to Explore Active and Passive Sensing

The Robot's Configuration for this task

We collected passive light readings from the LED Flash on an iPhone at distances ranging from 100cm to 50cm and noted them in the table below.

Passive Light Sensor Levels Against Distance in CM from Light Source
CM Light Value
5 100
10 80
5 100
15 69
20 61
25 55
30 51
35 48
40 46
45 44
50 42
  1. We used the readings from this test to create a program to move towards a light source.

The program consists of a single loop and an if statement. The if statement gets either true if the light level is above 40 and false if it is not. The true behaviour is to move forwards and the false behaviour is to slowly spin. You can see it below.

Here are the settings for the if sensor block

We went on to change the program to function in reverse.

  1. In order to achive the goal of making a robot follow a line we had to first make it find a line, to do this it moves forwards until the light sensor's level goes over 35 see below.

The when a line is found the line following behaviour is started and loops, below is that behaviour. The behaviour is to turn one way if the light level drops below a threshod and then turn the other when it is above the threshold. This causes the robot to move forwards in a zig-zag patern sticking to even a fairly complicated dark line

  1. Passive light sensing uses just the surrounding light, meaning it can be fairly inefective at detecting changes in the surfaces it moves accross for example like line following

  2. Active light sensing uses a small but bright light allow the robot to detect how reflective the environment directly in front of its sensor is.


AI - Task Sheet 6


AI - Task Sheet 2