I am able to get fairly stable readings using the following approach. I pause for 600 microseconds, I then send the IR burst for 1 millisecond, I wait 275 microseconds and take the reading. I found that reading right after IR transmission stopped resulted in the sensor's output not always being reliable, but waiting a little bit seemed to give better readings. However, waiting a full millisecond got no reading at all because the sensor would acts as though it saw no IR.
I compared these results to the BOEBot sample code and they are roughly in line. This assuming that PBasic runs at about 4000 instructions per second, so each instruction takes roughly 250 microseconds. That roughly compares to a PBasic FREQOUT followed by a pin read.
This most excellent thread inspired me to dig out my Scribbler 1 to see if its onboard sensors could track a hand in 2D like this compound eye tracks in 3D. This brief code works quite well:
a:FREQOUT 14,1,38500
B0=IN6
LOW 14
FREQOUT 15,1,38500
B1=IN6
LOW 15
IF B0=0 THEN PULSOUT 12,1600
IF B0=1 THEN PULSOUT 12,2400
IF B1=0 THEN PULSOUT 13,1600
IF B1=1 THEN PULSOUT 13,2400
GOTO a
Seems like a fellow could get a parade of many Scribblers all following each other using this code. Probably how this was made: http://www.youtube.com/watch?v=hxMZQUKk8JU
Cool video Erco, I wondered if old blue could do that sort of thing. I've got something similar working with TankBot, but haven't had time to make and post a video. I'm thinking of trying to get the tilt/pan mechanism tracking before posting. It is there and might as well do something.
As my all-too brief code shows, I didn't do any frequency sweeps yet, but that's well possible. Yes, old blue S1 can still do a few tricks. That particular unit is an Ebay special I just got for $29. Now I have several S1's, so I may just have to try to get a parade line going. I suspect that the more robots are in line, there's more "Slinky" effect in the back, like a bad bicycle paceline.
It can certainly be improved hardware-wise, too. There's a lot of mechanical overshoot there, since the S1 motors are geared pretty high. I'll swap them out for lower geared motors for better... wait, that's another rant entirely !
School is in session and so is scouting, so I have been really pressed for time lately. I spent half of Saturday chasing 75 scouts around a field for our annual model rocket launch. So tonight I finally got a chance to make a video of my TankBot using the new IR eye design:
As you can see this eye design has much better zone separation. It also seems much more stable and consistent in its readings as well. What is particularly nice is that it only needs digital inputs, no A/D converter required like the previous design, yet it still yields a distance reading of 0 to 5 for each zone.
Thanks Erco. It is using a central 38 KHz IR sensor with four IR LED's that are frequency sweeped to estimate object presence and distance. I really like how this new eye works.
I bet you might be able to increase your range by dropping your IR LED's series resistance. Since they use pulsing current, you can overdrive them somewhat. You might need a transistor switch.
At the moment I am using proportional control with a 4 value running average of eye sensor values. The robot had a fair bit of jitters, so I programatically reduced sensitivity to eliminate them. I'm thinking if I went with a PID controller I could remove the running average and sensitivity reduction code as PID's integration component should smooth things instead.
However, increased range is always welcome for IR eye V3. Right now I'm using 220 ohm resistors which are the same values as the penguin's IR system. If I did use a drive transistor how low a resistance can I go without blowing the IR LED?
Also, I will shamelessly throw another link to the video on this post, so it is visible on this page of responses.
If I did use a drive transistor how low a resistance can I go without blowing the IR LED?
LEDs in TV remotes are regularly overdriven to achieve reliable long range control. You should be able to get a foot or more by increasing the drive current. How much? Reminds me of my favorite joke:
Take a look at the spec sheet at: http://www.optodiode.com/pdf/OD100.pdf
That's the datasheet for a nominal 100mw 880nm LED and gives duty cycle
curves. This particular diode is rated at 500ma for 100mw CW output
(with heat sink) and 10 amps for 10 microsecond pulses at 1 second or
less repetition at 1.3 watt output.
I've only used some in pulse mode synced with CCD camera shutters to
reduce image smearing while keeping the average power consumption and
the effective illumination roughly constant. Thats at a 30 hz pulse
rate. I haven't tried to push the limits.
For details of how they determine the curves the manufacturer's tech
reps would most likely discuss it with you. If not your other choice is
to do some destructive testing.
I've been avoiding the Propeller chip for general robotics because of the 3.3 volt interfacing issue. As a first step I want to redesign the first IR compound eye in this thread to work with the 3.3 volt propeller chip and use RC time to measure the phototransistor output voltage. I also want to go to five separate zones as I plan to use this as a floorboard to measure floor reflectance.
The first step is to redesign the IR LED illumination for five LED's and 3.3 volts. I think this will work and I will switch it via a transistor like the original so the propeller isn't providing the current:
Solution 0: 2 x 2 array, 1 extra LED
+----|>|----|>|---/\/\/----+ R = 6.8 ohms
+----|>|----|>|---/\/\/----+ R = 6.8 ohms
+----|>|----------/\/\/----+ R = 39 ohms
The wizard says: In solution 0:
each 6.8 ohm resistor dissipates 17 mW
the wizard thinks ¼W resistors are fine for your application
the 39 ohm resistor dissipates 97.5 mW
the wizard thinks ¼W resistors are fine for your application
together, all resistors dissipate 131.5 mW
together, the diodes dissipate 375 mW
total power dissipated by the array is 506.5 mW
the array draws current of 150 mA from the source.
The second step is to insert a sensing capacitor into the photocell section of the circuit
Neat videos. That is OddBot's work again, he is amazingly prolific. His initial thread on Let's Make Robots was the genesis for this thread's tank bot.
IR arrays are neat, but I've cooled on them a bit. They make a great demo, but they're on the twitchy side. Ambient light coupled with differing amounts of IR reflectance makes it hard to reliably interpret the data. Tank bot does a great job sensing small obstacles like wood on the floor in front of it, but will happily grind away into a large pitcher of water which doesn't reflect any IR.
Overall ultrasound has proven more reliable both in detecting objects and knowing their distance. So I'm using that in the 4x4 and my recent project.
So I've been working on a IR Compound Eye Mark III. There are two problems to solve with the old one. The first is that it is blind to some materials and the robot grinds away because it can't see them. The second is that the most useful zones are the sides and lower zone. The upper zone tends to go unused.
To address these I embedded a pair of whiskers to act as redundant sensors. To address the second I eliminated the top zone and expanded the bottom zone to a full fledged line sensor. I also redesigned it to work with 3.3 volts, got a new vehicle, and microcontroller to carry it. It took much longer to make than I thought it would, but here's what it looks like :
Further details will be in the projects area under the PropTank project.
Comments
Uh-oh. Can I say "bee's knees" under the new forum guidelines?
I am able to get fairly stable readings using the following approach. I pause for 600 microseconds, I then send the IR burst for 1 millisecond, I wait 275 microseconds and take the reading. I found that reading right after IR transmission stopped resulted in the sensor's output not always being reliable, but waiting a little bit seemed to give better readings. However, waiting a full millisecond got no reading at all because the sensor would acts as though it saw no IR.
I compared these results to the BOEBot sample code and they are roughly in line. This assuming that PBasic runs at about 4000 instructions per second, so each instruction takes roughly 250 microseconds. That roughly compares to a PBasic FREQOUT followed by a pin read.
@Gordon: Best use of the word "quiescent" in the past week, other than Popsicle: http://recipes.howstuffworks.com/question499.htm
a:FREQOUT 14,1,38500
B0=IN6
LOW 14
FREQOUT 15,1,38500
B1=IN6
LOW 15
IF B0=0 THEN PULSOUT 12,1600
IF B0=1 THEN PULSOUT 12,2400
IF B1=0 THEN PULSOUT 13,1600
IF B1=1 THEN PULSOUT 13,2400
GOTO a
and my video is at: http://www.youtube.com/watch?v=_M4sPnuu37U
Seems like a fellow could get a parade of many Scribblers all following each other using this code. Probably how this was made: http://www.youtube.com/watch?v=hxMZQUKk8JU
It can certainly be improved hardware-wise, too. There's a lot of mechanical overshoot there, since the S1 motors are geared pretty high. I'll swap them out for lower geared motors for better... wait, that's another rant entirely !
Check the video at the bottom. Nice IR sensing and use of mecanum wheels.
As you can see this eye design has much better zone separation. It also seems much more stable and consistent in its readings as well. What is particularly nice is that it only needs digital inputs, no A/D converter required like the previous design, yet it still yields a distance reading of 0 to 5 for each zone.
However, increased range is always welcome for IR eye V3. Right now I'm using 220 ohm resistors which are the same values as the penguin's IR system. If I did use a drive transistor how low a resistance can I go without blowing the IR LED?
Also, I will shamelessly throw another link to the video on this post, so it is visible on this page of responses.
LEDs in TV remotes are regularly overdriven to achieve reliable long range control. You should be able to get a foot or more by increasing the drive current. How much? Reminds me of my favorite joke:
Do old guys wear boxers or briefs?
Depends.
Depending on duty cycle, the particular LED, and the size of your cohones, you COULD go without any resistor at all. Some LEDs have peak currents well into the amperes. From http://www.natscience.com/Uwe/Forum.aspx/optics/2656/Pulsing-IR-LEDs-determining-max-drive :
Take a look at the spec sheet at:
http://www.optodiode.com/pdf/OD100.pdf
That's the datasheet for a nominal 100mw 880nm LED and gives duty cycle
curves. This particular diode is rated at 500ma for 100mw CW output
(with heat sink) and 10 amps for 10 microsecond pulses at 1 second or
less repetition at 1.3 watt output.
I've only used some in pulse mode synced with CCD camera shutters to
reduce image smearing while keeping the average power consumption and
the effective illumination roughly constant. Thats at a 30 hz pulse
rate. I haven't tried to push the limits.
For details of how they determine the curves the manufacturer's tech
reps would most likely discuss it with you. If not your other choice is
to do some destructive testing.
The first step is to redesign the IR LED illumination for five LED's and 3.3 volts. I think this will work and I will switch it via a transistor like the original so the propeller isn't providing the current:
The second step is to insert a sensing capacitor into the photocell section of the circuit
Will these modifications work? Any better way to do it?
Neat videos. That is OddBot's work again, he is amazingly prolific. His initial thread on Let's Make Robots was the genesis for this thread's tank bot.
IR arrays are neat, but I've cooled on them a bit. They make a great demo, but they're on the twitchy side. Ambient light coupled with differing amounts of IR reflectance makes it hard to reliably interpret the data. Tank bot does a great job sensing small obstacles like wood on the floor in front of it, but will happily grind away into a large pitcher of water which doesn't reflect any IR.
Overall ultrasound has proven more reliable both in detecting objects and knowing their distance. So I'm using that in the 4x4 and my recent project.
To address these I embedded a pair of whiskers to act as redundant sensors. To address the second I eliminated the top zone and expanded the bottom zone to a full fledged line sensor. I also redesigned it to work with 3.3 volts, got a new vehicle, and microcontroller to carry it. It took much longer to make than I thought it would, but here's what it looks like :
Further details will be in the projects area under the PropTank project.