this post was submitted on 18 May 2026
19 points (95.2% liked)

Ask Electronics

4142 readers
1 users here now

For questions about component-level electronic circuits, tools and equipment.

Rules

1: Be nice.

2: Be on-topic (eg: Electronic, not electrical).

3: No commercial stuff, buying, selling or valuations.

4: Be safe.


founded 3 years ago
MODERATORS
 

Hello everyone, We have a problem with a circuit we built. The circuit seems to work properly with a green laser diode (130mA, lower voltage). With the red laser (higher voltage) on the other hand, the circuit delivers only 60mA max of the 130mA it should be giving the laser.

The problem seems to be the transistor's resistance because it works properly if we bypass the transitor and give +5V to the LM317.

Is it this assumption correct?

We tried a few transistors (BC241, BC236, TIP41C and TIP41) but with no luck. Is there a way to find a drop-in replacement for the transistor? MOSFET seem to have lower resistance but require an external driver with Arduino.

We need to use the Arduino PWM with these drivers, so at least 980hz switching frequency is needed.

Thanks in advance

Link to the schematics

top 13 comments
sorted by: hot top controversial new old
[–] jeinzi@discuss.tchncs.de 8 points 1 week ago (2 children)

I don't know much about lasers. Also, I don't entirely understand your schematic. What is connected to J5 and J6?

That being said, my first thought is: Why you are using an NPN transistor for high-side switching? I would try switching it out for a PNP. If that still does not work, then a p-channel MOSFET. There are more than enough FETs btw that don't need any external driver for use with an Arduino, or even with 3.3V systems.

[–] lemmyman@lemmy.world 4 points 1 week ago* (last edited 1 week ago) (2 children)

This is 100% the issue. OP should move to low side switching with NPN BJTs or N-fets for the simplest fix. The arduino IO is 3.3v so they won't be able to fully turn off a pnp (without extra circuitry).

Also, I'll just note: lm317 dropout voltage at 60 mA will be about 1.5 V. The adj pin will be another 1.25V. So there is only going to be about 2.25V available to drive the load. Minus whatever drops there are through the pdn and transistors. I don't know what a typical Vf for a laser diode is, but I wouldn't be surprised if OP isn't getting the drive current they want.

[–] jeinzi@discuss.tchncs.de 4 points 1 week ago* (last edited 1 week ago) (1 children)

The Arduino Nano uses 5V logic, so PNP/PMOS should work.

[–] lemmyman@lemmy.world 2 points 1 week ago

My bad, thanks for the correction!

[–] TDSOJohn@lemmy.world 2 points 1 week ago (2 children)

Low side switching is not an option unfortunately. Are the N-fets a solution to the transistor voltage drop?

Also, do you think we should be looking for a replacement for the LM317 for future designs?

[–] jeinzi@discuss.tchncs.de 2 points 1 week ago* (last edited 1 week ago)

They are only a solution if you use a gate voltage higher than 5V, in which case NPN would probably also work. Try to use maybe 6V or 7V to control the NPN base and see if that improves your situation. But as that voltage is impractical to get from the Arduino outputs, PNP/PMOS would be another solution.

Edit: If I understand your issue correctly, then your choice of transistor is not the problem. The problem is that you are forcing them to be less conductive than they could. If a p and an n doped region touch, they form a diode. In an NPN transistor, you therefore have a diode between base and emitter, which is also indicated by the arrow in the transistor symbol. A silicon diode drops around 0.7V, and because its steep I/V curve, that's more or less independent of the current passing through it. When you apply 5V to the base (ignoring the small drop over the base resistor), you're forcing the emitter to sit at around 4.3V. But that would not be possible if the transistor was fully conductive, because that then the emitter would be shorted to the collector sitting at 5V. The transistor has no choice but to increase its resistance between collector and emitter in such a way that it also drops 0.7V there, ultimately limiting current through your laser. The same would happen with a FET, just that the voltage drop between source and drain would be determined by its threshold voltage, not the 0.7V diode drop of the NPN.

[–] lemmyman@lemmy.world 1 points 1 week ago* (last edited 1 week ago)

Fets will be better for voltage drop. But for high side switching in this design you definitely want p fets - they are basically a drop in replacement.

I don't know if you need an lm317 replacement. Aside from the voltage drop issue, the only issue I'm aware of might be startup timing since you're PWMing them. I could not find anything about this in a datasheet. Once you get the transistors figured out I would use an oscilloscope to probe your output and see if it is the waveform you want.

I do know there are multi-channel LED drivers that would work, and are definitely made for PWMing. So you have options if the lm317s are too slow.

[–] TDSOJohn@lemmy.world 2 points 1 week ago

Thanks. J5 is 6 parallel jumpers to probe and adjust the current via RV[1-6]. J6 is connected to the laser diodes. As explained in another answer, we unfortunately must use a common ground.

[–] JustEnoughDucks@slrpnk.net 3 points 1 week ago* (last edited 1 week ago) (1 children)

So what are you trying to do? Are you trying to make a constant current source for the lasers or a current limited voltage source?

You are running out of voltage headroom I think Using these sort of voltage regulators as a current regulator forces a 1.25V drop across the resistors used to limit the current there. Then you have 1.5-2.5V between IN and OUT from the Darlington pair in the regulator, then 0.7 across the transistor for a total of 3.45V minimum drop before you get to the laser. That is 1.55V for the laser. It is strange that it works for the green and not the red because normally they both have a minimum of 1.8V.

Can you probe what voltage you are getting with a scope oun the laser input on J6? Profiling the laser voltage would tell you a lot.

I there are a few ways you can go with this. Since you are burning a ton off as heat anyway, just switch to a DAC controlled high side current source with a PMOS FET (+ op amp and sense resistor of course). They can do 130mA easily and have a similar amount of components.

If you want it a bit more accurate or with BJTs, you could do a current source Like described here and adjust it to your values. More components, but it works quite linearly with your DAC outputs from the arduino.

[–] TDSOJohn@lemmy.world 1 points 1 day ago (1 children)

Thanks for the detailed answer! We're doing a constant current source. The circuit you have linked would be perfect for future designs, but could a PMOS-FET be a drop-in replacement if we were to reuse the current PCBs we have? Do you have any suggestions on a specific model.

[–] JustEnoughDucks@slrpnk.net 1 points 1 day ago

I think it is possible, but would require a ton of trace cutting and wire bodging, even the higher current traces which is never great.

An interconnect PCB (or one per channel) might be your best bet if your current PCB is too complex to reorder and resolder. Getting it done at a cheap board house like Aisler, oshpark, jlcpcb, etc...

Design it to solder to the required pads with castellated half holes, then you can solder the new parts on top of the interconnect board, and that is also easier if you have a proto batch of 5-10.

[–] Scafir@discuss.tchncs.de 2 points 1 week ago* (last edited 1 week ago) (1 children)

Hey! Really not my cup of tea, but here's a few comments:

  • what are the input outputs? Are you powering 6 lasers at the same time? Why hook it up to an arduino? How are the lasers connected? What is a good representative load for your laser (probably resistive, but maybe inductive or capacitive?)
  • Looking at the driving circuit, there's something fishy about them. Having a variable Vi and static ADJ pin is not what I would have expected, nor what the datasheet suggests
  • how about providing a fixed, appropriate voltage on the + terminal of your laser and have low side switching through a mosfet?
  • components seem pretty basic, you could probably simulate this throught spice to get a better idea of what's happening (you can prob do this directly in kicad). Be careful about choosing models for stuff outside the PCB like the lasers. Long cables can have significant capacitive load for example.

EDIT: I think the gist of the problem is that (1) the LM317 is powered on and off continusly, causing transients, power on delays,... (2) the adjust pin depends on the voltage on the output pin, potentially causing more resonance/weird transients. I would: stick to the suggested circuit in the datasheet of the lm317, and move the switching transistor between the lm317 and the laser.

[–] TDSOJohn@lemmy.world 2 points 1 week ago

hi, thanks for the early reply.

the relevant output is j6 which is connectect to six red lasers with separate positive terminals and a common ground to power them independently using the pwm function of arduino. They should be a mostly resistive load but they have quite high parassitic capacitance. We can't have separate grounds and switch low side since the external casing of the lasers is connected to the negative terminal of the laser diode and it is bolted to the same aluminum frame. The lm317 is working as a constant current driver and we found online that it's best to switch Vi instead of ADJ in this case link. Is it possible to use the circuit in the first schematic of the link to solve this? We are currently dropping .7V between base and emitter of the transistors.

Could otherwise placing the switching transistor after the cc driver be a solution?

The circuit seems to work perfectly with a lower voltage laser diode and doesn't seem to have problems with transients. Also thanks, will try to simulate it in spice!