Arduino boards have PWM (Pulse Width Modulation) outputs that can be used to control like the speed of a DC motor. On a Pro Micro, those outputs are encircled white on the board. You can program it such that it outputs on a scale of 1-255, 1 being the slowest and 255 being the fastest.
PWM gives out pulses whose width is varied (modulated) while the period is constant. The longer it is high, the higher power it delivers to the circuit. PWM can be used to drive a transistor (switch) which in turn drives the motor ON and OFF. The longer the switch is ON, the higher the power delivered to the motor, and thus faster.
The circuit consists of a transistor Q1 (TIP31) NPN transistor, driven by the PWM from Arduino. The resistor is to limit the current to the base, but enough to operate the transistor in saturation when the input is high. The diode is to protect the motor from any back emf that might come from the motor when the current is cut off. The circuit is supplied by a 9V battery.
Below are the codes on Arduino. It starts the motor from slow to the fastest, then slower again until it stops, and repeats the cycle.
const int motorPin = 9;
void setup()
{
pinMode(motorPin, OUTPUT);
}
void loop()
{
for (int i=0; i<=255; i++)
{
analogWrite(motorPin, i);
delay (50);
}
delay(500);
for (int i=255; i>=0; i--)
{
analogWrite(motorPin, i);
delay (50);
}
delay(1000);
}
PWM gives out pulses whose width is varied (modulated) while the period is constant. The longer it is high, the higher power it delivers to the circuit. PWM can be used to drive a transistor (switch) which in turn drives the motor ON and OFF. The longer the switch is ON, the higher the power delivered to the motor, and thus faster.
The circuit consists of a transistor Q1 (TIP31) NPN transistor, driven by the PWM from Arduino. The resistor is to limit the current to the base, but enough to operate the transistor in saturation when the input is high. The diode is to protect the motor from any back emf that might come from the motor when the current is cut off. The circuit is supplied by a 9V battery.
Below are the codes on Arduino. It starts the motor from slow to the fastest, then slower again until it stops, and repeats the cycle.
const int motorPin = 9;
void setup()
{
pinMode(motorPin, OUTPUT);
}
void loop()
{
for (int i=0; i<=255; i++)
{
analogWrite(motorPin, i);
delay (50);
}
delay(500);
for (int i=255; i>=0; i--)
{
analogWrite(motorPin, i);
delay (50);
}
delay(1000);
}
best multimeter for electronics technician in very good budget multimeter and best budget digital multimeters
ReplyDeleteClick here for more details
Best budget Multimeter for electronics
Best budget Multimeter 2021
Hey Nice Blog Thanks for Sharing!!!
ReplyDeletehttps://gamingwala15.blogspot.com/2021/11/payeer-wallet-registration-tariffs-commission-review-2021.html
https://gamingwala16.blogspot.com/2021/11/payeer-wallet-registration-review-login-personal-account.html
https://gamingwala17.blogspot.com/2021/11/payeer-wallet-review-2021-safe-to-use.html