I want to control the speed of a 6V DC motor that I purchased from Amazon here. I'm using a 2N2222A NPN transistor to function as an amplifier to achieve this. I used this website to find out about the transistor's features and whatnot. However, upon reading, a problem arouse and that was using the transistor for my application. I want to have the base controlled by an ATtiny84 pin whose pin is set as an analog output pin. I did some research and found that when the analog output pin at its max, it's around 5V with a current of approximately 81 mA. With that information known, I checked the site which shows how to calculate the base resistor:
What I'm having trouble understanding is actually getting the resistor value: If the output from the Atiny84 pin (at its max) is around 5V wouldn't that give me something like this:
(5-6)/0.005 = - 200
which is incorrect I assume. I'm clearly misunderstanding something and would appreciate it if someone could point out what it is! : )
I also would like to know if this small circuit could work as I don't want to mess anything up:
Thanks in advance! : )