Discussion forum for the BasicX family of microcontroller chips.
|
Hi! I'm looking for a simple way to detect an object within 3 feet (for a mini-sumo robot) using IR LEDs and IR Photo Transistors. My thoughts before I breadboard it are to send a pulse out to the IR LED, then check the IR Transistor to see if it sees anything, and to repeat this process rapidly. Maybe something like: Sub ScanArea() DIM T1 as Byte, T2 as Byte, T3 as Byte, T4 as Byte, T5 as Byte ' IR LEDs on pins 5-8, IR Photo Transistors on pins 13-16 ' Array ObjDetect is a four element byte array (0-3) ' defined at the module level ViewDir = 0 Do T1 = 0 T2 = 0 T3 = 0 T4 = 0 T5 = 0 Call PulseOut(IRLED + ViewDir,0.01) T1 = GetPin(IRRcv + ViewDir) T2 = GetPin(IRRcv + ViewDir) T3 = GetPin(IRRcv + ViewDir) T4 = GetPin(IRRcv + ViewDir) T5 = GetPin(IRRcv + ViewDir) ObjDetect(ViewDir) = T Call Delay(0.05) ' Let other tasks have a go ViewDir = ViewDir + 1 If ViewDir > 3 Then ViewDir = 0 End If Loop End Sub This would run as a seperate task. I'm also looking to use as any as four sensors (one for each "compass" direction, N E S W) I thought I'd connect the Photo transistor via a small NPN transistor so that when it "sees" light, it returns a 1, dark returns 0. This would also increase the sensitivity. I'd rather use a Photo transistor than an IR receiver module, and use black heat shrink to shield it (also on the LED) to make it a bit more directional. Any suggestions, comments? Sloan |
|
|
|
Your major problem is that without modulating the LED and filtering the input reflected you will get readings that are affected by ambient lighting - That's why we use the IR demodulators. Your idea works fine if you are using downward looking edge detectors, but won't work well if you are using them for object detection. DLC wrote: > > Hi! > > I'm looking for a simple way to detect an object within 3 feet (for a > mini-sumo robot) using IR LEDs and IR Photo Transistors. > > My thoughts before I breadboard it are to send a pulse out to the IR > LED, then check the IR Transistor to see if it sees anything, and to > repeat this process rapidly. Maybe something like: > > Sub ScanArea() > DIM T1 as Byte, T2 as Byte, T3 as Byte, T4 as Byte, T5 as Byte > > ' IR LEDs on pins 5-8, IR Photo Transistors on pins 13-16 > ' Array ObjDetect is a four element byte array (0-3) > ' defined at the module level > ViewDir = 0 > Do > T1 = 0 > T2 = 0 > T3 = 0 > T4 = 0 > T5 = 0 > Call PulseOut(IRLED + ViewDir,0.01) > T1 = GetPin(IRRcv + ViewDir) > T2 = GetPin(IRRcv + ViewDir) > T3 = GetPin(IRRcv + ViewDir) > T4 = GetPin(IRRcv + ViewDir) > T5 = GetPin(IRRcv + ViewDir) > ObjDetect(ViewDir) = T > Call Delay(0.05) ' Let other tasks have a go > ViewDir = ViewDir + 1 > If ViewDir > 3 Then > ViewDir = 0 > End If > Loop > End Sub > > This would run as a seperate task. I'm also looking to use as any as > four sensors (one for each "compass" direction, N E S W) > > I thought I'd connect the Photo transistor via a small NPN transistor > so that when it "sees" light, it returns a 1, dark returns 0. This > would also increase the sensitivity. > > I'd rather use a Photo transistor than an IR receiver module, and use > black heat shrink to shield it (also on the LED) to make it a bit > more directional. > > Any suggestions, comments? > > Sloan -- --------------------------------------------------------------------- * Dennis Clark Mechanical Engineering Behavior Based Robotics * * www.verinet.com/~dlc Colorado State University * --------------------------------------------------------------------- |
|
|
|
Thanks Denis! Would it work better using the detectors instead, and sending out a 38-40khz pulse (depending on which detector)? Sloan --- In basicx@y..., Dennis Clark <dlc@v...> wrote: > Your major problem is that without modulating the LED and > filtering the input reflected you will get readings that are > affected by ambient lighting - That's why we use the IR > demodulators. Your idea works fine if you are using downward > looking edge detectors, but won't work well if you are using > them for object detection. > > DLC > <snip |
|
|
|
Sloan, If by "detectors" you mean the Sharp, LiteOn or Panasonic (or other) IR demodulators, then yes. DLC wrote: > > Thanks Denis! > > Would it work better using the detectors instead, and sending out a > 38-40khz pulse (depending on which detector)? > > Sloan > > --- In basicx@y..., Dennis Clark <dlc@v...> wrote: > > Your major problem is that without modulating the LED and > > filtering the input reflected you will get readings that are > > affected by ambient lighting - That's why we use the IR > > demodulators. Your idea works fine if you are using downward > > looking edge detectors, but won't work well if you are using > > them for object detection. > > > > DLC > > > <snip -- --------------------------------------------------------------------- * Dennis Clark Mechanical Engineering Behavior Based Robotics * * www.verinet.com/~dlc Colorado State University * --------------------------------------------------------------------- |
|
>Thanks Denis! > >Would it work better using the detectors instead, and sending out a >38-40khz pulse (depending on which detector)? Why not justy use something like the Sharp GP2D12 detector? available at www.acromane.com. Gives you distance in a 10 - 80 cm range pretty well, and requires one line of code on the BX. -- -- Tom Igoe |