New ways of seeing things

THIS IS THE ANSWER

Well… It may be a shot in the dark, GroG… and you may put it in other words than I would… But you are absolutely right!!

My way of saying this would be:

  • Make the LED flash on and off each time the LDR is measuring.
  • Work with 2 samples in every cycle instead of just measuring the input: Sample one where the LED is On and one where it is Off.
  • The 2 inputs are substracted from each other, and…
  • THE DIFFERENCE between the two is what we work with here :slight_smile:

Point the whole thing out towards outer space, and no difference is reflected to the LDR if the LED is doing it or not.

Point the LED to an object that reflects the light, and THE DIFFERENCE in the amount of returned energy is the same…

…even if the general level is higher (more light on) or lover (black night) - because the LDR is “lifted” to be somewhat “in the middle of the scale between black night and bright daylight” with the mounted resistor, and measuring is in word-variable-resolution (picaxe language: readadc10)

Of course it has reading-problems on black mat surfaces. However, primary testing shows that it can easely be set up to detect black things as well, however thinking they are further away than white ones. But this also goes for IR-detectors, only here you can acually see it all. My experience of working with a SHARP IR rangefinder is that it makes the robot very “analouge” - it is not really distance that is measured, but sort of a feeling of it…

The strenght of the LED / LED’s means a lot to the effective distance we can measure / detect with this method. That is also why I am actually working on some other method. At test time, I tried to over power a red LED, and boy, ow we where talking; It could measure the distance to my hand at up to 50-60 CM!

I will make some test with both more LED’s at the sme time, and also putting the LDR into the “shiny metal thingey” of an old flashlight.

The really interesting thing here IMO is that having multi coloured LED’s and making more samples pr cycle (one for R, G, B, none for instance) will provide color info on the target - and then a white LED may better judge distance now that we know the color… and knowing color and distance by a couple of LED’s, an LDR and a few lines in a sub routine to be called any time is quite handy!

As asmith.id.au points out: “if you could get it to work under mains powered artificial lights” - well the first test showed that i’d have to reduce sensivity quite some for it to work straight under a light bulb; The 50 Hz did course interferrence if we work with EVERY little difference - and that is nice to do. So I may have a look at filtering this either by “morse-code” in the on/off, or by something with the more colors of LED.

An extra feature is laser: Hook up a laser(pen) to the output of the LED, and you get insane sharp results when pointing the laser at the LDR! The laser does not work to reflect the light, but with this you can have a laser-beam that you can detect no matter it it is sun is out or not… for the price of an LDR :slight_smile:

Thanks for participating! The answer was all in the programming;Use 2 cycles, one on one off, work with difference. When Jklug80 wanted to detect if some object on the floor was a bottle cap or a tables leg, I suggested the same; 2 cycles. A) Measure the distance to the object B) make something poke the object, and measure again. If it has moved it can be picked up :slight_smile:

(And NICE ONE GroG, you have been granted STREET CREDIT AND RESPECT :D)

Still wrong!

Sorry Fritzl, you’re still wrong because you are just guessing about what your circuit and program are measuring. Until you can make an accurate graph of the results and interpret them you won’t be able to figure out what’s really going on in your circuit, even though you think you know now.

The first part of GroG’s suggestion is actually bang on the money. That your circuit works at all is just a fluke because of the constant time gap between your two measurements. However if you were to continuously measure the output from the LDR and analyse the resulting curves you might be able to get a more noise resistant result which might be useful in some environments. You would need to use a fast fourier transform and while it can be done an 8-bit PIC, it can’t be done fast enough to be useful here. There is sample code written in assembly language that you can download from Microchip’s website if you want to try it for yourself.

However you are still not going to be able to do anything in the presence of mains powered artificial light. The reason is simply because the LDR can’t operate at more than around 100 hertz which is the same spectrum (50 to 100 hertz) as mains powered lights. That’s why range finders use phototransistors and operate them at 40 kHz. The receiver uses a band pass filter to extract the real signal and then measures the amplitude of the result.

I could go and on but I won’t. I think it’s clever what you’ve done, but it is unfortunately neither novel or more than a curiosity.

 

How can I be “wrong”? Wrong

How can I be “wrong”? Wrong in what? The question here is how I did what is on the video, and I have answered that - wrong? Hmm? :slight_smile:

I am going to make a robot that navigates with this alone, and uses it to not fall off a table… so I may be wrong to the clever people, and my robot may be wrong as well… but if it works, then I would say that it is right :slight_smile:

You are wrong in the sense

You are wrong in the sense that you have made a proximity sensor that can only work in the dark. You have not made, as you claimed, a useful new kind of rangefinder.

If you were to actually measure what you are getting instead of just listening to the speaker, you would have realised that the results are too wildly inaccurate to be used for range finding. I really hate to rain on your parade (well may be just a bit but only because you were being a jerk the way you were teasing everybody earlier) but until you accept that subjective observation is worthless, you won’t get anywhere.

Objective observation means taking the time and effort to take painstaking measurements and then analyze them. For example the graph that I just posted for the behaviour of the motors of my Ozone robot showed me why it wasn’t possible to control modified servo motors accurately using the software that I’d been writing up to that point. Maybe I can still develop a sophisticated enough model of the motors to control them, or maybe not, but at least I am no longer guessing about why my control software didn’t work.

In the broader sense, this approach to solving problems is called The Scientific Method. Without employing it, the only inventions that you can come up with will be little better than snake oil.

Well… I have tested this in

Well… I have tested this in broad sunlight, and it works. Even in conditions where I cannot see the light myself.

Me, being a human, I cannot tell if there is 250 or 350 meters to something just looking at it. But I still drive a car. My robo’s purpose is not to measure distance excact (i’d use a laser distance meter) - but to navigate. And I think it is cool that you can see where it navigates (when the lights are off)

The example code of the SRF05 to the Picaxe has some calculations so you know how many inches or centimeters things are in front of it. I always strip that part of the code, I just need a number, and I make the robot navigate from that.

i understand and respect that you cannot cope with this way of thinking, you clearly belong to the clever side of us. However, I make a robot navigate and avoid obstacles with this… in broad daylight. Or at least I make it avoid falling off tables… in broad daylight.

So wrong or inacurate or whatever - I make robots, they navigate etc. And because of this method I can now make a robot that navigates using LDR and LED to measure distance (if you like it or not :slight_smile: You can deny it all day, it may not be right, but…

Cold Fusion

You may recall that Abraham Lincoln once said "You can fool all of the people some of the time, and some of the people all of the time, but you can’t fool all of the people all of the time."

The bit that President Lincoln left unsaid was that you can also fool yourself all of the time. People will always believe what they want to believe and people want to believe in themselves more than anything. Unfortunately for humanity as a whole, most people are unable to see scientific rigour as anything but an obstacle to the advancement of their own self-esteem. However it is still the only tool that we have for reliably choosing between reality and fantasy.

Anyway Fritsl, at the rate you’re going it’s only a matter of time before you invent a perpetual motion machine or cold fusion. You wouldn’t be the first and you certainly won’t be the last.

Nice one Frits!This setup

Nice one Frits!

This setup could very well make it into my new beer boat robot!

If you need faster response times than the LDR gives you, maybe you can use a phototransistor with an op-amp in a negative feedback setup like I did it here: https://www.robotshop.com/letsmakerobots/node/240. You can get phototransistors that have response times in the order of a few nanoseconds and then the bottleneck lies with the ADC in the PIC which I would think needs a few microseconds to do a conversion.

Let’s see… You produce
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…

Actually it turns out that a

Actually it turns out that a red LED is giving remarkably more signal than any other, including the White.

Infra red still not tested.

Yes, I can strongly recomend

Yes, I can strongly recomend the fritsl-2-cycle way of doing it for a line sensor. (Trying desperate to hang my name on my invention :wink: It practically makes it 100% self ajusting when we look at ambient light.

Regarding the Phototransistor; My local shop (Brink, I know you know it) sold me some, that I was going to use for the "real project" here. He wrote this down when he gave them to me: LD241G Phototransistor…! But something is wrong, google not know!?!

They look like little LEDs in every way apart from that they are sealed in a little brass cup, so only top of the glass is sticking up. 2 pins. I cannot make much sense out of their reading, how am I to connect & use? (If you have a long answer, please make a walk through on it, so people can find it withoug knowing it is in this post)

Thanks.

Dang! That’s what my own
Dang! That’s what my own tests showed too when I was working with LDRs, that red worked best. Then I read that article and figured that in the general case they ought to know better than me, which is why I corrected it.

digital to analogue conversion

The process of converting from the digital microcontroller outputs to the continuously varying (analog) power input of the LED is called digital to analog conversion or DAC. There are a whole bunch of different ways that can be done.

For example, if you have four output bits available you can write a number in binary from 0 to 15 on the four bits and then run that through a network of resistors (e.g. an R-2R network) to produce an analogue voltage. Another method is to use a dedicated chip such as analog switch or one of the programmable resistor chips that are available from Microchip’s website.

However in this case there is a really simple way to do it. You use pulse width modulation (PWM same as for motor control) to control the amount of power to the LED. Of course the LED will either be full on or full off but in this case it doesn’t matter. The response time of the LDR to changes in light levels is so slow (typically around 100 hertz tops) that it will average out the pulses from the LED. (Otherwise you would have to “integrate” the signal using a resistor/capacitor combination to smooth it out.) Generating PWM at one kilohertz or more is easy enough, especially with the specialised PWM hardware that PICs have on board.

 

Dare I say practice VS

Dare I say practice VS science? :smiley:

Sorry, I know it was too easy a joke to make, and you are already shot down because you could not figure out how I did it, and GroG could AHAHAaa… oh, sorry :wink:

This trip continues @

This trip continues @ https://www.robotshop.com/letsmakerobots/node/1807

 

A bit harsh don’t ya think.

A bit harsh don’t ya think. From what I read, Frits wasn’t trying to fool anyone, just trying to show a clever use of some simple parts. In fact he was throwing out a possible useful technique that may be useful to some of us. He didn’t claim it was the greatest thing since sliced bread, just that it was a different way to do similar tasks that with other devices would cost a bit more. I’m sure it’ll take a bit of tinkering to find out how best to use it and to test out the limits/collect data and such. That may be up to someone else to do that leg work. And his asking us to guess was a great exercise in figuring out how we could do similar. Kinda like a critical thinking exercise. He wasn’t going to hold the answer back from and it made people think and come up with some interesting ideas.

Ya know, I’ve got a great little equation that I worked on that calculates the min and max values for a servo based on an analogue reading. I’m sure it’s not new, it’s not even novel, but it’s kinda cool and from what I’ve tried, it works pretty good. I’ve not seen anyone post anything like it before so I feel pretty proud of it as I’m not a math wiz. (I’m also sure you could come up with it in 5 mins or less if you wanted to but for those who aren’t as versed in math it would be pretty useful I think) should I post it or would it be shot down as not novel or new…

look at what this site is about…being creative…and thats what he’s done.

 

I think that this is a slick

I think that this is a slick circuit that get’s outside the box in a rather unorthodox way - and on the cheap. Well done and VERY under budget, which is even better.

This might just fit the bill for a set of servo based grippers I’ve been planing -

Thank you and hell yeah

Thank you and hell yeah :smiley:

Long "I am clever and can write stuff so smart that perhaps I am the only one to understand it, you see" makes this a crap site. It is aimed to praise one self.

Enthusiastic "I have just discovered and want to share" lifts us all and gives good discussions, giving for everyone. It takes guts to write without fear, and it is aimed at sharing.

Possible TO-18 case?

The metal case with a lens on top sounds like a TO-18. There is an example here :

http://media.digikey.com/pdf/Data%20Sheets/Sharp%20PDFs/pt501.pdf

That sheet shows a little protrusion on the bottom of the metal case, that is near the emitter. Just put a resistor ( 1K to 10K ) on the positive voltage rail, tie the other end to the collector of the device, with a connection to read it, and then tie the emitter to ground. Shining light on it (of the right wavelength) should get a nice low, where no light should get a high.

Pretty cool idea for a sensor, I’d like to see your different trails to see how much range is possible.

Hey thanks a bunch, I’ll
Hey thanks a bunch, I’ll give it a go!

Fritsl you’re being very

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.