Welcome to Laser Pointer Forums - discuss green laser pointers, blue laser pointers, and all types of lasers

Buy Site Supporter Role (remove some ads) | LPF Donations

Links below open in new window

FrozenGate by Avery

Circuit to control laser diode by an Arduino

If the driver has a cap in it, it should act against the sense resistor smoothing the voltage over it. However it may not do anything to smooth the current through the diode.

Basically, it is only possible to convert voltage by two means: inductance and charge-pumping. A LED won't mind, but a LD will as it is a lot less forgiving.

If there is a soft-start type LD driver connected on the output the situation is a bit different though. Then you are essentially using the drivers soft-start and cutting it off with the pwm to restart it, only letting it ramp up a bit. Even at low pwm and full ramp up the peak current will be limited by the driver and your power output will be adjustable "on average" but will still be full current for parts of the period and zero for the off part.
 





Somewhere I think there is a misundersdtanding between the two of us, and my example of arduino PWM controlled Current regulator, I'm gonna say the misunderstanding is on my part, but just in case.

I'm also assuming you are talking about my post using a LOW pass RC filter with a HIGH PWM frequency resulting in a DAC, which will control the transistor in the linear region making it act like a variable resistor, and the current sense resistor is just used (with some coding) to measure and limit how much current gets dropped across the transistor, also regulating the amount of current that the LD is getting, basicly like an over engineered LM358 current source like the examples here: Current source - Wikipedia, the free encyclopedia
Op-amp_current_source_with_pass_transistor.png


(picture courtesy of Wikipedia)
 
Last edited:
Hi All,

I tried the circuit from my post #13 and it appears to work ok, though PWM values between 1 and ~90 have the same on/off times. Anyway, I built up 3 separate circuits for 3 LD's but i noticed that the R4 sense resistance required to get a particular current value (200 mA) varied a lot from one circuit to the next ...something like 10, 8 and 3 ohms where i expected 10.5 ohms ( I think, don't have my notes here). In the lowest case there was about 2V across drain-to-source of the NFET and 0.7 v across the resistor where it was roughly the inverse in the other circuits (2.2V LD, 0.55V FET, rest across R4). I rebuilt it with different components (but same LD) and got the same values.

Kmor: I haven't had a chance to try your circuit from #14 yet. I'm not really sure how it works to be honest.... does the adc somehow set the current value you want and you then pwm to go from 0A to this current value?

Kreature: Would you put the inductance and diode in series with the LD? How do you calculate a reasonable value for the inductance?

All the best,

Alan.
 
I believe the code would look like:

void setup() {
analogReference(DEFAULT);
pinMode(9, OUTPUT);
TCCR1A = 0X82;
TCCR1B = 25;
ICR1 = 1600;
OCR1A = 0;
}

ontime = 0;

void Loop(){

if (AnalogRead(A0) < 40){
ontime++;
}

if (AnalogRead(A0) > 40){
ontime--;
}

0CR1A = ontime;

That right there should work, and it uses timer 1 channel A, if you try and copy this code I recommend using a 10uF cap, and a 500ohm resistor for R1 and C1, the TCCR1A/B, ICR1, and 0CR1A, are the timers registers and the only way I could get teh PWM functions I wanted from the timer, to allow higher frequencies and more accurate, duty cycle control, so far I've found with that schematic, and my transistor from 700 counts to 900 counts I get rougly 1mA adjustments per count, but after that it starts to be more like 2-3mA per count and I haven't gotten all the way up yet, as for the range with this code your duty cycle control is from 0 -1600 counts, so you can see how wide of a control range you would have.
 
Sorry Kmor2004 you are absolutely right. I am the one misunderstanding.
I did not account for C1 as there was no value on it. I assumed it was small.
Ofcource when you use the PWM abd R/C filter to form a DAC you are correct that it will be able to linearly control the transistor although it will only work for a certain region of voltage out and V+ can not be much different from Vcc for the avr.

Ideally in that circuit the reference for the transistor should be the supply so a inversion with a NPN controlling a PNP would have given a better range of control. That said, it's actually quite clever!

My driver uses a buck converter setup but it's not done yet as it's not safe regarding disconnect and such right now. Also, the turn-on current must not overshoot or rise too fast as it can damage the LD making it a LED.
 
alan
I would only put inductance in the drivercircuit if I wanted to convert the voltage that way instead of dropping it over the transistor as heat.

Inductance in a lm317 based regulator will cause overshoot.
In fact, caps on the output of a lm317 reg will cause overshoot too, and excessive current upon reconnect to LD if a momentary disconnect is experienced.

There should only be a cap (1µF or so) on the LD itself together with a 10k discharge resistor and a reverse protection diode which can also be a 4.7v or 5.1v zener to also protect it a bit from excessive forward voltage.
After LEDing a few LD's I ended up with this setup based on suggestions here on the forum and simulations in ltspice.
 


Back
Top