If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

### Course: Electrical engineering>Unit 8

Lesson 1: Introduction

# Warm up: ultrasonic vision

## Ultrasonic Sensor

Most of us don't have nightvision scopes at home. Luckily we can build a simple robot which can help us see in the dark. To make things simple let's say we only need to avoid hitting walls.
To do this we will need to use our ultrasonic sensor. This sensor generates high frequency sound waves and measures the echo which is received back by the sensor. The length of this echo is used to determine the distance to an object:
Finally let's review another fundamental concept we will need: switch blocks. If we want to modify the behavior of our robot based on some condition (such as a light turning on, button press or object dection) we use the switch block. Which looks like this:
The following video introduces the switch block and shows how we can control a switch block using the ulstrasonic sensor.

## A robot's point of view

Before you move on and begin building amazing robots it's important to practice thinking like a robot. This is a nice challenge to get started with: close your eyes and use the ultrasonic sensor as your vision. Try the following:
• Idea 1: Try to find the door and exit a room without touching a wall
• Idea 2: Tape a large box to the wall and try and locate it without touching wall or box
• Idea 3 (groups): Can a group of people exit a room without coming into contact?
What did you learn?

## Want to join the conversation?

• what does the sensor have inside it?
• I'm not sure about other ones, but the ultrasonic sensor works like echolocation in bats. The sensor sends ultrasonic sounds that are unhearable by humans and then measures the echo to tell how far the object is.
• I tried doing line following with my robotics team that this week is going to go to the states competition but the robot keeps wobbling can you tell me how to line follow without the robot wobbling? or can you post a video?
• If the robot is wobbling but still following the line, your program is working properly. If you don't want it to wobble, try making a more complicated line following program. Here's an example:

http://www.nxtprograms.com/NXT2/line_follower/steps.html#Program

the first program is probably similar to what you have.

A simplified version of what the link would show you:
If your program is wobbling, then it's probably something like this: "If black, turn right. Else, turn left". If you make your program detect the level of black and factor into your motor motions it will be much smoother. For example: "Left motor power = Color sensor reading. Right motor power = (100 - Color sensor reading)". This will need a lot of tweaking but if done properly it will be very smooth.

Also, make sure your color sensors are properly calibrated, and if possible use two sensors right next to each other. Making the robot move slower, and insuring that it approaches parallel to the line will decrease wobble too. Using these tips should make your line follower much smoother. Keep in mind that every line follower will have at least a tiny bit of wobble just because there will always be a delay in the robot reacting to its motion.

Hope this helps, good luck!
• WoW I was in FLL and my teacher for the program didn't tell me we could do that! Ps. She wasn't that good either
• Give some stuff about heavy metal and drums
• How do you build a machine that can program electricity while making body contact with the machine like with your finger.
• can you do a course about the mindstorms EV3?