Ultrasonic Sensor
Gradesheet

An Ultrasonic Sensor detects approaching objects. It does this by measuring the distance to the object. Look at the two eyes on the front of your robot. One of the “eyes” transmits a sound, and the other waits for the echo of the sound to return. This is how the distance to the object from the sensor can be calculated. You enter the distance and the sensor will detect any object in front of it within that range.The ultrasonic sensor has a range of 3-400cm. If an object is outside this range, the sensor will return a value of 400.

ultra1

Task #1: Ultrasonic Sensor_ Test the Sensor

Just like we did for the Line Sensor, lets test the Ultrasonic Sensor to see if it works. Write a program that does the following:
Model Video: Mobile or You Tube.

  1. The robot should be sitting on its battery pack.
  2. When the robot is turned on, there should be a 1 second delay
  3. First, look at the code you wrote for Line Sensor Task #1B.
  4. Rewrite this program so that the robot wheels will stop moving forward when an object appears approximately 10 cm. above the Ultrasonic Sensor.
    1. Note: in order for the wheels to be moving, place the "Wheel Move Block" prior to the "Forever" block.
    2. Delete the "Line Sensor" Operator that you used in Task #1B and instead use the Operator shown below (insert it into the "If/Then" block.)

Task #1B: Ultrasonic Sensor_ Comparing Similar Programs

  1. View this program: Program A. Now on the Ultrasonic Sensor Gradesheet, state what you think will happen when it is uploaded to the robot and the robot is turned on.
  2. View this program: Program B. Now on the Ultrasonic Sensor Gradesheet, state what you think will happen when it is uploaded to the robot and the robot is turned on. Then explain what is the difference between how the lines of code in the program were written.
  3. Write Program A code and Upload it to the robot. Explain on the Gradesheet what actually occurred when it was turned on.
  4. Write Program B code and Upload it to the robot. Explain on the Gradesheet what actually occurred when it was turned on.
  5. Finally, which of the two lines of code functions better and why?

Task #2: Ultrasonic Sensor_ Robot Stop At Object

Write a program that does the following:
Model Video: Mobile or You Tube.

Task #3: Ultrasonic Sensor_ Robot Drive in a Circle Around a Center Object

Write a program that does the following:
Model Video: Mobile or You Tube.


Light Sensor

A Light Sensor monitors the amount of surrounding light. Your robot's "Brain" has a built in light sensor (View the image above, it is between the numbers 2 & 3). You will program your robot to react to the changing amount of light.

Task #1: Light Sensor_ Test the Sensor

Just like we did for the Ultrasonic Sensor, lets test the Light Sensor to see if it works. Write a program that does the following:
Model Video: Mobile or You Tube.

  1. The robot should be elevated off the ground so that when the wheels spin, they do not touch the ground and the Brain/Light Sensor needs to be pointing up (towards the light).
  2. First, look at the code you wrote for "Task #1 Ultrasonic Sensor_Test the Sensor."
    Hint: To save time, I would "SaveAs" the program you wrote for "Task #1 Ultrasonic Sensor_Test the Sensor," and title it..."Task #1 Light Sensor_Test the Sensor." Then start making the changes recommended below.
    Note: The Light Sensor Value Range 0-1000 ; Exposed under sunshine (>500); Exposed at night (0-100); Indoor lighting (100-500).
  3. Rewrite this program so that the robot wheels will stop moving forward when the intensity of the light reaching the Light Sensor on the robot in the classroom drops to 200.
    1. Note: in order for the wheels to be moving, place the "Wheel Move Block" prior to the "Forever" block.
    2. Delete the "UltrasonicSensor" Operator that you used in "Task #1 Ultrasonic Sensor_Test the Sensor." and instead use the Operator shown below - insert it into the "If/Then" block.
  4. Test it! Download this program to your robot. The wheels should turn forward. But...when the light reaching the light sensor on the Brain is blocked, the wheels will "Stop Moving."

Task #2: Light Sensor_ Park My Robot.

Write a program that does the following:
Model Video: Mobile or You Tube.

Hint:

  1. Review and copy the code you wrote for "Task #3: Ultrasonic Sensor_ Robot Drive in a Circle Around a Center Object." Edit it so that your robot will now successfully complete the new task using a Light Sensor instead of an Ultrasonic Sensor.
  2. It will take some trial and error, but to succeed, you need to balance the speed of the robot with the amount of time you allow it to complete a task.
  3. You are allowed to move the boxes to positions that will let you succeed, but only after a run and not while the robot is actually moving.
  4. Good Luck and Have Fun Parking Your Robot!

Ultrasonic Sensor & Light Sensor

Task #1: Ultrasonic Sensor & Light Sensor: Guide Robot Thru Maze

Write a program that does the following:
Model Video: Mobile or You Tube