IR compound eye
| Attachment | Size |
|---|---|
| Mr._General_4.bas | 17.21 KB |
I have posted some tip/walkthroughs on home made IR sensors for obstacle detection and later for motion tracking. Now DAGU proudly presents the IR compound eye. Designed to fit LMR's universal sensor bracket, this sensor works by shinning IR light onto an object and then tracking the reflected IR. This sensor does not work in bright daylight as sunlight has a lot of IR and blinds the sensor.The IR LEDs can be controlled by a digital output so that ambiant light as well as reflected light can be measured. Your microcontroller needs 4 analog inputs available to use this sensor. See a video of it working here: http://www.youtube.com/watch?v=iKYCob7getU
Note: calibration is not normally required, heatshrink is provided fo those who wish to fine tune their eye. A black permanent marker can also be used. Incorrect application can reduce the range of the eye.
This product is now sold at Robot Shop.
Click on the schematic for a bigger image.





@ Wed, 2010-07-21 02:29
So, how do I buy one of these things?
I'm probably missing something, but I don't see how to buy this. Since it has a price I'm assuming that can be done?
Thanks
Joe
@ Wed, 2010-07-21 03:03
Sorry about that mate
Dagu used to sell these directly to LMR. The are now sold by our distributors. DAGU now has it's own page at Robot Shop. You can find the eye here: http://www.robotshop.com/dagu-compound-infrared-sensor-4.html
@ Wed, 2010-07-21 05:51
Thanks
I took a look and Robot Shop wants more than it costs for shipping. UPS ground too (they've lost a thing or two for me in the past).
Thanks anyway.
Joe
@ Thu, 2010-02-25 10:27
Hi,Is there a way to make a
Hi,
Is there a way to make a sensor like this work in daylight ?
Regards,
Elch
@ Tue, 2010-01-05 08:29
currently 5cm range smooth tracking
The 5cm range is with the complete setup meaning the servos of the Pan/Tilt kit are moving and activly tracking.
Indeed when I display the values of the eye alone I can see objects from as far as 20+cm but I need to sacrifice some of this to make the tracking more stable. Right now the value of max_dist which is quite conservative and I'm sure that after spending some time with it I can easily increase the detection range. It just needs some more tweaking but I do not want to loose the smoothness of the tracking motion of the servos.
@ Tue, 2010-01-05 09:07
Fair enough
I admit, getting Mr. General to smoothly track an object was difficult and took many hours of experimenting. By subtracting ambient light readings from the readings with the LEDs on to get the reflected light from the object you will get more accurate tracking data from your eye but you will loose some sensitivity and thus range when ambiant light levels are high.
At China's Hi-Tech Fair our stand recieved a lot of indirect sunlight from overhead windows that reduced Mr. Generals detection range down to as little as 10cm.
@ Tue, 2010-01-05 03:31
5cm range?
without attempting to control servos, no heatshrink and just measuring the analog inputs you should be able to detect a white buisness card from about 20cm. If you can't then there is something wrong with the eye or your setup.
Since heatshrink does not need much to shrink it I just very quickly run the flame of a cigarette lighter over it. If you want you can also use a black permanent marker. If the heat shrink or pen is not setup properly then it can also reduce the range. Normally no calibration is required. The heatshrink is just for fine tuning.
@ Mon, 2010-01-04 20:47
Arduino code for compound eye
Hi guys,
I got the compound eye working on the Arduino you can find the code I used below. I'm not a programmer nor a robotics expert (working on my first robot based on a mr basic kit/pan tilt/compound eye). Basicly I just tried to understand what Oddbot did in his original code and replicated it in a similar way on the Arduino.
The setup is using a pan and tilt kit mounted with the compound eye. It's working but it's range is currently only about 5 cm. I did not add the heatshrink yet or the ambient light optimization yet. I was kind of wondering how you guys shrink the heatshrink without damaging the LED's.
I did also make the mistake initially to think the J1 indication on the PCB meant PIN1 was located next to it. After measuring I actually found it was reverse and then I noticed someone already talked about it in the thread Dohh
If you guys think the code listing polutes the thread I'll try to remove it.
There's a lot of serial communication in there as well but that's mostly for debugging and is commented out by default.
Just copy paste the code in a sketch and it should work
// Library inclusions
#include <Servo.h>
//VAR Declaration
//the time we give the sensor to calibrate (10-60 secs according to the datasheet)
int calibrationTime = 2;
int Pos_P = 0; // Variable to store Pan servo position
int Pos_T = 0; // Variable to store Tilt servo position
int Servo_Pan_Centre = 70;
int Servo_Tilt_Centre = 70;
int Servo_Min_Pos = 10;
int Servo_Max_Pos = 170;
int Pan_Scale = 0;
int Tilt_Scale = 0;
int Max_Dist=185; // Maximum distance to check against. This value was determined from sensor reading averages
int Best_Dist=400; // Best distance to check against. This value was determined from sensor reading averages
//VAR pin selection
int sensorPin_Top = 0; // select the Arduino input pin for the CompoundEye PCB IR pin 2
int sensorPin_Right = 3; // select the Arduino input pin for the CompoundEye PCB IR pin 3
int sensorPin_Bottom = 2; // select the Arduino input pin for the CompoundEye PCB IR pin 4
int sensorPin_Left = 1; // select the Arduino input pin for the CompoundEye PCB IR pin 5
int ledPin = 13; // select the Arduino output pin for turning on the compound eye PCB IR LED
//VAR sensorvalues
int sensorValue_Top = 0; // variable to store the value coming from the Compound Eye sensor(Top)
int sensorValue_Right = 0; // variable to store the value coming from the Compound Eye sensor(Right)
int sensorValue_Bottom = 0; // variable to store the value coming from the Compound Eye sensor(Bottom)
int sensorValue_Left = 0; // variable to store the value coming from the Compound Eye sensor(Left)
int sensorValue_Average = 0;
//VAR servo object creation
Servo Servo_Pan;
Servo Servo_Tilt;
void setup() {
// Serial.begin(9600);
Servo_Pan.attach(5); // assign pin for the Pan Servo
Servo_Tilt.attach(6); // assign pin for the Tilt Servo
pinMode(ledPin, OUTPUT); // declare the ledPin as an OUTPUT:
digitalWrite(ledPin, HIGH); // turn the ledPin on
// Center the servos
Pos_T=Servo_Tilt_Centre;
Pos_P=Servo_Pan_Centre;
Servo_Pan.write(Pos_P);
Servo_Tilt.write(Pos_T);
// Serial.print("calibrating sensor ");
// for(int i = 0; i < calibrationTime; i++){
// Serial.print(".");
// delay(1000);
}
// Serial.println(" done");
// Serial.println("SENSOR ACTIVE");
// delay(50);
//}
void loop() {
// read the value from the sensor and determine if the object is in range if not return the Pan/Tilt servos to the center:
sensorValue_Top = analogRead(sensorPin_Top);
sensorValue_Right = analogRead(sensorPin_Right);
sensorValue_Bottom = analogRead(sensorPin_Bottom);
sensorValue_Left = analogRead(sensorPin_Left);
sensorValue_Average = (sensorValue_Top+sensorValue_Right+sensorValue_Bottom+sensorValue_Left)/4;
// Serial.print ("sensorValue_Average="); // debugging code
// Serial.println (sensorValue_Average); // debugging code
if (sensorValue_Average < Max_Dist) {
if (Pos_T > Servo_Tilt_Centre) {
Pos_T = Pos_T - 1;
Servo_Tilt.write(Pos_T);
}
if (Pos_T < Servo_Tilt_Centre) {
Pos_T = Pos_T + 1;
Servo_Tilt.write(Pos_T);
}
if (Pos_P > Servo_Pan_Centre) {
Pos_P = Pos_P - 1;
Servo_Pan.write(Pos_P);
}
if (Pos_P < Servo_Pan_Centre) {
Pos_P = Pos_P + 1;
Servo_Pan.write(Pos_P);
}
}
// if the object is in range we need to start tracking it
if (sensorValue_Average > Max_Dist) {
Pan_Scale = (sensorValue_Left + sensorValue_Right) / 10;
Tilt_Scale = (sensorValue_Top + sensorValue_Bottom) / 10;
if (sensorValue_Left > sensorValue_Right) {
Pos_P = Pos_P -((sensorValue_Left - sensorValue_Right) / Pan_Scale);
if (Pos_P < Servo_Min_Pos) {
Pos_P = Servo_Min_Pos;
}
// Serial.print ("Going Left"); // debugging code
Servo_Pan.write(Pos_P);
}
if (sensorValue_Left < sensorValue_Right) {
Pos_P = Pos_P +((sensorValue_Right - sensorValue_Left) / Pan_Scale);
if (Pos_P > Servo_Max_Pos) {
Pos_P = Servo_Max_Pos;
}
// Serial.print ("Going Right"); // debugging code
Servo_Pan.write(Pos_P);
}
if (sensorValue_Top > sensorValue_Bottom) {
Pos_T = Pos_T -((sensorValue_Top - sensorValue_Bottom) / Tilt_Scale);
if (Pos_T < Servo_Min_Pos) {
Pos_T = Servo_Min_Pos;
}
// Serial.print ("Going Up"); // debugging code
Servo_Tilt.write(Pos_T);
}
if (sensorValue_Top < sensorValue_Bottom) {
Pos_T = Pos_T +((sensorValue_Bottom - sensorValue_Top) / Tilt_Scale);
if (Pos_T > Servo_Max_Pos) {
Pos_T = Servo_Max_Pos;
}
// Serial.print ("Going Down"); // debugging code
Servo_Tilt.write(Pos_T);
}
}
/* below is part of the experimentation code used to get a feel for the bestdist and maxdist values I hope it is self explanatory
of course you need the do the analog read in order to be able to display these values
Serial.print("Top Value=");
Serial.print(sensorValue_Top);
Serial.print("- Right Value=");
Serial.print(sensorValue_Right);
Serial.print("- Bottom Value=");
Serial.print(sensorValue_Bottom);
Serial.print("- Left Value=");
Serial.print(sensorValue_Left);
Serial.print("- Average value=");
Serial.println((sensorValue_Top+sensorValue_Right+sensorValue_Bottom+sensorValue_Left)/4);
delay(500);
*/
delay(30);
}
@ Mon, 2009-12-28 20:30
Noise in one of the outputs
Hi, i just got my eye and am testing it, something odd is happening though, one of the analog outputs gives me a lot of noise. it does respond to proximity of objects but its values are just noisy, while the other 3 are quite noise free...
any tip, or guess about what could be wrong? (everything came already soldered)
@ Tue, 2009-12-29 04:12
Noisy output.
It sounds like a bad or missing solder joint. Check all the solder joints, particularly around the 4K7 resistors and the 7 pin jumper. I am changing the way we do things here so that in future all prefabricated eyes will be tested thoroughly.
If the solder joints on the PCB look good then I would check your connections from the PCB to your processor.
@ Tue, 2009-12-29 12:37
bad solder joint
you were right :) thanks
it was the R6 resistor that had a bad joint.
i'm going to buy a solder sucker to desolder it and then sodler it again.
@ Mon, 2010-01-18 23:54
it seems that afterall the
it seems that afterall the problem is in the pin itself (pin1 or J2) can someone show me how to desolder these pins? i'm having a hard time trying to do so...
well i removed the pins now...
i'm testing with a multimeter and i get signal between all pins and any component that is connected to them in the diagram.. except on the first output pin (the pin hole now...) :p
is the pcb defective?
@ Wed, 2010-01-20 09:09
Need more information.
Please post a photo of the PCB front and rear with the suspect pin highlighted.
I doubt if the PCB is faulty as we have not had a bad one yet and they are all visually inspected and electronically tested at the factory. The only way the PCB would be faulty is if you have damaged it when de-soldering a component.
@ Wed, 2010-01-20 14:01
here they are... Yes i
here they are...
Yes i might of course have damaged it. I'm just asking for help to find out whats wrong, so that i can learn and try to fix it.
thanks
@ Wed, 2009-12-02 12:00
Similar problems recently
G'day mate, glad to see you got your package. It is strange, the first 15-20 robots we made had no problems but recently we have had similar problems. I am suspecting a bad batch of IR phototransistors as this problem has only occured in the last week or 2. As soon as I know for certain I will let you know. If it does turn out to be faulty components I will send you a new pre-tested eye.
Don't worry about the heatshrink too much. The eye will work fine without it. For those who wish to tweak the eye then the heatshrink when properly fitted can increase the sensitivity and range slightly.
@ Wed, 2009-12-02 22:38
Noob question
Is there a way to measure-thingy test an IR phototransistor?
I didn't add the corner edge detector bits (yet anyway) so I have 4 of the phototransistors remaining. I've got no problem swapping one of those in, I'd just like to be able to verify which one is bad, and know that the one I'm putting in is good (if it's indeed a wonky part issue).
@ Thu, 2009-12-03 02:53
They do work
I put these ones on a multimeter set to diode test and got readings from 0 to off the scale. At this point I have not determined the exact problem. It may be a PCB fault.
At any rate you need 8 good ones for the eye and it is just as easy for me to send you a new fully assembled and tested board as it would be for a few parts.
Once I work out the problem I'll let you know.
@ Wed, 2009-12-02 08:42
Playing with my Mr. General
Playing with my Mr. General kit today. Thanks OddBot!!!
I'm having a similar sounding problem as Wntrmute. I have verified I hooked pin1 to 5v and pin 7 to GND. I just keep on having the "top" receptors (Q7 Q8) giving me values around half of what the others do. No amount of tweaking heat shrinks has gotten that one to play nicely.
Here's a screenshot of the fake-o-scope showing at first the ceiling (6 feet + away), and then a white object at 100mm. The white trace is analog 0 on my Arduino, which is Q7-Q8. *edit* Oh, and the 4 IR leds were indeed on at the time of capture.

(click for larger version)
Photos of the board itself are available here, 2 to 3 MB each, please forgive the flash burn. The later ones are a bit better looking than the first ones.
Any ideas?
@ Thu, 2009-12-03 11:06
Ok yours is easy
I would say you have put too much heat on one of the 2 photo transistors for the top sensor. Because these are being soldered flat on the board it is very easy to damage them. With a batch of about 10 made by another assembler here I found similar problems.
I ended up soldering another one up myself and it works ok although the new batch do seem more sensitive than the previous batch.
In future we may get these PCBs machine made as they are easy to damage.
@ Thu, 2009-12-03 21:36
Cool, thank you for looking
Cool, thank you for looking into this. I'm not surprised that it's likely I overcooked something I just had no idea how to prove it. I'll desolder and swap in a new one from my leftovers.
Thanks!
@ Sat, 2009-11-28 00:23
Difficulties!
@ Sat, 2009-11-28 11:12
Sounds strange. Assuming you
Sounds strange. Assuming you have the power connected the right way with +5V to pin 1 and ground to pin 7 then regardless of pin 6 being high or low you should get variable reading as you move your hand within 100-200mm of the eye. Best results with pin 6 high.
Sounds like maybe some components have been put in the wrong way or damaged by heat during soldering. Can you post a closeup photo?
@ Sat, 2009-11-28 21:43
Based on the other posts I
@ Wed, 2009-12-02 11:32
...and having wired it up
@ Tue, 2009-11-24 21:19
range
hi could you tell me what sort of range the sensor can detect objects
@ Wed, 2009-11-25 04:02
Range depends on 2 things
The range that the eye can detect and track an object depends on 2 things.
1- Ambient IR such as daylight will reduce the range. This sensor works best indoors at night.
2- How well an Object reflects IR light. This depends on size and colour of an object.
With Mr. General, the robot can detect my hand from as far as 200mm depending on ambiant light.
When holding a white business card the robot can detect my hand from as far as 300mm.
For fast accurate tracking I program Mr. General to try and stay withing 100mm.
@ Fri, 2009-11-13 19:21
Connecting
I bought one of these a while back, but still didn't have time to play with it. I hope to hook it up this weekend. But I don't know how to connect it?! I know it takes 4 ADCs and I'm looking at the schematic. However I still don't quite understand this electronics mumbo jumbo so the schematic doesn't make much sense. I don't know what this J1 rectangle is supposed to indicate? I suppose they are the connections (1 x 5V, 4 x ADC and 2 x ground)? But then I'm not sure whether the 4 grounds at the bottom of the schematic are actually the ADC connections?!
Hope to get a few hints :/
@ Sat, 2009-11-14 13:51
Unfortunately I cannot teach
Unfortunately I cannot teach you to read a schematic in a post. For a start there is more than one way to draw a schematic. The schematic in this post is fairly international standard which is different to the way I normally draw them on Corel Draw.
Ground is always ground (0V) so no they are never ADC connections.
@ Wed, 2009-11-25 00:07
It ain't your job...
It ain't your job teaching me to read schematics, but unwillingly you just did anyway :D
Since one can connect 5V directly to an ADC I figured that the ADC is allready grounded so I didn't know. But know I do: Ground is ALWAYS ground!!
Besides after hooking up a couple of QRB1134 sensors recently I actually UNDERSTAND this circuit now (since it's also made from phototransitors and IR LEDs). Besides if I had bothered to open the bag the eye came in, look at the device and read the note that came with it I wouldn't have had to ask those silly questions to begin with. Sorry!
I do however have one thing I would like confirmed before I connect it:
It doesn't say the pin numbers on the board. So I've been trying to figure out which is pin 1 and which is pin 7. I presume that pin 1 is the one where it says J1 (like in the schematic) and pin 7 is the one closer to the PN100 transistor. Is this correct?
Thanks :)
@ Wed, 2009-11-25 03:51
Pin 1
@ Wed, 2009-11-25 04:21
Soldering?
The board I got came PRESOLDERED thankfully. I believe I even asked if that was the case before I bought it, because otherwise I probably wouldn't have bought it at all.
And I'm not sure what a "pad" means (excuse my english). I think it means the holes in the PCB for soldering components, but I'm not sure. Either way it doesn't help me determining which is pin 1 and which is pin 7.
@ Wed, 2009-11-25 06:01
you can see it in the photo at the top
If you look at the photo at the top you will see that the copper pad around pin 1 is square. Here is a greyscale photo which might be easier to see it in. My software is playing up at the moment so I can't insert an arrow or anything. Just below LED1 you will see the copper around the hole is square rather than round.
@ Sat, 2009-11-28 20:46
Ok!
@ Fri, 2009-11-13 19:50
J*number* seems to usually
J*number* seems to usually just indicates a header. So for that diagram, J1 is the 1x7 row of pins/solder pads/holes/whatever.
The 4 grounds at the bottom should just be grounds.They are likely already tied to the ground of the PCB, common with pin 7 of the header. They shouldn't be connections you have to make.
Pin1 is 5V, or whatever voltage you're running it.
Pins 2-5 (on J1) will be what connects to the ADCs. Looks like pin2 is Q7-Q8, pin3 Q6-Q5, etc...
Pin 6 appears to be the enable for the IR emitters. Looks like if you tie it to ground the IR LEDs stay on, or you can put it to a digital IO on the micro and switch the IR LEDs (turn em off to save power, or not interrupt your Sharp, or whatever)
Pin 7 is ground, which should just tie the other grounds in the diagram together into one point that connects to your micro's ground.
@ Fri, 2009-11-13 19:26
I've had the same questions.
@ Sat, 2009-11-14 13:43
Sorry for the confusion
J1 is the connector with 7 pins. You can tell pin 1 if you look at the PCB because the pad is square instead of round. As Rudolf has mentioned:
pin1 is Vcc (+5V)
pin2 is analog output (up)
pin3 is analog output (left)
pin4 is analog output (down)
pin5 is analog output (right)
pin6 is digital output (IR leds)
pin7 is ground
@ Tue, 2009-11-24 23:16
Risking more confusion
@ Tue, 2009-11-24 23:35
I believe he's referring to
@ Tue, 2009-11-24 23:45
Actually
it's more like this line that is wrong/confusing:
pin6 is digital output (IR leds)
Here is what I think:
pin1 is Vcc (+5V)
pin2 is analog output (up) -----> MCU analog input
pin3 is analog output (left) -----> MCU analog input
pin4 is analog output (down) -----> MCU analog input
pin5 is analog output (right) -----> MCU analog input
pin6 is digital input (IR leds) <----- MCU digital output
pin7 is ground
@ Sat, 2009-10-10 18:04
Size?
@ Sun, 2009-10-11 03:04
Dimensions
@ Sun, 2009-10-11 04:50
Nice...
That's small..now I'm definately getting one since I'm gonna order a batch of servos anyway..I sent a mail to Claudia allready :)
Thanks
PS: So I'll be translating you Picaxe code to Arduino soon...
@ Sun, 2009-10-11 10:59
Updated code
@ Sun, 2009-10-11 18:44
Cool..thanks
@ Sat, 2009-09-26 04:26
Very cool :)
I thought this was so cool that I took the liberty of sharing it with the Arduino community...
www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1253931667
I presume you wont mind, Oddbot?!
@ Sat, 2009-09-26 06:29
Thanks Mate :D
@ Sat, 2009-09-26 06:49
Awesome
Just want to say, awesome!! This is what I got into electronics for, designing stuff like that! I've got to agree, you're an icon!!:)
If you throw up the BAS file, I'll see what I can do to work it into an Arduino sketch for some sample code!:D
@ Sat, 2009-09-26 10:30
BAS file
@ Sat, 2009-09-26 07:43
BAS file
The BAS file can be found here:
http://letsmakerobots.com/node/10822
Just below the cute little bug.
It looks very simply. I think even I could translate it to Arduino even though I know squad about picaxe. But I don't have the time either these days so... Besides I don't have the compund eye to test it...
@ Sat, 2009-09-26 08:30
Hmm..just curious
Never saw this picaxe lingo before...So I am curious:
- You use the keyword "symbol" both for declaring constants AND variables?
- What does it mean when you assign a value like "b2" or "w6" to a variable?
- Also don't know what the first 4 lines do "#picaxe 28X1 #no_data #no_table setfreq em16"
Besides that I think I could translate it in a matter of minutes...
PS: No offence to anyone but I've been programming in c, c++, c#, java, javascript, actionscript, lingo, sql, asp (vbscript), php and visual basic. But I don't think I ever saw a language I disliked as much as this picaxe thingy... well ...perhaps visual basic/vbscript ... what a mess ... man am I glad I bought an Arduino ... hehe :)