PIC control of IR laser module

Thread Starter

CollieJim

Joined Nov 27, 2004
34
My project is a driveway monitor which can sense the direction of traffic.
I'm using a PIC16F1827 for the smarts, and have 2 LM4 IR laser modules from Oatley Electronics. They work well under manual control but I cannot get them to work with the PIC. Specs for the modules do not appear to be available, and they are sealed. No switch, just red and white wires out the back end.

I've tried opto-couplers and OC transistors with no luck.
In test circuits I manually apply 4.5v to the opto-couplers and transistors in place of the PIC, and the lasers and power supply behave nicely. But once I connect them to the PIC, I only get about 1.5v across the modules and serious fluctuation in the power supply (LM317).

How can I control the modules?

Thanks
Jim

<SNIP>
 
Last edited by a moderator:

hgmjr

Joined Jan 28, 2005
9,027
If you have a schematic of you circuit, I suggest you post it so we can see how you are connecting the PIC to the laser.

hgmjr
 

Thread Starter

CollieJim

Joined Nov 27, 2004
34
GateMonitorPartial.jpg
This is a fair approximation. I know minor differences can have a large effect. I'll try to find a better library of components. This was done with ExpressSCH.

If I can get the lasers under control I will have a proper circuit board made.
 

hgmjr

Joined Jan 28, 2005
9,027
The phototransistor in the 4N25 optocoupler is only capable of outputting a collector current in the neighborhood of 2 millamps. You are going to need a proper laser driver stage to power the laser.

hgmjr
 

Thread Starter

CollieJim

Joined Nov 27, 2004
34
First, the test circuit is the same. I just disconnect the opto from the PIC port and manually connect the + input to Vss, and the opto passes enough current to work well.

Second, the component library I have does not have the proper device so I used the nearest I could find to show the logic and layout. The component I'm using is a Lite-On LTV-816 from Little Bird Electronics SKU COM-00314. Its description is
Rich (BB code):
Description: Opto-isolator with Darlington pair for controlling  large 
loads. This 4-pin dip can be used in conjunction with relays,  small motors,
 etc. to allow a simple microcontroller to turn on and off up to 50mA.
I will be more precise in the future.

Third, yes 6.3v is well above the maximum 3v for the device, but even with a supply of 6.3v I get only 1.7v across the laser.

I looked at the SparkFun device, and may well end up using it, but I would really prefer IR .

I could do the usual bit like TV remotes, but I want something immune to ambient outdoor light levels. The method chosen uses ADC and compares the results with the lasers on and off. It works well indoors with LEDs but I've not been able to test outside yet. The distance between laser and sensor is about 16m.
 

chrisw1990

Joined Oct 22, 2011
551
no i mean, can you not use the circuit from the spark fun device?
by the looks of it it just direct drives the transistor which controls the laser?
the little IC is only a regulator? out of curiosity, why have you used an opto?
 

hgmjr

Joined Jan 28, 2005
9,027
......the component library I have does not have the proper device so I used the nearest I could find to show the logic and layout. The component I'm using is a Lite-On LTV-816 from Little Bird Electronics SKU COM-00314. Its description is
Description: Opto-isolator with Darlington pair for controlling large
loads. This 4-pin dip can be used in conjunction with relays, small motors,
etc. to allow a simple microcontroller to turn on and off up to 50mA.
I will be more precise in the future.
I don't know the drive current requirements of the laser you are using but is is certain that the Lite-on opto will come much closer to driving it.

hgmjr
 

Thread Starter

CollieJim

Joined Nov 27, 2004
34
I read your posting again and realised that you were referring to the circuit, not the device.

It appears the key is the PNP transistor. Is it not the same, logically, as having an OC NPN between the laser's negative terminal and ground?

In any case, I think there may have never been a problem. The LM4 is mostly IR, but has a barely visible component. I tested again with Vss=3.0v. When powered manually, I could see the spot, but it is only partially powered by the PIC for some reason. Under manual control, the high side of the opto varied between 1.08v and 2.62v. Under processor control it is 1.13v to 2.6v.
I turned all the lights off for several minutes and was finally able to see the spot.

I thought I would need the isolation because I am using 5v for the PIC, 12v for a transmitter, and about 3v for the lasers. I'm sure there is a more efficient, lower component count solution but I'm rather new at this.

If I use 3v for the PIC, do I still need a resistor between the PIC and an opto? Is it safe to use a darlington array for the 12v bit?

Finally, with Vss=3.0, would it kill the PIC if I tried to drive the lasers directly from a PORT pin? The duty cycle is about 20% at about 75Hz.

Thanks for all the replies.
Jim
 

chrisw1990

Joined Oct 22, 2011
551
in terms of IR, most cameras i have at home can show up the IR part of the spectrum, so if you get a digital camera, aim the IR at the lens, you should be able to see it working.. (test the camera with a remote control first to make sure its sensitive to ir)
what i think is happening, if your circuit diagram is representative of your circuit, is that without a resistor in series, its screwing the supply, the use of the PNP and NPN is irrelevant as long it it is set up right i feel.dont drive the laser directly, what i think you can do, for a tried and tested circuit.. take the sparkfun circuit, remove all the extraneous rubbish, regulator etc. and take the transistor driving circuit, recalculate the values for the resistors, then you should be ok!
 

Thread Starter

CollieJim

Joined Nov 27, 2004
34
I tried the SparkFun circuit. The first time around it did not work. I increased the supply, but could not get more than about 1.9v across the laser, and I was getting up to 3.5v on the transistor's base (a BC307). I checked on the Internet, and found that the pinout I had for it was wrong. With a correct pinout, the second try worked.

The lasers work. Now I need to make them cooperate with the sensors and program...

It would be nice, however, to know why the opto failed. Does it matter whether it switches the positive or negative lead?
 

chrisw1990

Joined Oct 22, 2011
551
not sure, i would assume not, its better to work on the negative lead though, also, not sure if your previous circuit had a resistor in series with the laser or if it was accidentally omitted from the diagram?
 

Thread Starter

CollieJim

Joined Nov 27, 2004
34
No resistor.
I just got a 3.3v regulator (been using a LM317). It occurred to me that I should probably work out what resistance I need to limit 3v to 50ma - 60Ω.

I've reworked the circuit board so many times I don't know what's where, so I'm starting over with a new board that's a bit better organised.
 
Top