Go Down

Topic: Using PWM to control voltage output? (Part 2) (Read 386 times) previous topic - next topic

Smajdalf

I don't know who and why locked the original topic but since I believe OP still did not get answer I open this topic to try to help him.
@ post #65 of the topic:
The video shows behavior I expected to see. If you use the "wrong" PNP transistors motor on pin 7 should stop when you analogWrite(7,255) and run at maximum speed when analogWrite(7,0). With "right" N-channel MOSFET the motor should run at maximum speed with analogWrite(7,255) and stop with analogWrite(7,0). The SAME is true for motor on pin 6. Let's look at your code, I assume PNP transistors are driving both motors:
Code: [Select]
void loop()
 analogWrite(7 , 10 );
 delay(100);
 analogWrite(6, 10 );
 delay(100);
 analogWrite( 7 , 255 );
 delay(5000);
 analogWrite( 6 , 255 );
 delay(5000);
}

analogWrite(7 , 10 );
starts the motor 7
delay(100);
motor 7 is running for 100ms while motor 6 is still stopped
analogWrite(6, 10 );
motor 6 is also started now
delay(100);
for additional 100 ms both motors are running
analogWrite( 7 , 255 );
motor 7 is stopped now
delay(5000);
for 5s motor 6 is running alone (pin 6 is still outputting result of analogWrite(6,10) while pin7 was overwritten with analogWrite(7, 255))
analogWrite( 6 , 255 );
motor 6 is also stopped
delay(5000);
wait 5s when both motors are stopped and then go to beginning.

Result may be seen on the video: the motors start (nearly) at the same time but while one keeps spinning for 5s the other stops nearly immidiately. Then for 5s no motor is running and this repeats again and again.

But BEWARE! The motors you linked are rated for 1.5 - 3 V only. Are you powering them from 5 or 3V source? Also you said they eat 1.1A when stalled and 0.8A when running freely. But IIRC the PNP transistor is rated for 600mA of maximum current while the MOSFET 200mA only! You are probably stressing the parts too much - my experience is that exceeding "absolute maximum" ratings rarely do some immediate and noticeable harm but it is not good to get close to them. The damage may be subtle (such as worse characteristics) or "invisible" wear that may case the part to fail sooner than expected - even without further abuse.
How to insert images: https://forum.arduino.cc/index.php?topic=519037.0

Go Up