1
\$\begingroup\$

I'm poking around different LED drivers, and one of the things I'm trying to put together is a PWM-driven dimmer circuit that alternates two LEDs off a single PWM wave. I put together a version of this circuit:

enter image description here

with an Arduino providing the V2 PWM signal. My understanding of this circuit is:

When V2 is at 0, R3 pulls the gate of M2 down, turning it off. R2 pulls the gate of M4 up, turning it on, which should light D1. When V2 goes high, that turns M2 on, which pulls the gate of M4 low, turning D2 on and D1 off.

What actually happens is that D1 turns on and stays on. What am I missing?

EDIT

I updated the schematic as recommended:

schematic

simulate this circuit – Schematic created using CircuitLab

(note the corrected mosfet part number - FQP30N6L)

It works... somewhat. What I'm seeing now is that when V1 is at about 5V, the behavior is as expected - steady current consumption from my benchtop PSU, and alternating LEDs. When V1 gets to 9V (which is where it's supposed to be), D1 gets stuck on, and that's it. I assume the issue is with the properties of the mosfet I'm using, but I'm not sure where to look.

\$\endgroup\$
5
  • \$\begingroup\$ why did you include a screenshot instead of the circuit lab schematic itself? \$\endgroup\$
    – jsotola
    Dec 21, 2017 at 5:54
  • 1
    \$\begingroup\$ leave out R2 and put D1 on high side of M4 \$\endgroup\$
    – jsotola
    Dec 21, 2017 at 5:58
  • \$\begingroup\$ @jsotola because I drew the schematic before getting stuck, and there's no way that I can find to embed an existing schematic. \$\endgroup\$
    – kolosy
    Dec 21, 2017 at 6:01
  • \$\begingroup\$ When you use the CircuitLab button on the editor toolbar the editable schematics are can be saved inline using the "Save and Insert" button. \$\endgroup\$
    – Transistor
    Dec 21, 2017 at 7:01
  • \$\begingroup\$ What they said. But it translates to: Move D1 to M4 drain. | Add series resistors for D1 and D2 (R ~= 7000 / mA or say 680 Ohm for 10 mA. | Remove R2. | IRF520 datasheet - Vgsmax is 20V so OK with 9V swing. |Vgs threshold is 4V max so available swing OK. \$\endgroup\$
    – Russell McMahon
    Dec 21, 2017 at 11:19

4 Answers 4

1
\$\begingroup\$

You should not have the load in the source side of an N-MOSFET transistor switch like that. Especially not a diode.

Even if it were simply a resistor, the act of turning on the MOSFET would change the Vgs voltage and tend to pinch it back of or into a current regulating type characteristic.

With a diode, once the capacitance Cgs is charged up, there is no way for it to discharge, and the MOSFET will just stay on.

Your schematic should be more like this.

schematic

simulate this circuit – Schematic created using CircuitLab

\$\endgroup\$
2
  • 1
    \$\begingroup\$ "never" is wrong, there are some cases where you might want to make a source follower, but this isn't one of them. \$\endgroup\$
    – user253751
    Dec 22, 2017 at 4:58
  • \$\begingroup\$ @immibis ya never may be a bit strong. hence the "switch like that" part. \$\endgroup\$
    – Trevor_G
    Dec 22, 2017 at 13:59
2
\$\begingroup\$

When V2 goes high it turns M2 on.Then drain of M2 becomes ground and 9v actually divide across R2 and R1,so gate of M4 is now 4.5 volt which is greater than threshold voltage.so M4 turns on and D1 glows.To solve try a voltage divider like R1=220,R2=22k.

\$\endgroup\$
1
  • \$\begingroup\$ Thanks. However, removing R1 entirely doesn't seem to help. Any other ideas? \$\endgroup\$
    – kolosy
    Dec 21, 2017 at 5:53
2
\$\begingroup\$

I will not explain why D1 is always on because Zarzisur has explained it very well.

In addition to his/her answer, if you want to alternate between the two LEDs then you need two cascade-connedted NOT-gates. Thus, D1 should be the the load of M4 and there's no need to keep R2 there.

Notet that you should also put series resistor to LEDs so that 9V supply do not harm them.

\$\endgroup\$
1
\$\begingroup\$

If the forward voltages (Vf) of the two LEDs are similar (less than 0.4 V difference), then there is another way that uses only one transistor, one resistor, and one small diode. This works well for standard 3 mm and 5 mm red and green LEDs, such as getting a dual-color LED on an instrument front panel to be red, green, or pseudo-yellow with only one control wire from the system.

schematic

simulate this circuit – Schematic created using CircuitLab

Due to the added voltage drop of D3, D1 "shorts out" D2/D3 when M1 is on. (First time using the editor, don't know why the image is so large.)

\$\endgroup\$
8
  • \$\begingroup\$ Put some useless bit of wire in the far right of the schematic. It maxes the width of the schematic to just barely include everything. Edited it as an example. \$\endgroup\$ Dec 22, 2017 at 14:04
  • \$\begingroup\$ Thanks for the tip. This isn't my first cad system, so I understand lying to an auto-sizing "feature". Is there a way to force a specific output size manually, without the flying net? \$\endgroup\$
    – AnalogKid
    Dec 22, 2017 at 14:20
  • \$\begingroup\$ There's no guarantee that the LEDs are the same. At least the OP has not mentioned it. If LEDs are the same then okay, the circuit will work as you think; but if \$V_{F-D1}\$ is greater than \$V_{F-D2} + V_{F-D3}\$ (e.g. if D1 is blue [3.2V] and D2 is red [2V]) then it will not. I'll cancel my down-vote if the OP says that the LEDs are the same. \$\endgroup\$ Dec 22, 2017 at 14:38
  • \$\begingroup\$ @AnalogKid Not that I know of, but wouldn't mind being shown to be wrong. \$\endgroup\$ Dec 22, 2017 at 14:40
  • 1
    \$\begingroup\$ @SpehroPefhany: You can use the imgur 'l', 'm' and 's' (large, medium, small) prefixes to the '.png' in the schematic name to resize the images. I put a little green 't' on the bottom right of mine though to scale them properly. It helps me recognise them when I go back through old questions! The prefixes work for .jpg too. \$\endgroup\$
    – Transistor
    Dec 22, 2017 at 18:40

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.