Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: not_this_punk on November 19, 2007, 06:30:38 PM

Title: sharp ir and ping pong balls
Post by: not_this_punk on November 19, 2007, 06:30:38 PM
Hello.
First of all, I`m very excited about being here and about robots in general. This is my first attempt in building a robot (for an university project), my first post, so bear with me.

Me and the rest of the team need to make an autonomous robot, that would walk around a ping pong table and detect ping pong balls, in order to deliver them into the opponent`s goal gate(sorry for my English and for not finding a suitable synonym).

So after reading through this site, we figured that the best way to do this would be a sharp ir placed on a servo according to http://www.societyofrobots.com/sensors_sharpirrange.shtml (http://www.societyofrobots.com/sensors_sharpirrange.shtml). When the robot finds a 4 cm object, it`ll know it`s a ping pong ball so it will pick it or whatever. I was considering GP2Y0D02YK or the one above it (one of the last two ones) found here http://www.societyofrobots.com/sensors_sharpirrange.shtml. First thing's first, what does "fixed distance" mean? And by using this method, could we actually take correct readings and find the 4 cm balls or the spherical shape would create problems in reflexion? I also see that only 3 models have minimum ranges. What`s up with that? Does that mean i could use the model with the highest range to detect objects just in front of it?

Again, I`m a true novice in robotics. I`m currently a student at the Electronics and telecommunications faculty back here in Bucharest, but it's just too much theory and too little practice so I`m no expert in electronics or programming either, even though I do know a few things in electronics (mostly theoretical) and I can program in C (say medium level). Anyway, electronics shouldn`t be a problem thogh, but I`d very much like to logically understand what you`re saying :)

Oh and are the servo and the stepper motor the same thing? Cuz I don`t quite know what a servo is  :-\.

Thanks a bunch for reading this. Looking forward for your replies : :D
Title: Re: sharp ir and ping pong balls
Post by: not_this_punk on November 19, 2007, 06:54:06 PM
ok I think I found what fixed distance means. The ones with fixed distance have digital outputs thus they can tell if an object is there or not and don`t offer any range data. But I still don`t understand what`s the deal with the missing minimum range.
Title: Re: sharp ir and ping pong balls
Post by: airman00 on November 19, 2007, 08:42:26 PM
Your approach with the IR seems logical , though I'm not exactly sure what your task is. Do you basically want a soccer robot, a robot that pushes a ping pong ball into a goal, or a hitting robot, which hits the ball?

Two other ways to detect the ball - a. use AVRcam      or   b. use a simple photoresistor / LED circuit to detect colors, im assuming the ping pong ball will be the only white thing there. The photoresistor would be the easiest, while the camera would be the coolest / most advanced.

Also, a servo is a geared motor with a built in circuit that responds to a pulse given to it. The pulse given to it , controls to which angle the servo should turn to.


Also, have you chosen on a microcontroller yet?

Title: Re: sharp ir and ping pong balls
Post by: not_this_punk on November 20, 2007, 01:13:42 PM
Your approach with the IR seems logical , though I'm not exactly sure what your task is. Do you basically want a soccer robot, a robot that pushes a ping pong ball into a goal, or a hitting robot, which hits the ball?

Two other ways to detect the ball - a. use AVRcam      or   b. use a simple photoresistor / LED circuit to detect colors, im assuming the ping pong ball will be the only white thing there. The photoresistor would be the easiest, while the camera would be the coolest / most advanced.

Also, a servo is a geared motor with a built in circuit that responds to a pulse given to it. The pulse given to it , controls to which angle the servo should turn to.


Also, have you chosen on a microcontroller yet?



Thanks for your response.
So the robot should deliver as many balls as possible into the opponent's gate, by any means necessary. The time limit is 3 minutes. The ping pong table is 2.5m x 1.25m and the ping pong ball is 4 cm in diamater and it`s orange.

Our approach is to make some kind of a trailer in which the robot will put the balls and at the end, open up the rear in front of the opponent's gate and score. Anyway, the concern is not the mechanical aspect. The ball detection will be made through a sharp IR put on a servo (which I understood is the same thing as the stepper motor), which will rotate with a given increment.

My question was: could the sharp IR (say the model with 1.5m range) detect a ping pong ball 4 cm in diamater? And what would be a detectable range for a ping pong ball? Because if the IR light is 16 cm at 1.5 m and the ping pong ball is 4 cm wide, only a quarter of the total emitted IR will be reflected and maybe I won`t get an acceptable voltage. That's why I`m asking about the maximum range of a sharp ir used to detect a 4 cm ball.

I don't exactly know what uC we`ll use but as far as I can remember it`s an ATmega16. Anyway, this is the "recommended" uC as we were told so we`ll get some support for it if we`ll need it, so I`ll stick to this one.

I`d like to have some sort of long range detection for the robot to know exactly where to go from the start. It would detect let`s say 3 balls up ahead and it will go to the nearest one, then it`ll scan again and repeat the process. We were provided with a TSL3301 to detect the opponent`s goal gate (which will have a white LED on top of it).
I don`t know anything about AVRcam and I`d appreciate if you gave some details to both methods. I guess the LED/photoresistor combination is for color detection? I don`t know how to do that exactly...
Anyway thanks in advance for any replies and please tell me if the sharp ir could be used for 4 cm ball detection and at what range.


Title: Re: sharp ir and ping pong balls
Post by: not_this_punk on November 21, 2007, 05:30:53 PM
so nobody ever tried detecting a tiny ball with a sharp ir? :-[
Title: Re: sharp ir and ping pong balls
Post by: airman00 on November 21, 2007, 06:30:22 PM
no,
but i have done it with the photoresistor / LED setup.

You might do a combination of an IR sensor and the photoresistor/ LED


An IR rangefinder will detect and object, and the photoresistor will tell if it is a ping pong ball ( based on color)
Title: Re: sharp ir and ping pong balls
Post by: not_this_punk on November 22, 2007, 03:41:05 PM
problem is that i can`t use  light sources in the visible spectrum(E.G. LED).
my concern is if the sharp ir won`t be able to detect the ball at long distances or won`t be accurate enough for me the uC to calculate the ball`s size.
cmucam and others are out of the question so...any advices?
Title: Re: sharp ir and ping pong balls
Post by: airman00 on November 22, 2007, 03:44:03 PM
problem is that i can`t use  light sources in the visible spectrum(E.G. LED).

Why not?

You can also use an IR led ( not visible spectrum) and an IR phototransistor instead of the regular LED/photoresistor

My suggestion , have IR rangefinder detect an object and driveup to it
Have a IR / phototransistor pair detect if its a white object

Vola, you found a ping pong ball
Title: Re: sharp ir and ping pong balls
Post by: Joe on November 22, 2007, 04:39:27 PM
A pingpong ball would be very difficult to see with a Sharp IR sensor because the very narrow beam that it sends out would have to hit it and it would have to be pretty close. They are known for not being able to see things like chair legs. They also can't see things that are too close, like about 4" for the GP2D12. You could scan for it by mounting the sensor on a servo and have the program "figure out" the size based on the readings at the different positions. Will the balls be on the surface? In holders or free to roll around? Why is a Camera out of the question? That task sounds perfect for the blob tracking feature of the AVR cam.
Title: Re: sharp ir and ping pong balls
Post by: not_this_punk on November 23, 2007, 05:51:25 PM
Thanx for your replies.
The camera is out of the question because its affordability here in Romania (of AVRCam or CMUCam I mean), because of its price and because of its complexity for a true novice such as myself :)

I was planning to use the Sharp IR with a servo and scan around for objects, detect them and figure out the size of the object (taking the first and last measurements different of 0 and knowing their angle I can calculate the third line of the triangle, which is the ball`s diamater). That`s the algorithm I was planning to use, and that`s why I`m asking if Sharp`s accuracy is good enough for these calculations.

I can`t use visible light sources because the rules of the competition state that. Of course I can use IR LEDs. Frankly I had no idea that IR photoresistors exist, but now that I think about it, it seems pretty logical. But I don`t understand how to use the pair of IR LED and IR photoresistor to detect the ball`s color (the ball is orange BTW). I can`t compare the value of the light reflected by the ball with that reflected by the floor, because the floor (the surface of the ping pong table) is divided in two sections: one black and one white. I guess I could compare the IR light reflected by the ball with a specified threshold (measured at a fixed distance x), move next to the ball at distance x and if the values are close enough, it means it`s a ping pong ball. That`s what you were suggesting?

But if Sharp IR would be accurate enough for the uC to calculate the object`s length, I`d know it`s a ball from the start. So..does the Sharp IR have the accuracy needed for that?

PS: Sincere apologies for my English and for my complicated ways of expressing, but I`m very very tired...
Title: Re: sharp ir and ping pong balls
Post by: Ro-Bot-X on November 24, 2007, 02:15:56 AM
Hey, another Ro-manian here. Here are my thoughts.

Any ball is a sphere, so only a small spot that is perpendicular to the IR beam will reflect it back to the sensor. That's why round chair legs are hard to detect by the IR sensors. Ultrasonic sensors have a wider beam and longer range, they are much better at this.

Now if you are mounting the sensor low, parallel with the table, (at the middle of the ball height) you can detect the balls easier. The Sharp sensor gives you a range and you need to calculate the distance to the object. But if you pan the sensor, you need verry small panning angles, or you will miss the balls that are further away from you.

A cheaper way to do this is to use a IR LED modulated on a frequency like 38Hz and a sensor like TSOP4838. If you use PWM to flash the LED, modifying the pulse width will lower or increase the power of the LED, thus the distance of the object detection. Since the balls have a known color, you don't have to be concerned by the reflectivity of the object (a dark object will reflect less IR light than a white object). And you can get a LED with a wide beam...

Good luck with your project!
Title: Re: sharp ir and ping pong balls
Post by: not_this_punk on November 24, 2007, 05:23:25 AM

hey Ro-Bot-X.
That`s what I was planning to do: the ball is 4 cm in diamater and I was thinking of mounting the sensor parralel to the floor at a 2 cm height. I calculated that the opening angle of the IR beam is about 6 degrees, in the case of the 1.5m analog model. So if I rotate the servo with a 2-5 degrees increments I`ll always hit the ball :)
I want to use a long range sensor because I don`t want the robot to sweep the entire table in search of ping pong balls. I want it to detect the closest ball and pick it up.
A teammate also found a way to connect a serial mouse to the uC (along with the code) and we were pondering on the use of somekind of map. With the help of the mouse the robot would know its exact position relative to the goal gates and the walls, because the robot will always start from the same location.

PS: you`re romanian too?:D

Hey, another Ro-manian here. Here are my thoughts.

Any ball is a sfere, so only a small spot that is perpendicular to the IR beam will reflect it back to the sensor. That's why round chair legs are hard to detect by the IR sensors. Ultrasonic sensors have a wider beam and longer range, they are much better at this.

Now if you are mounting the sensor low, parallel with the table, (at the middle of the ball height) you can detect the balls easier. The Sharp sensor gives you a range and you need to calculate the distance to the object. But if you pan the sensor, you need verry small panning angles, or you will miss the balls that are further away from you.

A cheaper way to do this is to use a IR LED modulated on a frequency like 38Hz and a sensor like TSOP4838. If you use PWM to flash the LED, modifying the pulse width will lower or increase the power of the LED, thus the distance of the object detection. Since the balls have a known color, you don't have to be concerned by the reflectivity of the object (a dark object will reflect less IR light than a white object). And you can get a LED with a wide beam...

Good luck with your project!
Title: Re: sharp ir and ping pong balls
Post by: Ro-Bot-X on November 24, 2007, 06:44:01 AM

PS: you`re romanian too?:D


Guess what: I am!  ;D
Title: Re: sharp ir and ping pong balls
Post by: not_this_punk on November 24, 2007, 10:32:31 AM
so watcha thinking? could i measure the ball`s diamater using sharp ir? ???
Title: Re: sharp ir and ping pong balls
Post by: Ro-Bot-X on November 24, 2007, 10:52:19 AM
so watcha thinking? could i measure the ball`s diamater using sharp ir? ???

Nope! Because it is a sphere! I allready explained that... You can measure the width of a cube for instance, but not of a sphere.

Edit: Actually, you can measure the depth, if the ball is near a wall and you substract the distance to the ball from the distance the wall.
Title: Re: sharp ir and ping pong balls
Post by: omar1991 on November 28, 2007, 09:49:32 AM
 Hi

 I live in K.S.A, And I don't Have any ROBOT club in Riyadh or any place.

 So i don't get any help or advice on anything to do with robots :'(

 So when i was building the 50$ robot i did not no witch IR sensor to put on it or what photo sensor to put on it ether.

I would like some buddy to HELP ME
Title: Re: sharp ir and ping pong balls
Post by: Rebelgium on November 28, 2007, 12:48:51 PM
omar
you need to start your own , new topic.
this topic is about something else...

And you don't need a robotics club to help you, you have this forum!


Oh and about your question, you could have easily found an answer for that by searching the forum.
Use a Sharp IR distance sensor.
This is a usefull image that sumarizes the most common sensors:
http://i156.photobucket.com/albums/t31/frank26080115/Screenshot.png
Title: Re: sharp ir and ping pong balls
Post by: omar1991 on November 29, 2007, 03:48:25 AM
omar
you need to start your own , new topic.
this topic is about something else...

And you don't need a robotics club to help you, you have this forum!


Oh and about your question, you could have easily found an answer for that by searching the forum.
Use a Sharp IR distance sensor.
This is a usefull image that sumarizes the most common sensors:
http://i156.photobucket.com/albums/t31/frank26080115/Screenshot.png
Thanks I will start a new topic
Title: Re: sharp ir and ping pong balls
Post by: reSpawn on December 18, 2007, 07:51:55 AM
not_this_punk, where from did you bought the Sharp IR Range Finder? (I'm Romanian too :) )