This isn't a project per se. I'm just learning still and the plan is to learn PWM + arduino with initially an LED and then a DC motor.
I started with the LED and can make it fade in and out with a pot hooked up to an analog pin. Occasionally I blue screen my windows computer, but I think that has something to do with the motherboard protecting itself from some wild fluctuation in voltage coming off the USB connected to my pro mini. I also think that issue is begging to teach me where a capacitor needs to go. (I read isolation here at the bottom: http://www.thebox.myzen.co.uk/Workshop/Motors_2.html
). I have a box of different size capacitors, but don't know for the LED where or what value I would need to keep that from happening. I'm powering the pro mini from the USB and then using one of the 5v out of the pro mini to run the breadboard (+ and gnd). The LED hangs off of pin 9.
When I switched to trying to vary a DC motor connected to the pro mini, the lessons started rolling in. Lesson 1 was learning I needed more than just the 5v to drive the motor. 1 PN2222 and a 1N4001 diode later I can make the motor run, but it's either on or off.
My DC motor already looks like it has a capacitor between the connectors (looks like a tiny ibuprofen pill). I can't recall if the computer has crashed when I'm running the motor though. Maybe that's just when I was using the LED.
(I'm posting some of this so someone can correct me if I'm missing some things I should be learning along the way.)
My actual question and reason for posting is that I can't vary the speed of the DC motor with the pot. I know I'm sending the transistor different duty cycles because it fades the LED when I'm using it. The motor when I connect it just runs though as if it's not listening to the pot/PWM.
My setup is exactly like this: http://www.oomlout.com/oom.php/products/ardx/circ-03
...well like that plus a pot that the arduino uses to read and set the PWM for. (analog Pot pin /4) = the 0-255 variable that analogwrite wanted for PWM. Any ideas what I'm missing to make the motor speed up and slow down with that? I know I'm working in the dark without some specifics on the motor, but that's just the nature of using scavenged parts to play with.
I also have 555 timers, but this setup seemed easier than the instructable that was out there that claimed quick and dirty PWM with 555 timers.