I'm working on a project using an ATtiny85, and when I set pin 5 to high, I'm getting less current than pin 6, and that's preventing my transistor circuit, therefor the entire project from working... Any ideas why this might be?
What does the datasheet say about how much current pin 5 can source? Does it say the same thing about pin 6. Could you be troubled to provide a schematic for us to review?
So here is an excerpt from the datasheet on the subject of the voltage and current you can expect
Code:
VOH Output High-voltage, (5) IOH = -10 mA, VCC = 5V 4.3 V
Port B (except RESET) (6) IOH = -5 mA, VCC = 3V 2.5 V
So what does this all mean? It means that if your VCC = 5 Volts and you try to get 10 mA out of any port B pin (including pin 5) then the voltage at the pin will be at least 4.3 Volts. For a VCC of 3 Volts 5 mA will drop the output voltage to 2.5 Volts.
For a transistor with a beta of 100 that should be good for up to an amp of collector current. If your trying to drive a power transistor base then it's not going to work very well. That's why we need the schematic.
(5)(6) are datasheet footnotes that say don't let the total current demand on all pins exceed 60 mA, and RESET must tolerate high voltages.
I actually don't have a schematic... I'm just working on breadboard... I guess I got it working, I just added a 380ohm resistor to the base of the transistor
The base of a transistor with its emitter grounded is like a dead short to the output of a microcontroller. The max allowed output current from the output is much less than it can supply to the short.
The max allowed output current from the output of a PIC is 25mA. An AVR might be the same.
The 380 ohm (strange value) resistor will limit the transistor's base current to about 13mA.
Without knowing if the collector and emitter are backwards on the transistor or the current-limiting resistor for the LED is wrong then we don't know why your LED is dim.
I'm pretty sure the transistor is right, as if I plug my resistor into pin 6. And what do you mean a weird value? I just grabbed the first one I came across with a fairly low value. As I've been learning this stuff, I notice several often appearing values (22, 47pF capacitors, 330ohm 10kOhm resistors), is there a reason? Are these just common?