Wednesday, April 29, 2009

Obstacle Course: Day 2 - Program

today, I will work on the section of touch sensor and ultrasonic sensor. My robot is right now able to complete the tasks until sensing the black line, and staying inside the box for 5 seconds. \

I will write the program for my robot, of bump into the wall, go backward, turn right, sense the wall before bumping, and stop.

For the task, which robot bumps to the wall, and goes backward. I will use touch sensor. Touch sensor can sense object by hitting to it. I will make the robot to go backward, and turn right, after when the touch sensor is bumped by the wall.

For the task of sensing the wall without bumping to it, I will use ultrasonic sensor. Ultrasonic sensor can sense the object in front without hitting to it. And then I will make the robot to stop and turn right, after the ultrasonic sensor sense the object near.

Monday, April 27, 2009

From the reading of Chapter 11, I learned about loop block. Loop block allows the user to repeat the action of robot, without any complex program. Just put the actions (which the user wants) into the loop block. Then the loop block will make the robot the run the program for certain (decided) amount of time. The user has four choices for the loop block. The user can make the robot to run the program for forever, for until some kind of sense, for certain amount of time, for logic, and for count. The user can easily change the loop block's option, and also to run it. At the end of the Chapter 11, the book talks about the nested loop. It allows the user to loop something then have the program do something else then repeat all of it again.

From the reading of Chapter 12, I learned about switch block. The user uses the switch block, when the user wants the robot to do certain action, when there is something, and do another action, where there is not something. Which means, that the robot will have two option depend on whether it senses something or not. Moreover, the switch block allows the robot to do more than two different actions depend on situation. It is useful, as it makes the robot to move various ways, and be more lively.

Obstacle Course Challenge

In this challenge, I need to make a robot, which passes obstacle courses, composed by total of 6 missions.

1. Start w/Clap
2. Stop 5 sec in Box
3. Pump Pillar, then Back Up & Turn Right
4. Sense Wall, then Turn right w/o touching it
5. Avoid Obstacle
6. Stop after line.

I must need all the sensors (touch, sound, ultrasonic, light, and motor) to complete this obstacle course.

For the 1st one, I must need sound sensor, as the robot has to be able to hear a clap sound.
2nd one, I will use motor sensor, as the motor sensor measures the time of rotating the motor.
For the 2nd one, I might also can use light sensor to complete 2nd mission. Light sensor will detect the black line, and the robot will stop, after sensing and passing the black line.
3rd one, I obviously need touch sensor, as the robot has to bump pillar.
4th one, I require ultrasonic sensor, as the robot can not bump, and has to be able to detect the wall.
5th one, I think, I should use ultrasonic sensor, so that the robot will not hit the object, and change direction, before passing the obstacle.
For the 6th one, the light sensor will help my robot to finish the course, as the sensor will detect the black line, and makes the robot to stop.

Thursday, April 23, 2009

Field of View Experiment

In this experiment, I investigated the field of view of ultrasonic sensor. As a result of this experiment, I would be able to find the width of ultrasonic sensor.




I measured the field of view of ultrasonic sensor, by marking the spot where the robot can detect in most widely. I measured by using spray can (picture 3).

Picture 4 shows, when I was measuring the field of view by spray. The middle black line is just a marker to show the distance from the robot. Each black tape symbolizes that 10cm, and if the tape is 5th one, then it means that the tape is about 50cm from the robot.

The last picture shows the final field of view of my robot.
I first expected to just get wider as the object goes further away, however, mysteriously the field of view was a shape of snowman. The width of view became wider, but shorten in 30cm, gets wider again and get shorter in about 70cm, then gets wider again.

In addition, the detecting object is really determined by the shape of the object, and if the object is flat, then the robot will pick it up more easily.

Thursday, April 16, 2009

Line Tracking

From the investigation of light sensor, I did project called "Line Tracking".
This project is to make the robot to trace the line automatically by using light sensor.
In this project, I made the robot to trace black tape, which is pasted on the white floor.

First, I attached light sensor in front of the my robot.
Second, I made the program for my robot to be able to trace the black line.
Actually, there are no forward motor actions included in the program.
This program is just with 'wait for light', 'turn right', 'turn left', and 'repeat infinitely'.

About light sensor, I first set up the threshold for the sensor. Threshold is for to separate two lights, light and dark, and able for my robot to be able to sense two different lights. I took the average of measurement of black line and white floor. And let's say threshold is 50.

When the threshold is set, I made the robot to do specific action depend on what sensor senses. I made my robot to turn left when the light sensor senses dark light (black tape). Then, I made my robot to turn right when the light sensor senses bright light (white floor). This makes the robot to be able to trace the line. When the light sensor senses dark light, then the robot will turn left, which means that the light sensor will be out of black line, and now sense white floor. Then the robot will turn right, as the sensor senses bright color. Then, then sensor will be back on the black tape, and turn left again.

I made this turning right and left, to repeat infinitely, so that the robot can trace the line. When the robot is turning right and left, the robot is actually going forward bit by bit. Therefore, when the robot's action is repeated, the robot is tracing the line, and actually going forward.

Moreover, I am able to change the rate (speed) of robot of tracking the line. When I do the default (first) one in very fast mode (100%), then the robot will totally go wrong direction and not able to track the line properly. (maximum speed for default setting of robot is about 30... very slow) When the robot is tracking a line in fast mode, the swing of the sensor gets wider, and the robot is actually going over the black line without sensing the dark color. In order to make the robot to track the line in fast rate, I most shrink the swing, so that the light sensor will not go over black line and not sense it.

In order to solve this problem, I changed the location of the sensor. I attached the light sensor behind the robot. When the light sensor is attached near wheels, the swing of the light sensor will decrease. So, now I can make the robot to track the line in full 100% speed. In addition, I made the whole program to go backward (just change the motor's direction), so the light sensor will be the front of the robot, when tracking the line (going forward).

PS:
First picture shows my robot with light sensor attached on back side.
Second picture show the program for my final robot, which robot is going backward (in a way forward).

Tuesday, April 14, 2009

Pictures for Line Tracking


Ch.4: Reading Sensors

From the reading of Chapter 4: Reading sensors,
I studies various types of sensors.

There are mainly four types of sensors, light, sound, touch, and ultrasonic.
Each sensor has a specific way to use, and all sensors are valuable in different situation.

Light sensor might be useful, when the user wants the robot to sense the light of dark and light, and do certain action depends on the light the sensor sensed.

Sound sensor might be useful, when the user wants the robot to do specific action, when the sound is played, or stopped. The user will be able to control the start and stop of the robot from far away, by just making the sound.

Touch sensor might be useful, when the user wants the robot to do specific action, when the touch sensor is being pressed. For example, make the robot to change the direction, when the robot crushes to something.

Ultrasonic sensor might be useful, when the user wants the robot to do specific action, when the sensor senses some kind of object in front of the robot. This sensor will allow the robot to change the direction without crushing to something.

For using the light sensor, I need to take care of threshold. Threshold will divide the difference of light into two parts, light and dark. This will be very important, as it allows the robot to do two types of different action, when the light sensor senses dark and light.

By using light sensor, and the appropriate program, the robot is able to follow the line. In order to do this, there are steps the user must follow to make its robot to track the lines. Firstly, the user needs to set the threshold for robot, in order for robot to be able to sense dark and light. Secondly, the user needs to make a program. The program should have two actions. Turn right, when the light sensor senses dark. Turn left, when the light sensor senses light. Thirdly, Make the program to repeat infinitely.

The robot is not actually going straight. The robot actually traces the line and moving forward by turning right and left repeatedly. Let’s say that the line is dark.
The robot’s light sensor will sense the dark line, and turns to left, as the sensor sensed dark. Then the robot’s sensor will be out of the dark line. Now, the sensor will sense light, and as programmed, the robot will turn right. Then, the sensor will go back to the dark line again, and turn left. When these right and left actions are repeated, at the same time, the robot is moving forward by little and little. This is how the robot traces the line.