PWM question (in combination with TIP32)
#1
Posted 11 December 2012 - 10:29 AM
I created the following circuit:
LED STIP = LED STRIP
I’m chancing the duty cycle of the PWM to control the light output of the LED stip.
so in de code I’m setting the duty cycle to 0%.
but there still is a low voltage coming out of the PWM port,
so the PNP is still being triggered, and the LED will still emit light.
How can I fix this? so on a duty cycle of 0% the voltage on the Base of the PNP = 0V.
(DataSheet op TIP32C = PDF)
Bram van Deventer
#2
Posted 11 December 2012 - 11:55 AM
i made a circiut with an npn (doesent need inverted pwm). you can easly change it to pnp (you have to invert the pwm).
ofc you need to change the resistor value for the 12v, or maybe dont even use one, but i not suggest that (except it runs with 12v)
most likly your problem is the pnp, it needs inverted pwm.
Attached Files
#3
Posted 11 December 2012 - 12:13 PM
your circiut looks kinda wrong.// stupid me.
i made a circiut with an npn (doesent need inverted pwm). you can easly change it to pnp (you have to invert the pwm).
ofc you need to change the resistor value for the 12v, or maybe dont even use one, but i not suggest that (except it runs with 12v)
most likly your problem is the pnp, it needs inverted pwm.
The led strip in the drawing is infect a RGB strip of 5 meter, drawingabout a 1Amp at 12V, per chanel.
How can i invert the PWM?
#4
Posted 11 December 2012 - 12:37 PM
It is just a logical change (*), normally 0% = off and 100% = on, inverted 0% = on, 100% = off.How can i invert the PWM?
Edit: The polarity parameter is available in PWM class since version 4.2, as pointed out by NooM in the post below. Thanks!
Edited by CW2, 11 December 2012 - 10:08 PM.
#5
Posted 11 December 2012 - 12:53 PM
It is just a logical change (*), normally 0% = off and 100% = on, inverted 0% = on, 100% = off.
(*) The microcontroller allows configuration of PWM polarity, but it is not available in .NET MF classes.
LOL, that was stupid of me.
BUT...
I hooked upthe 3 leads of the RGB strip. Including separate PNPs and resistors.
I wrote a littlescript that enables me to switch between light.
3 duty cycles: 2 set to 0% and 1 set to 100%.
And if I look1 is very bright, the other 2 are dimmed (not off).
Does this means that I don’t need a inverted PWM?
#6
Posted 11 December 2012 - 07:16 PM
Attached Files
- bramVD likes this
#7
Posted 11 December 2012 - 07:25 PM
You have got a pnp transistor.
When you pull the base down to about 0.7 V below your 12V supply, it will turn ON.
When the Netduino output is low 0V - it wil be ON.
When the Netduino output is high 3.3V - it will still be ON!
If you have to use the pnp transistor as shown, you need to use another transistor (npn) and resistors to get the base to swing up above 11.3V. This will also invert the logic, low - off, high - on.
Hope this explains it - Paul
Thank you, it explains a lot
#8
Posted 11 December 2012 - 07:33 PM
Thank you, it explains a lot
Your welcome!
In case you missed it, I edited my post and added a diagram.
Red lines to show the current flowing.
#9
Posted 11 December 2012 - 09:56 PM
It is just a logical change (*), normally 0% = off and 100% = on, inverted 0% = on, 100% = off.
(*) The microcontroller allows configuration of PWM polarity, but it is not available in .NET MF classes.
sure its aviable and works!
PWM ladi = new PWM(PWMChannels.PWM_PIN_17, 1000, 0.5, true); // standard netmf pwm class
//edit: in 4.2
- CW2 likes this
#10
Posted 11 December 2012 - 10:01 PM
Oops! Still living in the past version - thanks for pointing that outsure its aviable and works!
#11
Posted 12 December 2012 - 12:33 PM
You have got a pnp transistor.
If you have to use the pnp transistor as shown, you need to use another transistor (npn) and resistors to get the base to swing up above 11.3V. This
EDIT added picture.
When NPN is OFF, "pull up" reistor hold the PNP base near to 12V, thus turning it OFF.
When NPN is ON, it pulls the base down below 11.3V, turning the PNP ON.
do you have a value of the Resistors?
#12
Posted 12 December 2012 - 07:40 PM
#13
Posted 12 December 2012 - 09:52 PM
Hi Bram,
I don't have any data to hand, so the following are guesses.
The pullup resistor does not have to pass any current (you might even get away without it) I would use something big - say 10K.
You have used 220R for the pnp's base, stick with that for now.
The npn base should not need much current, try 1K or a bit less if it does not turn on properly.
Paul
Yaay,
it works perfectly . Thanks!!! (again)
#14
Posted 12 December 2012 - 10:25 PM
https://www.circuitl...rip-controller/
Attached Files
#15
Posted 12 December 2012 - 10:43 PM
#16
Posted 13 December 2012 - 08:17 AM
I am a little worried that the led strip has moved in the new circuit.
Is this the mistake you mention?
Yes, thats the mistake.
If the pnp transistor is connected like this, it may not turn ON fully; if so, it will act as a resistor and will waste some of the power that should be in your LED strip.
It would be better to put the pnp above the LED strip, between12V and the strip's +ve terminal.
Remember to have fun - Paul
The strip is really bright at the moment, but I will try to switch the location of the PNP.
maybe it will even be brighter!
The “having fun” part will not be a problem
After this works I’m going to implement a 1” OLED screen, a rotary switch and a IR receiver,
all into a little box mounted on the wall, connected to a 5M RGB led stip.
Building a Menu to configure the lights and patterns.
#17
Posted 13 December 2012 - 07:24 PM
I put the strip directly one 12V en Ground, and the LEDs were indeed brighterthen when they are in line with the PNP, but it’s hardly noticeable.
so I wil stick with the original plan
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users