Let's Make Robots!

New ways of seeing things..

Hi all, I am so excited about this. It may not be much to anybody else, but to me it is!

You all know how we only have the IR's or the Ultra sound to work with when we want to check distance? Yeah, if we have millions we can also get a camera or two, and laser range finders..

However, I wanted something cooler.

This is not that, I am sorry.

However, I am working on something cooler (I hope, but it may be far fetched), and when doing so, as a spin off I made this. 

And it is pretty wicked, I think.

The setup is simple, as simple as you can see it on the video; An LDR (Light Dependent Resistor) is hooked up with a 330 Ohm (or something) resistor, to the analogue input of a standard Picaxe 28 board with no extra modifications.

Also a speaker and a "white" (pale blue they are) LED are hooked up to the standard outputs, batteries, and that is it.

At first you may think that I have done nothing special.. LDR detecting light, or maby just pulsating light.. but then why don't you try to replicate it? I am going to be very surprised (and my day spoiled) if you can make something that works like this! ;)

I have made an LDR measure distance!

There you go, for less than half price of a Sharp IR range finder, and twice as fun, as you can actually see where the robot is focusing!

I am so excited to hear what you all think of this, and to hear if anyone can figure out how I did it, so I am not going to tell yet, but I will make a walkthrough, and am planning to make a robot (Start here-kind of project) that will not drive over the table's edge, and will navigate just by this.

..And while I am at it, I think I may have a look at giving that robot the ability to sense colors as well, so it can find say a red object amongst green on a black surface.. and then it can play ball :)

Because color detecting is also a spin off by this method! (Not on the setup on the video, and I have not tried it in real life yet, but I am pretty sure, and am going to prove it soon :)

And if not for color sensing, then for coolnes: Yes, the LED can be red as well (or any other color, possibly even IR, though I have not tried it yet) In fact it was red when I made the original test, but I swapped it to a "white" so you should not think it was the difference in color that did it. The flash light on the video has 3 LED's of same type & color..

How did I do this? Make me happy, throw me a theory, or try to duplicate :)

Thanks (I will tell later, but here is a chance to take me down first ;) Did I mention it is working in sunlight?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Fritsl you're being very childish, but I'll persevere anyway.

It's interesting that you think that GroG's suggestion matched what you did, but it does not at all. Taking measurements repeatedly at fixed intervals of time is more useful than your haphazard method of just taking two samples at a time. The main reason that this is true is that it provides an additional relationship between the series of observations which you can use to improve noise immunity. For what it's worth, the same principle applies in PID control theory, especially with regard to the differential component which is the most sensitive to measurement noise.

Now yesterday I said that it would not be possible to extract the signal of the LED against a background of noise from mains powered lighting. My reasoning was that the response time of the LDR is too low and you could not separate it from the low frequency of the mains interference. Well I've been thinking about it some more and I'm happy to say that there may be a solution after all.

You would have to use two LDR's instead of one and deploy them the same way as the two microphones that are used to make a directional microphone. The second LDR senses the ambient light by pointing slightly away from where the LED and the first LDR are pointing. You use a differential amplifier to remove the second signal from the first one and then pass it through a large value capacitor to filter out the DC component.

I hope that this is clear enough for you to understand and get it working for yourself. If not, I've still got some LDR's in my junk box here, so I might just make one myself anyway.

Of course I am childish - I am an adult making fun little robots :D

I know that GroG really was only 90% there.. However, he was 90% at the right direction where the rest was some 0%, he's input would have made me make it, so I did not see any reason for taking it any further without showing you how I did it :)

Regarding the  "it would not be possible to extract the signal of the LED against a background of noise from mains powered lighting" - well..

  • I think your solutions sounds way too complicated for me. And not very good at a distance.
  • If it was a problem I would just take 3 samples on / 3 samples off for each cycle, and use average on each. It would still be as fast as an SRF05 for every cycle.
  • So far it has not been a problem, but eventually I will try to optimize so that it can go as close as possible to any light source, so I will insert some leveling out in later versions.
  • As you can see here, I am aparently already doing the impossible ;)

The closer you move the LED to the LDR the greater the light intesnsity is and therefore the lower the resistance at the LDR. Intensity is a direct function of distance in this circuit and Bob's your uncle.

As to the resistor value on the LDR... well, I would use a calculation something like this -

Vo = 5*RL / (RL+3.3)    (taken from some old data sheets) to derive voltage (substitute the R value in koms for atenuation).

and then...

Lux = (2500/Vo - 500)/3.3   substituting the R value in koms as needed to atenuate the circuit. This calculation will give you intensity.

For better rejection, I might even create a pulse train similiar to that used on an IR reciever, because the picaxe could care less how the pulse train was recieved - but I don't think that this circuit uses a pulse train.

"The closer you move the LED to the LDR the greater the light intesnsity is and therefore the lower the resistance at the LDR"

That is right, and that is one parameter of how distance is measured here! 

I do not understand the rest of your post, sorry.

 

no fair some of us were guessing while at work and unable to view the video ;)

Looks awesome!! :D

Another theory..

By using a 330 Ohm resistor you are causing a delay in the LDR enough to calculate the reflection distance.. so instead the speed of light, you have something like the speed of sound !?

And, if you use the LED with PWM (instead of a steady light) and change the frequency, this slight change could be enough for the LDR, and he "knows" that the light wich is coming in his direction belongs to the LED

???

To put it short; There is no calculation of time / speed of light / delay involved in the most basic form, at the "oh is that really all"-place in here.

I would be too stupid to make anything like this, and I think the Picaxe would not be fast enough or precise enough to work with these things.

I'm with guibot, if you send pulses to the led, then have the picaxe only pay attention to the pulses that come in from the LDR ignoring the ambient (fairly constant) light.

 

Let's see... You produce light of certain intensity, and the LDR "sees" it. Then you produce a bit less intensive light, and the LDR still is able to see it. Thus you gradually decrease light intensity until the LDR stops "seeing" it, and the last time you've caught the reflected light would roughly define the distance to the obstacle. Now the question is, how you control light strength. My guess is you just produce "sounds" of different frequensies...
I personally think this is both a very good guess, and quite close. But that is not ment to be a hint, and it is a matter of interpitation of the right answer and this theory - I am sure many will think this is not the best answer. I just think that the thinking here is good, and the theory is on the right path, if you sort of see it as a matter of thinking outside the box :)