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
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
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.
The Arduino Nano uses 5V logic, so PNP/PMOS should work.
My bad, thanks for the correction!
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?
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.
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.