Im having a peculiar problem with my circuit, your help is very appreciated :)

My Set-Up

I am using an FQP30N06L N-Channel MOSFET to pulse an array of LEDs at 38 kHz. A micro-controller (Arduino Uno R3) is used to send 38 kHz pulses at a 27% duty-cycle to the gate of the MOSFET (I am using a 100 Ohm resistor from the micro-controller to the gate of the MOSFET and a 470 k-Ohm resistor from the gate of the MOSFET to GND). With each pulse the MOSFET connects the circuit from the LEDs to ground thus allowing the current to make a complete proper path.

To power the LEDs I am using an LM317 voltage regulator set-up as a constant current supply with an out-put of 100 mA per string of 7 LEDs (300 mA total for 3 strings of 7 LEDs/string) Later on I plan to upgrade my circuit to have a total of 3 strings of 7 LEDs per string (a total of 21 LEDs). At a 27% duty-cycle the current through one string of 7 LEDs should be approximately 27 mA.

Here is my schematic....


simulate this circuit – Schematic created using CircuitLab

The Problem

The current flowing through the LEDs is not steady. It starts fine then exponentially drops and levels-off. For example I connected my multimeter between one string of 7 LEDs and the MOSFET. The multimeter starts reading around 27 mA and exponentially decreases to 17 mA where it seems to stable off.

Sometimes when I place my hand the circuit (without touching the circuit) the current significantly changes from a few milli-Amps to 10, 20, 30 mA change. When I remove my hand it returns to normal.


I think the problem lies with the MOSFET. I checked the output of the LM317 and that remains stable at 100 mA. Do you happen to know why the circuit is performing this way and how to remedy it?

This is how I connected the multimeter to verify the LM317's output....


simulate this circuit



Picture 1

The small green module is the power supply. The TO-220 next to the Arduino with the two terminals and the diode is not used in the circuit. It is disconnected. Top View - Full Circuit

Picture 2

The TO-220 on the upper left of the board is the N-Channel MOSFET FQP30N06L used to pulse the LEDs at 38 kHz. The TO-220 on the upper right of the board is the LM317 voltage regulator.

The white wire connected from the Arduino is connected to the gate of the MOSFET. It is pulsed at 38 kHz.

You may also notice the CAT5e cable (ethernet cable) on the upper right. I will be using it to connect a second string of 7 LEDs. As of right now the wires of the ethernet cable are only soldered on but not connected to any circuit. Peripheral

Picture 3

The larger square of aluminum foil covers the infrared LEDs. The foil is completely covered with clear tape. I use it to prevent the infrared receiver from receiving unwanted signals from with-in the the circuit housing.

The smaller square of aluminum foil covers the rear of the infrared receiver and is also completely covered with clear tape.

The three wires (red, black, blue) are for the infrared receiver. They are completely disconnected from the circuit during testing. Peripheral Only

Picture 4

On the left is the infrared receiver. On the right is the string of 7 infrared LEDs LEDs and Receiver


LED datasheet: http://www.mouser.com/ds/2/311/SFH%204545,%20Lead%20%28Pb%29%20Free%20Product%20-%20RoHS%20Compliant-318958.pdf

Voltage Regulator datasheet: http://www.mouser.com/ds/2/149/LM317-64104.pdf

MOSFET datasheet: http://www.mouser.com/ds/2/149/FQP30N06L-244344.pdf

BJT Transistor datasheet: http://www.mouser.com/ds/2/149/2N3904-82270.pdf

  • \$\begingroup\$ According to your schematic, you have a battery in a short circuit loop. \$\endgroup\$ May 15, 2015 at 0:10
  • \$\begingroup\$ Why do you want to use fixed duty cycle PWM when you could accomplish the same thing open-loop? \$\endgroup\$
    – EM Fields
    May 15, 2015 at 0:15
  • \$\begingroup\$ @EMFields, can you elaborate your comment please? I'm new to these techniques. I suppose it's a fixed duty cycle because it is infrared emitter and receiver system. What do you mean by "open-loop"? \$\endgroup\$
    – hsan
    May 15, 2015 at 2:58
  • \$\begingroup\$ "I recognize my battery is shorted. That is an error on my behalf in the schematic but not a reality in the physical set up." 1. So fix it and the other drawing mistakes you've made so we won't have to guess as to how it's really wired. 2. If your hand's proximity is causing the LED current to fluctuate, I suspect you have a high-frequency oscillation in there. Can you post a photo of your circuit as-built, and do you have an oscilloscope you can use to troubleshoot your circuit? 3."Open loop" means operating without feedback, which is what your circuit is doing, so belay that comment. \$\endgroup\$
    – EM Fields
    May 15, 2015 at 8:44
  • \$\begingroup\$ @EMFields Thank you for your response. I updated the schematic and posted photos of my circuit and links to the datasheets. Unfortunately I do not have an oscilloscope. \$\endgroup\$
    – hsan
    May 15, 2015 at 22:21

2 Answers 2



1.) Your battery is shorted.

2.) The input to your Arduino supply doesn't have the battery across it.

3.) You should be switching the input of the LM317 and current-limiting its output using the voltage dropped across an output resistance to ground.

4.) You don't need Q1, Q2, or Q3

5.) 10.5 volts across 7 LEDs is 1.5 volts per LED, which won't work.


Thanks for cleaning up your schematic.

A new problem which comes to mind is that even if the circuit itself wasn't flawed, I don't think the LM317 is quick enough to give you a faithful 7.1 microsecond pulse every 26.3 microseconds, which is what a 27% duty cycle signal will look like at 38kHz.

Not only that, your circuit isn't a current regulator it's more like a HMMM....

The trick to getting the LM317 to regulate current is to wire it like this: enter image description here

where with the current desired through R1 (your LED array) and R2, the drop across R2 will equal 1.25 volts, which is what holds the output at whatever voltage it needs to be to push 100mA (in this case) through the load and the sense resistor.

The rub here is that with E3 needing to be at 1.25 volts and the LED array dropping 10.5 volts with 100mA through it, E2 needs to be at 10.5V + 1.25V = 11.75 volts.

Then,from TI's data sheet:

enter image description here

It becomes apparent that you need at least 3 volts of headroom for the LM317, so your supply voltage must be at least 14.75 volts.

With that in mind, and considering that the LM317 might not be able to switch at the rate you need, it seems to me that a much more sensible arrangement would be a vanilla LED pulser using a single MOSFET, where each of the 100 ohm resistors is the equivalent of a string of 7 IRLEDs in series, and the 20 ohm resistors are their current-limiting ballasts, like this:

enter image description here

Finally, here's the LTspice file you'll need to run the simulation of the pulser and play with the circuit if you want to.


I can't help but think that at least part of your problem is the circuit layout, which could easily be causing the oscillation you seem to be experiencing. You should watch your lead dress and place the components on the board with at least some care.

Here's an example of example example
an old, nicely laid-out wire-wrapped prototype which gave us no trouble at all during testing. Notice that all of the components are securely anchored close to the board, and that the wire-wrapping is roughly equivalent to PCB traces.

Not as stable, but not bad.

  • \$\begingroup\$ Where can I find info on your point number 3? I would like to try this. Thank you. \$\endgroup\$
    – hsan
    May 15, 2015 at 3:07
  • \$\begingroup\$ What do you mean by point number 5? This set up works but the current fluctuates starting at the expected 27 mA but then decreasing to about 17 mA. The LM317 is used as a constant current source not a voltage regulator. I isolated the LM317 and connected the output directly to GND to verify its output. It is a steady 100 mA as expected and desired. \$\endgroup\$
    – hsan
    May 15, 2015 at 3:15
  • \$\begingroup\$ @hsan: Point 5: I could be wrong since the LEDs are infrared emitters and might work with a Vf < 1.5 volts. So which LEDs are you using? A link to a data sheet would be nice. \$\endgroup\$
    – EM Fields
    May 15, 2015 at 9:12
  • \$\begingroup\$ @hsan: If you're switching the LM317's load in and out of the circuit then the LM317 can't be running in constant current mode since when the load is disconnected the output current of the LM317 will fall to 0A and its output voltage will rise to its full unregulated voltage, and when the load is connected the LM317's output will fall to whatever voltage is required to allow 100mA through the load. Can you post a schematic of how you isolated the LM317 and determined its output current, please? \$\endgroup\$
    – EM Fields
    May 15, 2015 at 9:14
  • \$\begingroup\$ These infrared run on 1.5 Volts. Here is the spec sheet [link]{mouser.com/ds/2/311/…} \$\endgroup\$
    – hsan
    May 15, 2015 at 15:42

Put a bunch of decoupling caps (0.1 - 1uF, ceramic, 50V) on all of your IC/supply stuff.

  1. Supply to GND
  2. Regulator IN to GND
  3. Regulator OUT to GND
  4. Battery + to Battery -

This is something that removes a vast majority of 'unexplained' phenomena, like your hand messing with your stuff.

Once that's done,

Remove the regulatory IGBTs

They aren't going to do anything. It's a voltage regulator. With a single reference voltage, it will keep things constant across all of your loads. I see that you want to make sure you don't get a situation like, "I need to have 5V on this one, and the LEDs will drop voltage, so I need to make sure I have 6V for the next one, and 7V for the one after".

Doesn't work like that, though. Again, voltage regulator. You want to put 5V across ten fusion reactors and a space shuttle? Your voltage regulator is going to do everything it can in order to do it, including immediately destroying itself.

Since it's just LEDs, just make sure you meet the current capacity of all three of your LED-strips and you're fine. I'm going to assume you will, so just remember to limit it with a \$ P = I*I*R \$ wattage resistor for each row, and you'll be fine.

  1. Remove Q1, Q2, Q3
  2. Replace with a resistor (or some way) to Vadj from Vout

Loading the regulator

Either you turn it fully on and deal with the 'safe-operating area' voltage/current heat dissipation, or you change the layout of your circuit so you aren't continuously connecting and disconnecting the regulator. Even a capacitor in series with the output of the regulator would help, as long as you make sure it has somewhere to dump charge during the off phase, and you make sure it dumps the charge fully. (RC bootstrap circuit)

Right now you regulator sees, 'oh shit, a load of R, I better start ramping up my V until I hit V with respect to Vadj for A' and then 4-500ns~ later it's like, 'where did that R go', and starts to ramp down again.

  • \$\begingroup\$ What are you talking about? There isn't a IGBT anywhere in the schematic, and the regulator isn't being used in the traditional voltage output mode so your comments about the capacitors are (largely) wrong.. \$\endgroup\$ May 15, 2015 at 19:30
  • \$\begingroup\$ He's removed the old schematic, yes there is, no they're not. Thanks \$\endgroup\$
    May 15, 2015 at 19:34
  • \$\begingroup\$ No, I looked through the edit history, it never had IGBTs anywhere. \$\endgroup\$ May 15, 2015 at 19:46
  • \$\begingroup\$ @ARMATAV thank you for you're response. I added some capacitors to the schematic. I updated my schematic and the transistor is a 2N3904 NPN transistor. I am using it as an "LED driver circuit" because I will be having 3 rows of 7 LED strings. They are to provide feedback to the Adj pin of the LM317 in the case that one string of LEDs fails to an open circuit; this way the remaining 2 strings of LEDs don't receive 300 mA of current between themselves, instead with the transistor and Adj pin of the regulator will decrease the current to the desired 200 mA between the two strings of LEDs. \$\endgroup\$
    – hsan
    May 15, 2015 at 20:57
  • \$\begingroup\$ @ARMATAV I have all the capacitors in place for the power supply and I am still having the strange phenomena of my hand causing the change in current through my circuit. What would you recommended as a pulsing circuit that can pulse at 38 kHz and output up to 300 mA? \$\endgroup\$
    – hsan
    May 15, 2015 at 21:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.