Laser communication to BASIC Stamp 2

I'm trying to send text files via laser to a BASIC STAMP 2, with an Arduino Duemilanove as transmitter. I connected the serial pin of the Arduino to a transistor which switches a laser on/off to send data, and I have a photo-resistor on the receiving end. The photo-resistor is attached to a comparator circuit using a LM339 comparator. The output finally is attached to the BASIC Stamp serial input pin, which prints the data to the screen using the SERIN function.

Anyway, the setup works fine at baud rates 300 and 600. However, once I change the rate to 1200 or 2400, I only get gibberish on the receiving computer (BASIC stamp side). Any ideas one why this is happening? Any help would be appreciated. Thanks!

Heh. Wild experiment.

Off the top of my head, and bear in mind... I've certainly never tried to send data via laser before. But I'd expect that the time it takes to turn the laser on and off is the problem. Are you using a diode or an actual laser? It may simply not be possible to turn it on and off fast enough.

TeslaFan: Heh. Wild experiment.

Off the top of my head, and bear in mind... I've certainly never tried to send data via laser before. But I'd expect that the time it takes to turn the laser on and off is the problem. Are you using a diode or an actual laser? It may simply not be possible to turn it on and off fast enough.

Maybe - maybe not; the fact that bob800 claims to be using a photo-resistor (LDR, CdS cell, etc), rather than switching a photo-transistor (which will have a faster response/recovery time than the photo-resistor) might also be part of the problem...?

As always, though, bob800 should post schematics and code - for both ends - and it will help all of us immensely to help him track down this issue.

/side note: Why is posting schematics and code such a difficult thing to get people to do?

Thanks for the suggestions!

cr0sh:
As always, though, bob800 should post schematics and code - for both ends - and it will help all of us immensely to help him track down this issue.

Here’s the code for the transmitter end:

char c;
void setup()   {                
  Serial.begin(300);
}


void loop()                     
{
	if (Serial.available() > 0) {

		c = Serial.read();
                if (c=='@')
                {
                  Serial.println("\n");
                }
                else
                {
                Serial.print(c);
                }
}
}

The receiving end (in the BASIC stamp’s PBASIC 2.5 language):

' {$STAMP BS2}
' {$PBASIC 2.5}
letter   VAR     Byte
Main:
  DO
    SERIN 1, 3313, [letter]
    DEBUG letter 
  LOOP
  END

See the attachments for schematics of the overall setup and the comparator circuit (which I just scanned out of Basic Electronics by Forrest Mims III). I’m using the exact same circuit, except I replaced the buzzer with the BASIC stamp serial pin and ground.

Any more suggestions would be greatly appreciated!

laserSetup.bmp (405 KB)

circuit.pdf (90.3 KB)

cr0sh: Maybe - maybe not; the fact that bob800 claims to be using a photo-resistor (LDR, CdS cell, etc), rather than switching a photo-transistor (which will have a faster response/recovery time than the photo-resistor) might also be part of the problem...?

Of course I can't find the exact site I stumbled upon before but have read an article a few months ago exactly claiming the same.

I'm not familiar with laser, the one used in the article was an el cheapo 5mW laser pointer.