1
\$\begingroup\$

I was developing a footwell controller for my car, using RGB LEDs for the lights, an Arduino Nano for RGB controlling and an auxiliary PWM generator (pure white lights) when the Arduino is off. The two signal sources are complementary.
The problem arises at the end stage when the two signals have to merge to drive the MOSFETs (PWMR, PWMG and PWMB comes from the Arduino):

schematic

simulate this circuit – Schematic created using CircuitLab

The square wave coming from AUXPWM after it passes the 1N4148 is completely destroyed, it isn't able to drive the MOSFET anymore. The LTSpice simulation produces this graph from the schematic above:

LTSpice simulation outcome. The signal after the diode is completely flat.

It's possible to see how the signal is almost flat after passing through the diode. I really cannot understand what is happening here, so am I missing some underlying knowledge or is the simulation plain wrong?

Edit: the MOSFET are N-Channel I did the schematic wrong, sorry

\$\endgroup\$
  • \$\begingroup\$ I simulated it in circuit lab it worked. Maybe you made a DC simulation in LTSpice ? You have to make a time domain simulation \$\endgroup\$ – MaximGi Feb 21 '16 at 10:04
  • 1
    \$\begingroup\$ What are the diodes supposed to be doing anyway? \$\endgroup\$ – pjc50 Feb 21 '16 at 10:07
  • \$\begingroup\$ Since the Arduino sends distinct PWM signals for each color while the auxiliary PWM generates a single one, at the merging point there would be a single connection hence corrupting the Arduino PWM signals. \$\endgroup\$ – EnryFan Feb 21 '16 at 10:14
  • \$\begingroup\$ @EnryFan Logic gates might work better than diodes and resistors here. \$\endgroup\$ – Adam Haun Feb 21 '16 at 18:25
  • \$\begingroup\$ True but a simple diodes consume virtually zero compared to logic gates IC, also I think it would unnecessarily complicate things for a simple application like this. \$\endgroup\$ – EnryFan Feb 22 '16 at 17:20
4
\$\begingroup\$

The simulation looks basically correct. The gate of the MOSFET acts a small capacitor, so each channel's circuit looks like this:

schematic

simulate this circuit – Schematic created using CircuitLab

When the PWM output is high, it charges the gate through the diode. When it is low, the diode is reverse-biased and prevents the PWM output from discharging the gate. The gate does slowly discharge through the 1 MΩ resistor, but this discharge has only just started when the PWM goes high again.

\$\endgroup\$
  • \$\begingroup\$ I've placed a 2.7 kΩ resistor from the diode to the gate in parallel with a 4.7 kΩ resistor from the gate to ground and the square wave now is almost perfect! \$\endgroup\$ – EnryFan Feb 21 '16 at 10:50
1
\$\begingroup\$

The mosfets have 1 meg gate source resisters which are far too high for what you are trying to do .The RC time constant formed by the gate capacitance of nF is in the ballpark of milliseconds so it wont discharge on the downstroke of the PWM squarewave when sensible frequencies like KHz are used .Remember that the diode represents a low impedence on the upstroke of your PWM .This is why you see DC .If you reduce the gate source resisters to say 1K ohm then you will get reasonable gate drive .

\$\endgroup\$
0
\$\begingroup\$

You have P-channel FETs for the switch devices, which should have the gate via resistor to the source and be pulled down to switch on.

As you have pulled the gates low with respect to the source, they will be on until the gates are driven high enough to turn them off.

Try using N-channel devices with sources to ground and drains to the LEDs.

\$\endgroup\$
  • 1
    \$\begingroup\$ I've make a mistake in the schematics, the MOSFETs are indeed N-Channel, now I've fixed it. \$\endgroup\$ – EnryFan Feb 21 '16 at 10:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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