Laser Range Finder MkII
November 17, 2008
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.
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.
This 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.
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.
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.