Let's Make Robots!

How to make AmandaLDR

Make a robot sense stuff in dark or light conditions.. guided by visible light
AttachmentSize
BASIC_CODE_FRITSLDR.BAS2.63 KB

Update: I am tired of it being named "FritsLDR", I cannot post to people "Try using FritsLDR", it is just too self centered. And I would just love to see some more people trying it. 

So it is hereby officially renamed "AmandaLDR", named after my first dog Amanda, that died because it ate rat poison. RIP.

I call it FritsLDR because it had to have a name, and my wife would not be honered anyway. However I think it would be fun to see if people at other sites would talk about it, using this name :) I cannot patend this and make millions, so at least I can try to get some street credit, name something after myself :) You can of course call it what you want!

What does it do?
This is a method of making a robot (or any other piece of electronics of course) sense objects in front of it - only by using light that is also visible to the human eye. Here is a link to a robot that uses this: http://letsmakerobots.com/node/1823

What does it not do?
This is not usefull if you need acurate distance to objects, only to know if they are close, or perhaps "very close".

What can it be used for?

  • Line following robots
  • Make your robot stop before it would fall off a table or the like
  • Experimenting and fun (since I have only just begun this, and it is fun to work with something that you can see)
  • Cool flashy robots - really. Video is not doing this justice; It looks COOL (specially at dim light) when a robot is navigating by flashing LED's
  • Object avoiidance - specially in near field
  • Point a laser (that is hooked up like the LED's) and the beam can be detected in sunlight or at night.
  • Make robots send flashy signals to each other
  • Try other sensors than LDR's? Photoresistors?
  • Have fun at a very low price (cheap and accessible components)
  • Make your robot detect colors / seperate one object from another!
  • Make your own sensor is fun :)

How does it do it?
It is so simple that I know many people will say that this is "nothing". However, it has never been done before (please send me links if I am wrong) and it is so fun to play with.. so I stand by my statements of calling this an invention, and naming it after me ;)

Oh .. how.. yes.. Have an LDR (Light Dependant Resistor) and an LED (Light Emitting Diode) - both very cheap components hooked up to a microcontroller.

The bigger the LDR the better (because it is more sensitive).

The LDR is hooked up to an analouge input of the Microcontroller, and a resistor is applied so that it is "resting" somewhere that you can read both more and less light.

More LDR's can be used on same analouge input, and of course multiple LDR's can be hooked up to multiple analouge inputs, thus making multiple sensors /variables to work with in the code.

The more LED's the better. The brighter LED's the better. The LED's point at the object measured, and the LDR is at an angle / shielded so that the LED's direct light does not influence it, but what the LED is shining on is reflected back on the LDR.

All LED's are just hooked up on the same output pin if you wish. It does not matter (or only makes it better) if other LED's are on when you are measuring one LDR.

The above is not new, all IR detecting works like this.. The tricks - the FritsLDR lies in this:

Instead of measuring light and trying to guess how far things are, we are measuring twice pr cycle, one with the LED on, and one with the LED off. And we do not care about the results, only the difference between the results.

Big difference; Your LED was able to make a difference, so there is something there. And it is containing the same wavelenght as your LED. (White contains all, yellow will reflect both red and green light.. green objects will only be seen by LED's containing green light, such as yellow, white or green LED)

Small / no difference; Your LED did not make an impact. So either the object is mat & black (like the black lines for a line follower), or the LED's are pointing to something too far away, like over the edge of a table.

 

Construction 

What you need is something like this:

One or more LED's hooked up to an output port of your microcontroller. Make sure the LED get's all the power it can take, by ajusting with resistor(s). My experience tells me that usually a 330 Ohm resistor on a 5V output (like typical darlington output on a Picaxe 28 board) works wonders.Please do not ask meabout how to calculate this with many LED's etc - we have clever electronics guys for that, ask in the forum, thanks.

All LED's on same robot can be hooked up to same output if you wish. It only makes it better if some sensors also gets reflection of other sensors LED's.

Any color can be used. However, if distance matters to you, I recomend red LED's.

It is IMPORTANT that the LED's are of the "clear" type, often refered to as "super bright". The kind that you cannot see which color is, before switching it on. This is simply (to my knowledge) the only kind that is powerfull enough to go beyond very narrow.

(Make sure the LED is turning the right way - short pin, black, ground)

LDR(s) hooked up to a (preferable high resolution, but 256-value will do) analouge input, with a resistor on so it is "resting" at a fine middle value.

Sorry for the uglyness in the picture (this is made fast, it was just parts I had laying around)

  • Black goes to ground
  • Middle red goes to analouge in
  • Other red goes to V

Between the wires is soldered a (small) LDR, and a 330 Ohm resistor.

For Picaxe users: The above will fit onto the 28 board if you solder an extra pin into the analouge part of the board (see 28 pin Project Board (AXE020), Picaxe for dummies)

So the whole circuitry for the simplest setup (one LED, one sensor) will look like the picture above. Yes, the 2 black (ground) are touching each other.

SELF-TEST:
You should be able to swhitch the LED on and off, and be able to detect this light with the LDR.

Now see the attachment on this page, there is a code for this. It is written in Picaxe Basic, but is well documented, and made as simple as possible, so it should be universal.

You can also make your own code, and you can have a look at the example below, tips on making the construction itself:


This is a brief look through making a sensor that can be used to stop your robot from falling of a table etc.

 

If you are looking at using this for object avoidance, I recomend some setup like the one on the main picure above: Large (shielded) LDR, and multiple (red) LED's.



I am using a perf-board to mount 2 sensors, each with one LED close to it. So step one would be; Get some perf board :)

 

If you are going to use this for line following, you may want the distance of the LDR's to match the black line. (I'd say that mine are too far apart on the picture)

Of course if you just want to test the whole "FritsLDR-thing", one LDR is enough, and the code is optimized for this.

Place the LED(s) as close to the LDR as possible.. but make sure to leave some room for shielding. You may want to add some black plastic on the edge of the LDR to prevent false readings.

If distance really matters, the setup on my picture is not that good, as the LED is close to the object, and the LDR is further away. It is in fact a matter of getting the LDR as close to the object as possible.

If you want, you can make sure that the LED's point in an angle for optimal reflection to the LDR. However, don't overdo this; My experience tells me that it does not matter as long as they are not pointing away from each other.

- And there you go, really. I am not going to show you the backside of my board, it is a mess of wires and solder :)

However, I recomend that you some way mark the wires (and perhaps even add female headers on them) so that you know what is what later on.

 I cannot wait to see your flashy robots!! :D

Comment viewing options

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

It is very easy to make it color recognition, and I want to see what you come up with :)

However, I think it is the best thing to keep it online, so others can read along and inspire us etc. Imagine if I had kept this in a mail to someone, you'd never get to read it :)

- And btw; You are really asking for spam by writing your mail adress like that :)

That reminds me of something like:

Henry: The dog's name was Indiana.

Sallah: Haha, you were named after the DOG!

Indiana: I have a lot of fond memories of that dog.

 

:) :)

Hmmm.... did you ask Amanda BEFORE you changed the name?  :) 

I don't care what you want to call it.  It works, and we, as hobbyist's, can use it, and understand it.

The hummingbird doesn't understand the basic aerodynamic explaination of why he can NOT fly, or the advanced aerodynamic explaination of why he CAN fly.  So he just flies.

Maybe you should call it the Hummingbird LDR.  Just kidding.  :)

Thanks.

Duane S

Wilson, North Carolina  USA

In the other post for the joystick bot you mention code for using a fritsLDR, but I can't find it?  I have been able to breadboard up a fritsLDR and am trying it out with my arduino.  I'd like to port the code!

:-)

Just below the main picture up there in this very post :)

Ahh yes i couldnt see it before because it doesnt appear unless you're logged in! sorry bout that... 

:-)

If you wrap the LDRs with black tape, it reduces the light pollution from the LEDs so would make them more accurate.

LDRs let light in at all angles, so a bright light source may confuse the sensors. The tape narrows the focal range and sharpens the sensitivity.

SOR also has a nice text about color detection. Link here.
another interesting reading here.

 

 btw:

 

What happens if you have there one more LED maybe another color (intruder led :) ), that pulses with same frequency as your LED (or 2^n), do you get missreadings in terms of distance. ie. Robot thinks its closer to he object than it actually is.

 I wonder how accurate and how long range you could get with a laser pointer...

 

/ vzz-clck-"Maneuver"

Well unfortunately it does not reflect anything that I have been able to measure, so it is useless untill one of us finds a way to detect it.

However, when pointing the laser at the sensor, it is EXTREMELY sharp; Dark night/ daylight does not matter, so if you are just looking for something to detect if a laser beam is flowing or not, this method works very well! Try it, replace the LED with a laserwith a long wire to it, it is really fun for some strange reason :)