DC motor 24V 2A
to test how the motor handles variations in PWM.
2 potentiometers to vary the 'on' and 'off ' time of the pulse.
final result:
http://sites.google.com/site/thebluenoisedepartment/Goal-2008
test program :
int ledPin = 13; // LED connected to digital pin 13int h=1;
int h2=0;
int h3=0;
int h4=0;
int h5=0;
void setup() // run once, when the sketch starts
{
pinMode(ledPin, OUTPUT); // sets the digital pin as output
}
void loop() // run over and over again
{
digitalWrite(ledPin, HIGH); // sets the LED on h5 = analogRead(0); // read the value from the sensor
while(h5>0){
h2 = analogRead(0); // read the value from the sensor
while(h2>0){
h2--;
} h5--;
}
digitalWrite(ledPin, LOW); // sets the LED off h4 = analogRead(1)*2; // read the value from the sensor
while(h4>0){
h3 = analogRead(1); // read the value from the sensor
while(h3>0){
h3--;
}
h4--;
}
}
Great job!
crazywolf1968 1 month ago
What do you need to run this motor? I saw the motor shield but how do you get mor amps into it?
cputampa 3 months ago
Another question I am trying to control speed of a dc motor with a pot with arduino and the only thing I can find is a fading code for an LED when controlling a motor it just doesn't work that great especially when you use a fet driver because that amplifies the problems even more its like there is no ramp the motor just turns on half way through the rotation of the pot. Is the problem in the analogwrite?
anewlow23 1 year ago
Are you varying the frequency as well as the duty cycle with the two pots?
anewlow23 1 year ago
Hey what is the circuit element in between two pots in your circuit?
Shaffooo 1 year ago