sensor spacing

jims

Senior Member
To FORUM robot builders...I've read several articles about line follower robots. Plan to build a line follower with 3 IR sensors. The articles indicate that optimal spacing of IR sensors is "Don't exceed the width of the line". Is this correct based on your experience? Any comments?? Thank you JimS
 

erco

Senior Member
Good question. Where's that article? Does it say that for 3-sensor bots?

The fast guys use 5-7 sensors spread ~2" wide. I think it all depends on your vehicle geometry (diff steering, car steering, etc) and also your line. Some folks put down black electrical tape, some of which reflects IR as well as white. I measure the best contrast with black magic marker on white paper, of course it's a PITA to make a wide line (1/2"-3/4") with a marker.
 

jims

Senior Member
Good question. Where's that article? Does it say that for 3-sensor bots?

The fast guys use 5-7 sensors spread ~2" wide. I think it all depends on your vehicle geometry (diff steering, car steering, etc) and also your line. Some folks put down black electrical tape, some of which reflects IR as well as white. I measure the best contrast with black magic marker on white paper, of course it's a PITA to make a wide line (1/2"-3/4") with a marker.
erco... yes there are 3 sensors. It's described in this article under "How is the line sensed"
http://embedjournal.com/programming-line-follower-robot/
Thank you for responding. JimS
 

hippy

Senior Member
Which makes sense, to make sure that one sensor sees the line at all times.
Otherwise, consider the case of the centre sensor over the track. If that comes off the track, you don't know if the track is to the left or right of the sensor.
Code:
       |   |                  |   |
  O    | O |     O          O |   | O      O
       |   |                  |   |
 

jims

Senior Member
Otherwise, consider the case of the centre sensor over the track. If that comes off the track, you don't know if the track is to the left or right of the sensor.
Code:
       |   |                  |   |
  O    | O |     O          O |   | O      O
       |   |                  |   |
hippy...my robot spins on itself, so when it goes off the end of the line and none of the 3 sensors detect the line, robot will spin around it's axis and look for the line. I expect it will see the line and try to follow it. If no line is detected at this point robot will stop. That's my plan...code I have written for this now simulates OK in PE6. Will try it live when I receive
the sensors.
 

jims

Senior Member
I'm having trouble finding an IR reflective sensor compatible with the Picaxe Digital input. Would like to use a statement like this and read 3 digital inputs at once.
( let b1 = pinsC nor %11111000 ). Are there digital sensors that will let me do this? Thank you, JimS
 

erco

Senior Member
Very smart to read 3 pins at once. You have many choices. You can DIY your own with some experimenting & elbow grease. I've used analog phototransistor/resistor voltage divider sensors as digital: the Picaxe sees below ~1.2V as low, above 1.2 as high. Purists here will cry foul, warning of oscillation and excessive current consumption but it works and I've never seen those heinous things: https://www.youtube.com/watch?v=eoprWPL32jo


Or you can buy "real sensors". Many types, many choices, digital and analog.

http://www.ebay.com/itm/5pcs-IR-Infrared-Obstacle-Avoidance-Sensor-Module-for-Arduino-Smart-Car-Robot/351806412075

http://www.ebay.com/itm/5Pcs-5V-Infrared-Line-Track-Tracker-Tracking-Follower-Sensor-Shield-For-Arduino/281843036427

https://www.pololu.com/product/2457
 

erco

Senior Member
That's a nice compact sensor, you should be able to get three of those in close proximity to follow a narrower line. Making a 1" wide line is a PITA IMO.

You'll have some fun experimenting to do to find best values for the LED resistor and phototransistor resistor. Do you plan to feed those analog values into a comparator, or straight into the Picaxe chip?
 

jims

Senior Member
That's a nice compact sensor, you should be able to get three of those in close proximity to follow a narrower line. Making a 1" wide line is a PITA IMO.

You'll have some fun experimenting to do to find best values for the LED resistor and phototransistor resistor. Do you plan to feed those analog values into a comparator, or straight into the Picaxe chip?
I'm planning to go straight into the chip (if it works). JimS
 

erco

Senior Member
I'm planning to go straight into the chip (if it works). JimS
Should work fine from all my tests. Now it's up to you to tweak the resistors to give you a big reliable voltage swing above and below 1.2V between seeing black & white. It will vary with sensor height above ground, as well as how reflective your white is, and how non-reflective your black is. Enjoy your empirical determination of optimal optical parametric coefficients!
 

jims

Senior Member
I've tested the OPTEK OPB606A sensor to determine if it can be use to consistently sense "0" & "1's" into a Picaxe 20M2 Digital Input. This photo shows the result of my testing using "off-the-shelf", 5% resistors. The values R1=1K, R2=10K, and R3=470 ohm work very well. With this approach I quickly read 3 sensors using the
"let b1 = pinsC nor %11111000" statement followed by a "Select case statement". In my mind sensing the tape is a positive so the "nor" inverts the 0 to a 1.
 

Attachments

erco

Senior Member
Well done! Now that you're a believer, let's spread the gospel. Feeding an analog signal into an input pin and using it like a comparator does not cause loss of hair, halitosis, oscillation/exploding, stock market crashes, chemical dependence, or alien invasions.

Well maybe an occasional alien invasion.

So what's next? Got a bot built to use this on? The sensor and calibration will depend on the distance above the surface and the black/white color consistency, obviously.
 
Top