Parallax Laser Range Finder

Parallax has a new relatively low cost laser range finder ($129). A 1Hz update rate and range is 15-122CM. It has a 5V serial interface with autobaud. The Parallax Laser Range Finder (LRF) Module is a distance-measuring instrument that uses laser technology to calculate the distance to a targeted object. The design uses a Propeller processor with firmware, CMOS camera, and laser diode to create a low-cost laser range finder. Distance to a targeted object is calculated by optical triangulation using simple trigonometry between the centroid of laser light, camera, and object.

PLRF

The red dot (Front left) is the camera and the laser is on the right. The back of the board contains the processor and interface circuits. The video below shows a robot using the LRF to avoid walls.

Parallax Robot demo using Laser Range Finder

LRF manual
PC LRF demo program and viewer

Using the Laser Range Finder with mbed

Just four connections are needed, power, gnd, serial RX (SIN), and Serial TX (SOUT)

Wiring

mbedlaser range finder
P10(RX)TX(SOUT)
P9(TX)RX(SIN)
VUVCC
GndGnd

It uses 150MA at 5V so VU can be used for power as long as other devices being used with mbed USB power need less than about 50MA.

LRFBB

Laser Rangefinder on breadboard with mbed

A simple 115K serial bridge program can be run on mbed to talk to the laser range finder using Parallax's PC demo application as seen in the screen capture below:

Import programEasyVR_SoundTableBridge

EasyVR Bridge Program to connect to PC using mbed and download custom sound tables at 115200 baud



Use the link above and download the serial bridge code to mbed (don't worry about the name - it's originally from another project). Start the serial bridge program on mbed and then run the Parallax application program on the PC. Connect to the COM port normally used by mbed for printfs, but use 115200 for the baudrate.

PRLF

Parallax LRF test program running on the PC using serial bridge code on mbed

Note that it is possible to also download a gray scale image from the LRF's camera as seen in the screen capture above and it will also track color blobs.

mbed LRF Demo Program

A basic demo program was developed to initialize the laser range finder and take range readings using mbed. The readings are printed out on mbed's virtual com port using printfs. A red Sparkfun box was used as a target. When it takes a reading the laser turns on as seen in the video below:

Laser Range Finder test demo setup taking readings

Here is the simple code used in the demo. The LRF module takes a couple seconds to power up and then does autobaud in response to "U" to set the baud rate.

#include "mbed.h"
//Demo program for the Parallax Laser Range Finder
//
DigitalOut myled(LED1);
Serial pc(USBTX, USBRX);
Serial lrf(p9,p10);

int main() {
    int mm_range=0;
    char lrfchar=0;

//Print prompt
    pc.printf("\f\nLaser Range Finder demo program\n\r");
//Delay for lrf power on startup
    wait(2.5);
    lrf.baud(115200);

// lrf autobaud setup
    do {
        lrf.putc('U');
        pc.putc('.');
        wait(.2);
        if (lrf.readable()) lrfchar = lrf.getc();
    } while (lrfchar != ':');
    pc.printf("\n\r");
    // clear out any extra characters - just in case
    while (lrf.readable()) {
        lrfchar = lrf.getc();
    }


// Loop taking range readings forever
    while (1) {
        myled=1;
        lrf.putc('B'); //Take Binary range reading
        // read in the four bytes for the range in mm (MSB first)
        mm_range=0;
        mm_range=lrf.getc();
        mm_range=(mm_range<<8)|lrf.getc();
        mm_range=(mm_range<<8)|lrf.getc();
        mm_range=(mm_range<<8)|lrf.getc();
        myled=0;
        //eat CR & ":" command prompt
        do {
            lrfchar=lrf.getc();
        } while (lrfchar != ':');
        //Display readings on PC Virtual Com port via USB cable
        pc.printf("Range is %d mm\n\r",mm_range);
    }
}



Import programLaser_Rangefinder

Demo program for the Parallax Laser Range Finder


When the demo code runs after an initial startup delay it takes continuous readings in a loop and outputs the range using printfs. The output from the program in seen in the screen capture below from RealTerm (a terminal application program for Windows running on the PC).

lrfd

Range readings from the laser range finder demo program

On a robot you might consider mounting the LRF on a servo to scan the room as seen in the first robot video demo.



More Advanced Laser Range Finders

If cost is not an issue, there are a number of faster scanning laser range finders that also have more range.

/media/uploads/4180_1/hokuyo-urg-04lx-ug01-scanning-laser-rangefinder-b.jpg
Hokuyo Scanning Laser Range Finders run $1-2K


/media/uploads/4180_1/neato-robotics-xv-11-vacuum-cleaner-b.jpg
The $400 Neato robot vacuum

The Neato robot vacuum uses a scanning laser range finder to navigate around rooms. It has been hacked, but it is relatively difficult.


/media/uploads/4180_1/lasertapemeasure-1-m.jpg

Another interesting idea is to hack a laser tape measure device.

/media/uploads/4180_1/opti-logic-range-finder-rs100.jpg

The Opti-Logic RS100 Laser Rangefinder has an RS-232 output with a 10Hz sample rate. Pricing runs around $350US.


Please log in to post comments.