Voltage divider for Attiny85 and Led strip

LedStripDimmer.fzz (8.5 KB)

New to Fritzing and electronics !

I have tried to design circuit to use a dimmer through an Attiny85 to PWM the Led strip. I am sure there are so many ways to accomplish this but the lesson I am in need of is why I can get the leds to light up at all. I tested the code in another single led circuit and it works.

There isn’t any power to the LED. The transistor is switching the positive lead of the LED to ground, not 12V so there is no power to the LED. Assuming the LED strip will run from 12V (as opposed to being a strip of LEDs that run on a couple of volts and will burn out at 12V!), you need to move the ground of the LED to the collector of the transistor and the red wire of the LED to 12V like this:

Here the micro connects the ground of the LED to ground when the pwm signal is positive when it is at 0 both wires of the LED will be at 12V and the LED will be off. You probably need a higher value than 100 ohms on the base resistor as well, the base current needed is the gain (beta) of the transistor divided by 350ma. You need to to verify the transistor can pass 350ma of collector current as well.

Peter

Thank you SO much! It VERKS !
The mistake I was making is Glaringly obvious now. I do have to nail down the math to figure out
the resistor values. I substituted the voltage divider with a buck converter for now. The leds light and dim although with lots of flicker but I read something about running the attiny on 8mhz mode.
More discovery ahead! Wonderfull. Also the votage divider optimizing will be fun. Perhaps also the use of decoupling caps would help with flicker. So much to learn . Again Thank you for your help.

That is fairly easy, ohms law I = E/R where I is the current E is the voltage and R is the resistance. The tricky part can be figuring what the voltage is. For the base of the transistor that is 1 diode drop or .7 V, so the base resistor will have 4.3V across it (5V - 0.7V for the base diode.) to set the base current.

That is an easy place to start, although the output of the buck regulator should be keeping the supply voltage at 5V (there may have been a problem with the original resistor divider though.) I think the more likely problem is a low pwm frequency. This article

https://www.electroschematics.com/attiny85-pwm-primer-tutorial-using-arduino/

has some code (and an alternate, perhaps hardware based, pwm pin on pin5 instead of pin1) that may help. I wasn’t sure the attiny85 had hardware pwm, but it appears it does. You may be using software based pwm which will be slower and may be causing the flicker.

Peter