Hi everyone,
For a job project I need to control a LED with a RaspberryPi!
The LED is a white one and it has to be PWM driven in order to make it show a sort of "breathing effect".
Unfortunately I don't have the LED datasheet so I've empirically (using my bench power supply) found that the LED forward voltage is 3V appox. and that the brigthness I want is obtained with 50mA approx.
So I can't drive the LED attaching it directly to a GPIO pin: RaspberryPi is a 3.3V logic and I've read indeed that a GPIO can give a maximum of 16mA to them
I had to find another way.
I eventually come up with a circuit like the one shown in attachment.
Where I'm usign an IRL540n mosfet (link) to drive the LED through the Raspberry 5V power supply pin.
The mosfet gate is attached to the GPIO throught a resistor to reduce the (theoretically minimal already) current required from the GPIO.
I've also placed a pull down resistor in order for the gate charge to discharge to ground when GPIO is LOW.
These R1 and R2 have respectively 10K and 100K Ohm values (I put them empirically).
I've choosed a 2.2 Ohm R3 resistor for the LED, this way I've found current values are pretty near to the one I want.
Now I have created 4 copies of the circuit mounted on a RaspberryPi Adafruit Perma-Proto HATs (link).
Now I'm experiencing different behaviours for each of them. While two of them are working pretty the way I wanted to be, the others not.
Indeed:
In the second situation I'm not able to figure out what the problem can be. It seems a transistor problem but I not sure (I have only a limited knowledge of electronics).
What I'm doing wrong?
Someone already has some experience in setups like that?
Any help will be much appreciated
Thanks
Nicola Ariutti
For a job project I need to control a LED with a RaspberryPi!
The LED is a white one and it has to be PWM driven in order to make it show a sort of "breathing effect".
Unfortunately I don't have the LED datasheet so I've empirically (using my bench power supply) found that the LED forward voltage is 3V appox. and that the brigthness I want is obtained with 50mA approx.
So I can't drive the LED attaching it directly to a GPIO pin: RaspberryPi is a 3.3V logic and I've read indeed that a GPIO can give a maximum of 16mA to them
I had to find another way.
I eventually come up with a circuit like the one shown in attachment.
Where I'm usign an IRL540n mosfet (link) to drive the LED through the Raspberry 5V power supply pin.
The mosfet gate is attached to the GPIO throught a resistor to reduce the (theoretically minimal already) current required from the GPIO.
I've also placed a pull down resistor in order for the gate charge to discharge to ground when GPIO is LOW.
These R1 and R2 have respectively 10K and 100K Ohm values (I put them empirically).
I've choosed a 2.2 Ohm R3 resistor for the LED, this way I've found current values are pretty near to the one I want.
Now I have created 4 copies of the circuit mounted on a RaspberryPi Adafruit Perma-Proto HATs (link).
Now I'm experiencing different behaviours for each of them. While two of them are working pretty the way I wanted to be, the others not.
Indeed:
- in one case the LED has been burnt after beeing working for a while;
- the other last one showed a strange flickering pattern (not related to the PWM). It worked like that for a day then stop working at all.
In the second situation I'm not able to figure out what the problem can be. It seems a transistor problem but I not sure (I have only a limited knowledge of electronics).
What I'm doing wrong?
Someone already has some experience in setups like that?
Any help will be much appreciated
Thanks
Nicola Ariutti
Attachments
-
54.3 KB Views: 22