Laser Range Finder - Porcupine Electronics LR3 - Anyone used it?

I'm looking for advice running a serial device (Laser Range Finder) from the arduino, or even just a starting point. I've been trying to use a serial version of this product that I've special ordered coupled with the required Fluke 411D.

http://porcupineelectronics.com/Laserbotics.html

The project is for a University level senior design project, and my team has been using a PIC32 up to this point. The PIC is giving us nothing but problems and we are switching to plan-B, Arduino. One of the biggest problems we've been having is making the PIC talk to the LR3 via Serial UART protocols. We have max 3232 chips between the LR3 and PIC. However, if we hook the LR3 up to a laptop directly and run it from hyperterminal, it works perfectly. We have double-checked the baud rate on the PIC, and it is correct. (9600, no flow control, 8 bits, no parody, 1 stop bit)

I personally know very little about serial communication and UART, but I am trying to find advice ahead of time before going down a long painful road and making the same mistakes we made with the PIC. I have an UNO currently for getting things going, but will be swapping out for a Mega as soon as it gets here. (I need a few more interrupt pins)

If anyone has advice on using these types of serial devices, or has used this particular device, I would greatly appreciate the help.

no parody

Oh my!

Can you post what you have?
It sounds like you've got one too many (or one too few!) inversions due to RS232 level converters, but it is hard to say.

Presumably you have access to an oscilloscope?

Thanks for the reply!

Here is the C code we are currently playing with. I will check the convertors like you mentioned.

#include <plib.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>

// set mplab configuration bits
#pragma config FPLLIDIV = DIV_2, FPLLMUL = MUL_18, FPLLODIV = DIV_1
#pragma config FNOSC = PRIPLL, FWDTEN = OFF, FSOSCEN = ON
#pragma config POSCMOD = HS, FPBDIV = DIV_2

// system clock set to 72 mhz (8MHz crystal / FPLLIDIV * FPLLMUL / FPLLODIV)
#define SYSCLK 72E6

// set baudrate of RS-232
#define DESIRED_BAUDRATE 115200
#define DESIRED_LASER_BAUD 9600
#define UART_WAIT_TIME 72E6

// sizes
#define MESSAGE_SIZE 50
#define MIN_DISTANCE 300 // about 1 feet in mm
#define MAX_DISTANCE 3000 // about 6 feet in mm

// #define
#define LOW 0
#define HIGH 1
#define NO 0
#define YES 1
#define OFF 0
#define ON 1

// motor degrees and counts
#define DEG_360 3200
#define DEG_45 100
#define DEG_60 534
#define DEG_90 800
#define DEG_180 1600

// laser
#define LASER_DISTANCE_SIZE 7
#define LASER_REPLY_SIZE 8
#define LASER_ON 'g'
#define LASER_OFF 's'
#define LASER_WAIT_TIME 72E6

// states
#define WAIT_FOR_MESSAGE_STATE 0
#define CONFIRM_MESSAGE_STATE 1
#define PC_ZERO_POSITION_STATE 2
#define PC_LASER_MEASURE_STATE 3
#define SC_SCAN_TRENCH_STATE 4

// messages
#define NOACK "NOACK\n"
#define ACK "ACK\n"
#define PC_ZERO_POSITION "PC_ZERO_POSITION\n"
#define PC_LASER_MEASURE "PC_LASER_MEASURE\n"
#define SC_SCAN_TRENCH "SC_SCAN_TRENCH\n"
#define DONE "DONE\n"

// ports and pins
#define LED BIT_0
#define SLEEP BIT_1
#define MS1 BIT_2
#define STEP BIT_3
#define DIR BIT_4
#define ENABLE BIT_5
#define MS2 BIT_6
#define BUTTON BIT_7
#define RESET BIT_0

#define CHA PORTDbits.RD6
#define CHB PORTDbits.RD7
#define LASERSTEP PORTEbits.RE3

// global vars
int encoderAngle = 0;
int falseAngle = 0;
int spinMotor = 0;

// function prototypes
void DelayMS(unsigned int time);
void laser(int input);
void calibrateLaser(void);
void intToString(int integer);
void zeroLaser(void);

int main(void)
{
	// initialize variables
	int pbClk = 0;
	int state = WAIT_FOR_MESSAGE_STATE;
	char msgBuf[MESSAGE_SIZE];
	char distanceBuf[LASER_DISTANCE_SIZE];
	int distance = 0;
	unsigned int msgLength = 0;
	int counter = 0;
	int shortestDistance = 0;
	int shortestDistanceAngle = 0;
	int distancesToCheck[10];
	int difference = 0;
	int distances[10];
	char negAngle[10];
	char posAngle[10];
	double negAngleDouble = 0;
	double posAngleDouble = 0;
	int numPulsesNeeded = 0;
	int stopAngle = 0;
	char data[15];
	int tempAngle = 0;
	int i = 0;
	int errorValue = 0;

	// configure PIC32 for maximum performance
	pbClk = SYSTEMConfigPerformance(SYSCLK);

	// set all pins on port E to out except 7
	PORTSetPinsDigitalOut(IOPORT_E, LED | SLEEP | MS1 | STEP | DIR | ENABLE | MS2);

	// set pin 0 to output on port F
	PORTSetPinsDigitalOut(IOPORT_F, RESET);

	ConfigINT3((EXT_INT_PRI_6 | EXT_INT_SUB_PRI_0 | RISING_EDGE_INT | EXT_INT_ENABLE));
	ConfigINT4((EXT_INT_PRI_5 | EXT_INT_SUB_PRI_0 | RISING_EDGE_INT | EXT_INT_ENABLE));
	ConfigINT0((EXT_INT_PRI_4 | EXT_INT_SUB_PRI_0 | RISING_EDGE_INT | EXT_INT_ENABLE));

	OpenTimer1(T1_ON | T1_PS_1_8, 9000); // open a timer using a prescale value of 8 count to 9000 to get an interrupt every 1 ms
    ConfigIntTimer1(T1_INT_ON | T1_INT_PRIOR_7);

	INTEnableSystemMultiVectoredInt();

	INTEnable(INT_INT3, INT_ENABLED);
	INTEnable(INT_INT4, INT_ENABLED);
	INTEnable(INT_INT0, INT_ENABLED);

	INTEnableInterrupts();

	// open UART channel for RS-232 communication
	OpenUART1(UART_EN, UART_RX_ENABLE | UART_TX_ENABLE, pbClk/16/DESIRED_BAUDRATE - 1);
	OpenUART2(UART_EN | UART_IDLE_STOP | UART_RX_TX | UART_DIS_WAKE | UART_DIS_LOOPBACK | UART_DIS_ABAUD | UART_NO_PAR_8BIT | UART_1STOPBIT | UART_IRDA_DIS | UART_MODE_FLOWCTRL | UART_DIS_BCLK_CTS_RTS | UART_NORMAL_RX | UART_BRGH_SIXTEEN, UART_INT_TX | UART_TX_PIN_LOW | UART_TX_ENABLE | UART_RX_ENABLE | UART_INT_RX_CHAR | UART_ADR_DETECT_DIS, pbClk/16/DESIRED_LASER_BAUD - 1);

jmamer:
I'm looking for advice running a serial device (Laser Range Finder) from the arduino, or even just a starting point. I've been trying to use a serial version of this product that I've special ordered coupled with the required Fluke 411D.

The site you pointed to shows the LR3 as a USB device, not a Serial device. You'll probably need a USB Host shield to talk to it.