@JohnRob: thank you for that, that is exactly the kind of feedback on my circuitry I am sure I really need. I'm going to study my circuit with what you said in mind when I get home from work. But to supply a little more information:
It's a 2N2907 transistor. Chosen because it has an N in the name and that was the example used on the example page.
It's a 100uF capacitor. Chosen based on the advice on that page, and it worked lol.
I'm kinda amazed and relieved y'all haven't savaged me on the placement of the diode and capacitor at all, because it kinda blew my mind. Transistors still blow my mind a bit, too. When I get home I'll figure out if I made the diagram wrong. I'm pretty sure I didn't pay attention to the orientation of the capacitor in the drawing (my mistake), but I believe the transistor is correctly represented (as I have it now).
I'm afraid I do not understand what you mean by "I would move the capacitor (what value are you using) to 5V--Common on the protoplug board." edit: what's the protoplug board?
Jiggy-Ninja:
An electrolytic is the wrong kind of capacitor though. Pololu recommends 1-3 0.1 uF ceramics for proper noise suppression.
I think it depends strongly on inductance and current in the motor. Vibration motors are very small and the mentioned app notes suggest cap 10-100pF if using PWM - probably to reduce current spikes from filling the cap when PWM turns on. Or use 100nF only if noise is problem and PWM is not used for drive the motor.
@tinman13kup I believe the diagram is correct as it is actually set up, with the exception that the capacitors are backwards...and I can't seem to figure out how to flip them around visually in Fritzing, yet. The transistor is facing the direction shown, for sure--visually.
It's a 2N2907 transistor. Chosen because it has an N in the name and that was the example used on the example page.
I'm a little confused here. What does the "N" have to do with selection? This is a pnp transistor, which might explain your results. It is not hooked up the same way as a npn.
HAHAHAHAHA that is funny. I read something somewhere that led me to believe that's how it worked, and now you have just taught me that it does not, in fact, work that way.
Thank you for that tinman13kup. I'll just go ahead and start all over again
Ah, this may explain JohnRob's explanation above, too. It didn't occur to him I could be so ignorant as to not realize what type of transistor I was using lol.
double check exactly what you have. All I'm finding for that number is a TO-18 package, which is a small metal can. Your fritzing diagram shows a TO-92.
should keep the motor on pin 7 off nearly all the time while motor on pin 6 should run for 5s and then stop for 5s. With higher "x" motor 6 should run slower (when running). Is it how it works?
BTW remove the 100uF cap it may do more problems than it possibly solves. You may put it between GND and 5V to help supress noise from PWM.
@Smajdalf: sorry I didn't see your post earlier. The weird thing was that on pin 6, 255 was all the way off, while on pin 7, 255 was all the way on. Depending on what order I executed the statements.
Please post a code and PRECICE description what it does. The "wierd" code in #31 should do:
Turn motor 7 on
Wait 100ms
Turn motor 6 on
Wait 100ms
Turn motor 7 off
Wait 5s
Turn motor 6 off
Go to 1)
It should look this way motor 7 turns on for a moment and nearly at the same time motor 6 turns on and runs for 5s. Then it stops and both are off for another 5s.
Does it do this or something else?
And it is not strange higher PWM = slower speed. It is because how the motors are wired. If pin is HIGH it turns transistor off and stops motor.
And it is not strange higher PWM = slower speed. It is because how the motors are wired. If pin is HIGH it turns transistor off and stops motor.
He has the transistor wired as a low side switch, and was under the impression it was a npn transistor, but the number given shows a pnp, but the case is also not right. Without confirmation on exactly what transistors he is using, it's folly to explain why he is getting certain results
Your correct--that's the way they run. It was essentiall random--I was screwing with the motors trying to get them to do stuff. No design or intent to speak of.
The odd thing is that on the first one x=10 is near full speed, but on the second motor x=10 is slow.
@tinman13kup: those results were with the 2N2907 transistor.
The weird(est) thing to me is just the fact that the motors didn't behave the same way--either high PWM is fast or high PWM is slow. Regardless of my incompetence :-). I would think this would be reproducable, at least with the same vibration motors.
ie. I would expect both motors to either being going flat out, or off, for the last 5 seconds, right? But only one of them does. And then, briefly, the other is on full speed and the one going flat out is off.
However, very slight changes to the code, as noted further above, cause this to go away and they both act predictably.
I'm wondering if this is some type of power management issue. I'm using a 5v 2A power supply, which, in my inexperience, seems like it would be enough for just two of these? I don't know how to measure how much current they are drawing.
If you do analogWrite(pin,x) it outputs PWM from the pin equal to x until you change it with another analogWrite command on the same pin. It is not limited for time of following delay. Maybe this is the problem?
tinman13kup:
He has the transistor wired as a low side switch, and was under the impression it was a npn transistor, but the number given shows a pnp, but the case is also not right. Without confirmation on exactly what transistors he is using, it's folly to explain why he is getting certain results
Google (and eBay) shows transistor with this number in TO92 package. So I expect it is this one. By luck the circuit works as well but with more loses and reversed logic.