Hey - rock! I was having a hard time getting my project now named FritLDR fine tuned; I wanted this method to work also in harsh conditions, and it was a quesstion of ever tuning, I did not like that!
BUT THEN...!!! All the time I was turnig the LED(s) ON, and measuring, off, measuring.. THEN I just tried to make it ON/pause 10 mil sec / measure - OFF/pause 10 mil sec / measure and OMG!! NOW we are talking!
See the video of I just had the time to make before family called in.. This is not very powerful Green (the weaker) LED's. AND it is with a much smaller LDR.. AND it is STEADY!
(I am so happy :D)
This may very well also eliminate every problem with 50Hz light disturbing.. We are simply averaging it out by this slow measuring.. but it is still way fast enough for a bot to react!
Cool. I like a robot that flashes (visible) light to find it's way / check things!
So in addition to 220V you guys are also at 50 hertz? I didn’t know that… I knew you all used 220 with those huge plugs, but I never knew it was at 50hz. --Huh. By the by, we are 60hz over here in the states. You know, come to think of it, I seem to remember some military friends comming home from Germany and complaining that their clocks wouldn’t work. --It all makes sence now!
This device measures distance by calculating a difference in light reflection, right? And all the action and deduction is in the microcontroller.
I wonder if it is possible to yank all that logic out of the controller and pour it into electronics. Saving valuable i/o and cpu resources. All I want is one analogue input giving range or one digital input for detection of a preset proximity.
Now, I am not an electronics whizard. But this is how I see it. Using a R-C (resistor-capacitor) timer circuit, make the led cycle through the dark-lit sequence. Using the same timer, make the LDR read intensity, resulting in a current. Store this reading somehow somewhere, maybe as a charge in a capacitor. Store the second reading in a second place. Compare the two values, electronically. Feed the result to the controller’s input.
Strike that. It is way too complicated. How about: push a charge into the capacitor during the dark cycle. Then, use the ldr (which is after all a resistor) to draw the first charge from the capacitor during the lit cycle. Any remaining charge could be measured as the difference between the first (dark) charge and the second (lit) charge. Reverse the words dark and lit if necessary. Don’t forget to reset before a new reading can begin.