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.

Laser_RF_MkII_upgraded_gearbox.jpg

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.

 

Laser_alignment.jpg

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.

http://blip.tv/file/1480764

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

http://blip.tv/file/1481127


 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.

 


20-11-08

 

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.

AttachmentSize
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.
The diodes in the motor control circuit and in series with the laser are 1N4004. Just a general purpose rectifying diode 1A 400V.

Hmmm, then why are they the pointed up arrow, instead of the downwards one? And in your picture of the actual board, I only see 3 diodes?

 

EDIT: Here is the Board file

 

http://i99.photobucket.com/albums/l303/_Corrupt_/LaserRangefinder.png

 

I am still trying to figure out how to make all wires take the fastest possible route, so it looks less sloppy.

 

The diodes to the relay are reversed because they are there to discharge reverse voltage spikes caused by the collapse of the magnetic fields in the relay coil and the motor windings. The doide across the coil is between the red led and the servo connectors. The other diode is between the relay and the two electrolytics. There are actually four upright diodes in the picture (click on the picture for a closer look) but I bypassed one.
It's a UGN3503UA hall effect sensor used to monitor the angle of rotation of the laser. You can see it in the picture of the sensor head mounted upsidedown in hotglue between the laser and the photodiode with blue,green and yellow wires attached. The sensor and it's amplifier could be replaced with a pot on the analog input. I was experimenting with this sensor and a small rare earth magnet because of its small size and no moving parts to wear. I use this setup on Juniors arm to monitor the position of the joints except that instead of an amplifier to increase the voltage swing I've used a seperate ADC and adjusted it's reference voltages.

 Untitled.jpg

What is the red squared thing in the schematic above?

 

Hey i was looking everywhere for the 1n004 phototranssitor amp you used, any idea where it is?
Sounds from Oddbots description that the 1N004 is like the 1N4004 diodes in US part numbers. Like the BCxxx transistors are similar to the US common 2N3904 and 2N2222. Common fast switching diodes are usually number 1N4148 or 1N914, Power rectifier diodes are the 1N4001 to 1N4004, common low power shottky diodes are 1N5817 or close.
You are correct as usual. It was a typo.
The phototransistor is amplified by an NPN and PNP transistor. You don't need the exact same transistors, any general purpose transistors with a hfe of at least 400 should do.

Thanks for a great bolg-entry. Amazing amounts of documentation! Enjoyed the videos as well :)

I don't have any building-time at the moment, but I am looking forward to pick this up - not as advanced, but it will be good knowing from whom I can get to know it all when stuck ;)