How to make AmandaLDR


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:

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.



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.

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 :slight_smile:



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

cool!I might try thisI have


I might try this

I have two LDR’s that i found somewhere and I’ve been wondering about what to do with them. was thinking about using them to make my robot search for light or dark places, but this is much cooler.


as soon as i have an LDR
as soon as i have an LDR i’ll try this

nice invention fritsl!

nice invention fritsl! congratulations!!

i know i will try this some day!! :slight_smile:

thanks for sharing!!


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


/ vzz-clck-"Maneuver"

Well unfortunately it does

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 :slight_smile:

I think using this method (2

I think using this method (2 cycles, work with difference only) combined with some low tech "morse code (like “2 long 3 short, repeat”) would make excellent laser-communication between robots!

That would be way cool; LED’s could be used to track down the laser. When locked on target all could freeze and they could start sending laser-beam-messages to each other. Wicked!

Color detection

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




What happens if you have there one more LED maybe another color (intruder led :slight_smile: ), 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.

slight enhancement

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.


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
Just below the main picture up there in this very post :slight_smile:


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


Hmmm… did you ask Amanda

Hmmm… did you ask Amanda BEFORE you changed the name? :slight_smile:

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. :slight_smile:


Duane S

Wilson, North Carolina USA

That reminds me of something

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.


:slight_smile: :slight_smile:

to the creater of the frittzLDR or amandaLDR

I have an idea that will make this LDR of yours into a color recognition device on the cheap… if your interested in hearing it let me know …TTFN

[email protected]



It is very easy to make it

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

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 :slight_smile:

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

To make it look at color you
To make it look at color you use a red, blue and green LED one at a tiem and record how much light bounces back to the LDR for each color. Its th emost well known and cheapest way to do it.


Damn you Murphy and your law!

Frits, do you know I honestly just came up with this idea last night?!?! Bizzarre. I obviously can’t prove this in any way, shape or form, but it’s sketched out upstairs in my brilliant idea binder all the same.

Only difference is, I was thinking of surrounding the LDR with leds pointing in different directions, eventually shielded with a modified flshlight reflector to direct the beams. Each cycle of the code would pulse them individually, and then compare the readings to get some idea of the direction of the object in proximity-- if it’s off to the right, more light will be reflected when the right LED strobes than the left one. I could then use this to make a bot that creepily stares at objects in front of it. I want to make it after the fashion of those creepy spider robots from the original johnny quest show. That design always captivated me as a kid.





It sprang from an unholy union of two ideas-

1. the idea of firing off a modulated ir led and detecting the bounce with an ir receiver. But I was frustrated by this since it can only give digital feedback, rather than analog values.

2. the idea of using multiple ldrs in true BEAM spirit to make a photovoric "head" bot that looks at the brightest light source available. My idea was to put it under an overhead bright light in a relatively dim setting, but shield its ldrs from said bright light with little hat brims . This way, when somebody enters the pool of bright light, they become the brightest object, and it fixates on them. When nothing is in the pool of bright light, it looks around the room finding whatever the local brightest light is.


I didn’t mean to say that IR can’t be read analog, just that the three pin demodulating IR transistors kick out a digital signal. I should’ve clarified. Idea 1. was to fire out remote control comands with the IR, and look for them with a 38 khz remote control receiver.


It did occur to me that I could use ir leds in place of the regular ones in this design or one like yours, if I decided I didn’t want to strobe people in the face when they look at the bot. But what would be the fun of that? I say, dazzle 'em.

Good idea!

I’ve tried to do that. Using a three pin demodulating thingy. Great idea to have different LEDs shine in different directions. I think you’d have to shield the LEDs pretty good.

Range improvement

Didn’t get a lot of power from the IR LEDs, but it works up to about 30-40cm range