Author Topic: PWM drive LED strip, weird waveform  (Read 5901 times)

0 Members and 1 Guest are viewing this topic.

Offline baoshiTopic starter

  • Regular Contributor
  • *
  • Posts: 167
  • Country: sg
    • Digital Me
PWM drive LED strip, weird waveform
« on: April 30, 2012, 07:46:22 am »
Hi,

Im building a simple PWM 12V LED strip controller using N-MOSFET as downside switch (mosfet.png). The actual MOSFET I'm using is IRF640 but this part is not available in LPSpice so I use IRF530 instead. Parameter-wise they should be similar. PWM source is from a Arduino (500Hz).

I use a scope to check the waveform across LED. Am expected to see a clear square wave but to my surprise I see this (waveform.png, I had inverted the probe so please read inverted). I double confirmed similar results after change the circuit to a P-MOSFET upside switch with a NPN driver.

I've tried to replace the LED with resistor and the result waveform is clear square down to 0V.

I'm not sure what's wrong but it seems the LED is not as simple as I thought?

Can anyone enlight me what's the reason?

Thanks


 
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 10239
  • Country: nz
Re: PWM drive LED strip, weird waveform
« Reply #1 on: April 30, 2012, 08:31:51 am »
Try and change R1 to 100R and see what that produces.
The gate capacitance maybe causing your issue.
The IRF640 has a gate-source voltage of up to 20V so a current limit isn't needed, unlike a transistor.
The mosfet gate pin can draw up to 2A for a very short time (to charge/discharge its internal capacitance).
If you don't supply it with enough current (ie, limit current with a resistor) then it will be slow to respond to changes. This can be a big issue with high speed switching. 500Hz isn't high speed though, so it may not be your issue but is worth at try.

Also, when you say you're "checking the voltage across the LED with the scope". How are you doing this?
I ask because the led is in the middle of the circuit with no ground connection, so a scope isn't able to view the voltage across the led directly unless it's an isolated scope or your powersupply+arduino are floating.
If you connect the scope ground clip to either side of the led and your circuit has a connection to mains ground somewhere then you will be shorting one side to ground.

I assume your getting a square wave in your LTspice simulation and the waveform you have posted is the real circuit?

« Last Edit: April 30, 2012, 09:12:01 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline baoshiTopic starter

  • Regular Contributor
  • *
  • Posts: 167
  • Country: sg
    • Digital Me
Re: PWM drive LED strip, weird waveform
« Reply #2 on: April 30, 2012, 09:08:07 am »
Thanks Psi.

The circuit is powered by battery so I'm able to connect the scope to both leads of the LED.
The circuit I posted is drawn in LTspice. I have done simulator and the outcome is nice square waves.

Will try the R1 adjustment when I reach home. Will post more scope results for investigating.
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 10239
  • Country: nz
Re: PWM drive LED strip, weird waveform
« Reply #3 on: April 30, 2012, 09:15:12 am »
I just saw your comment about the waveform being inverted.  That shows your fet is slow to switch off rather than on.
You should change R2 as well.   
Try  R1=100R     R2 = 1K

100K is probably taking some time to discharge the gate, especially as the gate voltage starts to get low.
« Last Edit: April 30, 2012, 09:18:56 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline Kremmen

  • Super Contributor
  • ***
  • Posts: 1289
  • Country: fi
Re: PWM drive LED strip, weird waveform
« Reply #4 on: April 30, 2012, 10:40:12 am »
The total gate charge of IRF640 is 70 nC. From the scope picture it looks like your cycle period is 2 us, which implies an average gate current of some 70 mA. This won't happen thru 1k/100k charge/discharge resistors. Even if your gate driver is a totem pole going rail to rail with 0 internal resistance, it would take a 70 volt supply to properly drive the gate.
So please take the advice of Psi and reduce the gate circuit impedance by at least 10, maybe even more, it would not hurt.
Nothing sings like a kilovolt.
Dr W. Bishop
 

Offline baoshiTopic starter

  • Regular Contributor
  • *
  • Posts: 167
  • Country: sg
    • Digital Me
Re: PWM drive LED strip, weird waveform
« Reply #5 on: April 30, 2012, 04:49:22 pm »
Thanks every for help. Thing become more interesting now  :o

First, please note the original waveform I posted is negative voltage. The slope actually happens when the gate is cutting off, not turning on.

Then, as advised, I go for the extreme case by removing R1 and R2 and drive gate using AVR output directly.
I set the PWM width to about 25% and this is the wave form I measured across LED (led.png)
And if I use R1 = 100R and R2 = 1K, the result is same.
Check the voltage drops a bit then the slope appears ..., but never reaches 0.

And if I put a 10K resistor in parallel with the LED, here is the output: (resistorload.png)
Seems like the LED need some discharge path  ??




« Last Edit: April 30, 2012, 04:53:50 pm by baoshi »
 

Offline Jeff1946

  • Regular Contributor
  • *
  • Posts: 104
Re: PWM drive LED strip, weird waveform
« Reply #6 on: April 30, 2012, 06:54:14 pm »
Seems like you have figured it out.  One way to drive a MOSFET is to use a CD4049 (inv) or CD4050 (non-inv) chip with the six gates wired in parallel.  If you want a higher current driver you can use a IXDF604PI mosfet driver or its cousins.  These chips can be used directly to drive some loads as they can pass 1.5 A contiuously or 4A pulsed.  You may wish to experiment with what value resistor to put between the MOSFET gate and the driver if ringing is a problem to get a bit softer turn on and turn off of the MOSFET.
 

Offline baoshiTopic starter

  • Regular Contributor
  • *
  • Posts: 167
  • Country: sg
    • Digital Me
Re: PWM drive LED strip, weird waveform
« Reply #7 on: May 01, 2012, 04:29:44 am »
Hi all,

I think I close this case. Seems like I do not understand digital scope. I must always connect scope's ground to circuit ground even though the circuit is floating. I tried to measure Vgs and Vds. The result is attached. As such I can simply calculate the actual voltage across the LED by doing 12v - Vds.
Although still puzzled I guess I got the answer. Thanks for everyone.
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 10239
  • Country: nz
Re: PWM drive LED strip, weird waveform
« Reply #8 on: May 05, 2012, 02:02:12 am »
Check you have your gate driving microcontroller output pin set to output mode (source and sink)

If you're setting the pin so that HIGH=5v and LOW=input(High Z) then you're relying on the resistor to pull the gate to ground. This isn't ideal and the port should be driving in both directions for a good switch on/off.

It's unlikely you're actually doing that but it's worth a check.
« Last Edit: May 05, 2012, 02:05:27 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf