Let's Make Robots!

Laser Range Finder MkII

This is my second attempt at a homemade laser range finder now with video. I nearly gave up after hearing about the Sharp IR sensors but I think this has potential as it focuses on an area the size of a laser pointer spot. The other sensors work on a much larger area. After a lot of frustration I've finally got all the circuitry working properly and hope to have a video posted as soon as I work out one last difficulty. Click on the photo for a full sized image. This is a work in progress, not a finished product. I hope that by posting this blog I'll encourage you to experiment with the idea and hopefully you can suggest ways for me to improve it. I've now atached the subroutine used to test the scanner. It assumes only one object in scanning range and averages results.

Laser_RF_MkII_PCB__small_.jpgThis is the PCB which is 47mmx72mm (1 and 7/8" x 2 and 7/8"). I've attached the latest schematic for anyone interested. You will see I've crammed a lot into this little board.

Originally I designed this with a Picaxe 08M but have upgraded to a 14M. The increased ability to work 4 servo's makes it a small robot in it's own right and well worth the small increase in price.

This circuit could be made smaller and easier to program and build if you use a servo to aim the laser. You can then eliminate the hall effect sensor, it's amplifier and the laser scan motor control circuit. The down side is your resolution is limited by the servopos command to a range of about 100. This might still be a good place to start and I've included this version of the schematic as well.

I've opted to effectively make my own servo using a hall effect sensor for positional feedback. With its output amplified to give me almost 0V-5V output over the entire range of movement of the laser I effectively get 10x the resolution using the readadc10 command.

Word of warning to anyone making either version, a regulated 5V supply is critical for the phototransistor amplifier. I spent many hours trying to workout why the amplifier worked in the begining but not after I sorted out a few other problems with unrelated parts of the board. My batteries were getting flat and at that stage I was not using a regulator. The 4.7V was fine for the picaxe and all the other circuits but the biasing voltage on the amplifier transistors had dropped enough so that only the strongest signals registered. I recomend using a LM2940CT low dropout regulator, they are more expensive but will give a steady 5V even when your batteries are down to about 5.5V.

While on the subject of the phototransistor amplifier, I should mention that it needs a pulsating laser to register due to the coupling capacitors linking the stages. For this reason I have the laser fired by the same PWM output that drives the scan motor with a frequency of 4KHz. I found this was about as low as the picaxe would go and made it easier in the code to change dutycycle. with the period se to 249, the dutycycle in the code was 10x higher, e.g. 50% was 500.

Because PWM and servo commands use the same timer, you have to turn off the servos while the laser operates and turn the PWM off when operating the servos. Please feel free to suggest any improvements / changes. since the frequency and dutycycle aren't critical for the laser, it just needs to pulse at around 10%-50% duty cycle. I feel there is room for improvement.

Laser_RF_MkII_sensor_head__small_.jpgThis the sensor head for the MkII and my one remaining problem. I've tried to keep this as small as possible. I'm using a turret gearbox and motor from a tabletop remote control tank. I'm using a hall effect sensor (see the component section) and a small magnet (3mm dia. 2mm long) to monitor the angle of the laser.

My current problem is that the laser moves too quickly and when I drop the pwm dutycycle enough to slow it down, the motor stalls.

I'm presently trying to fit a more powerful motor from a toy helicopter so I can keep the small gearbox

For those of you who want to attempt the more complicated version of this, I suggest trying a mini servo such as the Hextronik HXT900 which are quite cheap and have a more powerfull motor.

Convert it to continuous rotation, remove the control circuit so you just have a small motor/gearbox and then mount the laser and hall effect sensor.

No matter what gearbox you use, you need to be able to scan the laser through about 45-60 degrees slow enough for the picaxe to register all 1000+ positions that your ADC/sensor setup is capable of producing. For example, if you are rotating your laser over 60 degrees then 30rpm would still be three scans a second considering you can scan just as well clockwise as anti-clockwise. If your using a faster processor or programming a pic in it's native risc language then you can probably scan a lot quicker.


This is my upgraded gearbox, the new motor should hopefully handle lower RPM without stalling. This huge monster is all of 16mm long compared to the 12mm of the previous motor and a whopping 1mm wider than the 6mm of the old motor. Hmm... that was exciting :(

Good news, the bigger motor can run at about half the speed of the original. Still started with a dutycycle of 8% with the laser mounted. This might work yet.














Make certain your phototransistor is aligned with your laser or your rangefinder will be short sighted. This is how it should look side on.



I think this was a problem I had with the first model and was made worse to some extent when I added a lense because I then had more optical components to align.


Updated 18/11/08


Was doing some test and rediscovered / confirmed that background light improves the sensitivity of the photodiode. I have tried previously to use the base pin on the phototransistor to bias it so as to improve sensitivity but with no success. I'm now looking at using an IR led to boost sensitivity.

I also discovered that a glossy object at the point of most sensitivity caused the oscilloscope waveform to vibrate in response to the slightest sound/vibration. This must be how those spy systems work where they shine a laser onto a window and listen in on conversations. I would have videoed this but my video quality isn't good enough to show the results on the oscilloscope.

I've uploaded two videos, still haven't got them to display properly so I've added the links below and a forum asking for help with the video. This is the first time I've made/posted videos so please be patient.


The first shows the signal from the sensor/amplifier that is feed to the digital input of the picaxe.


The second video shows the laser scaning and an object being detected.


 Updated 19-11-08

I'm not getting the range or resolution hoped for. I think range is an alignment issue so I'm going to build a more precise sensor head with the ability to calibrate the alignment. As for the resolution, some of this is just a matter of calibrating the hall effect sensor amplifier.




I've recently added the datasheet for my phototransistor but I've realised that they are not easy to find and other phototransistors may not work with this circuit. This is where I got my phototransistors from, I believe they do ship internationally although that might be expensive.

Although I'm quite happy with my phototransistor / amplifier my biggest problem is mechanical. Optical alignment is very important but also precision movement / position sensing is critical for accurate range finding with good resolution.

I think the MkII has gotten as far as is worth pursueing but has been very educational.

Thanks to previous work done my Mintvelt on object tracking and BOA's comments on potential flaws in this design I now have a MkIII design to start building which should be able to track an object as well as determine range. Poor Junior and BoozeBot will never get finished at this rate.

Keep an eye out for the MkIII.

laser_scan.BAS1.2 KB
Complete_LRF_Schematic.jpg201.83 KB
Simple_LRF_Schematic_II.jpg142.06 KB
LRF_modified_schematic.jpg202.51 KB
BPV11_phototransistor.pdf114.7 KB

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Yup. A corss-eyed laser rangefinder. That's what I'm thinking.

The laser rotates while the sensor is stationary.

If you setup a laserpointer and point it at a chair for example, you can see that dot from a wide range of angles because the chair scatters the beam in all directions.

A mirror or a glass on the otherhand may be a problem as they will tend to redirect the beam rather than break it up and scatter it.

So far this has worked with me moving the laser by hand, my only difficulty now is scanning the laser through about 50 degrees slowly enough for the picaxe to take advantage of the high resolution feedback of the hall effect sensor.

I should have some video in the next 24hrs if all goes well.

Is it still the case (as per the mark I) that the laser moves relative to the photosensor? This principle, I understand.

In the photo, it looks like the laser and teh sensor both pan. No. That can't be right. Surely the photo sensor is fixed, yes?

The whole head is then mounted on a scanning servo?

In your schematic, did you mean AAA batts, or is it different with NiMh batteries?

AA is the size of the battery I'm using and NiMh (Nickle Metal Hydride) is the cemistry of the rechargable battery as opposed to NiCd (Nickle Cadnium). In the schematic I'm showing the battery used by Junior.

Overall it doesn't matter greatly what batteries you use.

I can;t wait to see the final result.

Did you have any diffuculties alligning the laser and the transistor? I don't know what range you have in mind, but I can imagine that if you're aiming for a range of 60 to 100cm you need to align it pretty precise. 

try some mirrors to increase the range. A parabolic mirror with the laser in front and the detector picking up off the second reflective mirror much like a telescope. The mirror make have tobe coated with a diffrent matteral that is more supsecpable to the freq you are using.

I'll be happy with a meter range but with perfect alignment you should get more.

I'm still thinking about your idea for object tracking. That was brilliant. I can't afford those sharp sensors, they're expensive over here but I might be able to get a version going using my IR version of Fritz's LDR. I hope to post some videos soon but all my projects are suffering setbacks.