Thursday, October 4, 2012

Laser Sensor for Lego NXT

This sensor was made for experiments with triangular localization.
 For triangulation  we need to have three beacons and a sensor that can detect beacons. The laser sensor seems as the best solution for this experiment.


I was impressed by this video and wanted to reproduce this experiment.

I tried to make the laser sensor by replacing the LED of the Lego light sensor with the red laser I had bought on DealExtreme.


 I made beacons using GIO-Lite Reflective Material. It is composed of wide angle, exposed retro-flective lenses bonded to the durable cloth. The GIO-Lite Tape is 50 mm width and can be easily glued.


The sensor worked, but its sensitivity was not enough for triangulation. It could detect reflected light on distance about 1 meter. Also it was sensitive to ambient light. This problem with ambient light could be solved by using modulation of the laser beam, but the sensor's short-sight problem was still there.

 I found the Philo's Laser Sensor that worked well on long distances and filtered out the ambient light. It contained a lens to concentrate reflected light and a photo  IC to modulate laser beam and detect the reflected light. But his design was for Lego RCX. I decided to make NXT laser sensor using Hamamatsu S6986 Proximity Sensor  (also may be found here) and plastic lens. Also I bought the NXT socket.

 Circuit design


The S6986 works as a current generator for the LED but the value of its current can vary from  15 to 60 mA. The maximal current of 5 mW lasers usually is lower than 60 mA, typical value is about 35 mA. So it's important to check the output current of the particular photo IC before mounting it to PCB to make sure that the laser will not be damaged.
S6986 generates impulse current so you need to use an oscilloscope or a peak level detector to measure the cathode current.
If the measured current exceeds the maximal current of the laser diode, you can use the current adjustment scheme, described in the S6986 datasheet. This is more preferable than using a pull up resistor, because this scheme does not block the integrated current generator of S6986.

I don't have an oscilloscope and I've used the peak detector circuit to measure the voltage on precise resistors installed instead of the laser module.
Peak level detector

I measured the cathode current of my chips and found that it was about 25 mA. My laser modules had 82 Ohm pull up resistor to limit the current. I measured the current through the laser module when it was connected to 4 and 2 pins of the NXT socket (NXT produces a stabilized voltage 4.75V on these pins) and found that the current was 33 mA. I did not know the maximal current of my laser module, but its description contained information about working voltage (3.5 - 4.5V). Because the cathode current did not exceed 33 mA, I decided that it would be safe to remove the pull up resistor and connect the laser diode to the circuit directly.

PCB design (view from top)



I used SMD components to fit the circuit on the bottom side of the sensor's PCB. I used resistors with 0805 form-factor. The PCB size was 39.25 x 16.7 mm. I used a laser printer to print PCB layout and a hot iron to transfer the printed image to the bottom copper layer of the interface board. Then I used Ferric Chloride (FeCl3) to remove uncovered parts of the copper layer.

After mounting electronic components on the PCB I formed contacts of the S6986 to place it into the lens focus. I measured the lens focus distance and found that it was about 10 mm.
This diagram shows the main components of the sensor and how they are mechanically disposed.



Photos of assembled circuit


The next step was to make optical system.I needed to mount the lens.

But the first I needed to disassemble the  sensor case.

 I made holes in the top white part of the sensor to get access to the side locks.


The other way to disassemble the sensor - to slice the white plastic tabs.


Then I modified the Lego light sensor case - made holes for the laser module and the lens. It was a hard thing because of complex shape of the light sensor's case.



Assembled sensor images


The sensor detects usual objects up to 30 cm. The target covered by GIO-Lite or 3M Scotchlite reflective materials can be detected at distance up to 10 meters (probably more, but I did not tested it yet).

The sensor can be controlled by Lego LightSensor NXT-G block. Raw value 1023 means that the sensor is detecting the target. Low raw value (~90) indicates that the sensor is not detecting the target.

I use LeJOS, and I've tested the laser sensor using the LightSensor class. In this case sensor's output value about 90 (raw value ~95) means "no target", value "0" (raw value 1023) means "target detected".




7 comments:

  1. Wow excellent piece of work very inspiring and creative!I appreciate your creative work keep it up!! PCB Fabrication

    ReplyDelete
  2. Nice work, congratulations! Do you know where to get the S6986 Photo IC?

    ReplyDelete
    Replies
    1. Hi,
      I ordered it from Mark III Robot Store in 2010 year. Unfortunately it is back-ordered now. You may contact the store to get information about further delivery.

      Delete
  3. Hi, I have two questions ?

    1. If the laser diode not attached on S6986, Can this item detect laser beam from another source ?
    2. Is good for bright day sunlight ?

    Thanks you very much

    ReplyDelete
    Replies
    1. 1. No. S6986 modulates the diode current and removes background signal (not modulated with the same frequency and phase) when it analyses the sensor's values.
      2. I've tested it indoors with day sunlight. It works in this conditions. But I haven't tested it outdoors.

      Delete
  4. Hey Maxim, Thanks for sharing valuable content, keep it up...
    Redsensors

    ReplyDelete