Page 1 of 1

DC motor driver shield newbiew help plizz :(

PostPosted: Mon Mar 25, 2013 11:39 am
by armienz30
the situation:
i am doing project for FYP, a mobile robot using arduino mega 2560 r3 as a microcontroller. i want just it to move forward and backward, and the movement is respond to a switch automatically.
mechanism movement: if it moving forward continously until it trigger the button infront when hitting the wall the mobile robot will stop for a while and backward and vice versa.

my problem is i donno which driver motor and switch should i buy on cytron plus programming code, i have arduino mega 2560. really need help please.

Re: DC motor driver shield newbiew help plizz :(

PostPosted: Tue Mar 26, 2013 9:03 am
by gadgetng
armienz30 WROTE:the situation:
i am doing project for FYP, a mobile robot using arduino mega 2560 r3 as a microcontroller. i want just it to move forward and backward, and the movement is respond to a switch automatically.
mechanism movement: if it moving forward continously until it trigger the button infront when hitting the wall the mobile robot will stop for a while and backward and vice versa.

my problem is i donno which driver motor and switch should i buy on cytron plus programming code, i have arduino mega 2560. really need help please.


If you don't know programming.. then no one can help you.
Try search on the Cytron's tutorial for the DC motor, mobile robot and arduino example project.

Re: DC motor driver shield newbiew help plizz :(

PostPosted: Thu Mar 28, 2013 9:11 am
by armienz30
thx you for replying me..
i have study alittle bit and follow the tutorial.
but i have problem occur, my new 2A driver motor shield seem not working or have respond to my code. how can i fix this. the 2A driver motor didnt need power source if it supply from aruino using USB cable right?

int E1 = 9;
int M1 = 8;
int E2 = 10;
int M2 = 12;
void setup()
{
pinMode(M1, OUTPUT);
pinMode(M2, OUTPUT);
}
void loop()
{
int value;
for(value = 0 ; value <= 255; value+=5)
{
digitalWrite(M1,HIGH);
digitalWrite(M2, HIGH);
analogWrite(E1, value); //PWM Speed control
analogWrite(E2, value); // PWM Speed control
delay(30);
}
}

above is the code i try to upload to arduino and the shield didnt respon.. can someone help?

Re: DC motor driver shield newbiew help plizz :(

PostPosted: Thu Mar 28, 2013 9:42 am
by shahrul
What motor driver you use? Make sure use the right pin and right jumper setting.
Then the power can't use USB, must use external power to drive motor. If hardware correct, then motor should running.
Anyway I use Cytron Motor Driver Shield, no problem.

Re: DC motor driver shield newbiew help plizz :(

PostPosted: Thu Mar 28, 2013 10:22 am
by yonghui
agree with what sharul said. u need external power for the motor. usb cant provide motor's power.
i am not so sure if there is selector jumper on the shield to select internal motor power from the vin. u will need to plug 12V to the arduino main board power jack in this case.

Re: DC motor driver shield newbiew help plizz :(

PostPosted: Thu Mar 28, 2013 10:37 am
by armienz30
thx for help me, iam using 2Amp motor driver shield, i bought from cytron, i afraid the motor driver is not functioning. i have try and use 1.5V x 4 battery to supply the motor shield. but from the admin i bought say it can be power up if attach to arduino board. and the jumper i have check it correctly. the jumper is near the red female pin near the power source for arduino board. iam new for this arduino hardware. it seem the motor didt power up and not move my single small dc motor.

Re: DC motor driver shield newbiew help plizz :(

PostPosted: Thu Mar 28, 2013 3:50 pm
by joliza
The problem is at your PWM pin control.
int E1 = 9;
int M1 = 8;
int E2 = 10;
int M2 = 12;

On your DC motor driver shield, PWM pin used is E1=5, M1=4, E2=6, M2=7. Try to change your PWM control and reload the code.

Re: DC motor driver shield newbiew help plizz :(

PostPosted: Sat Mar 30, 2013 8:47 am
by armienz30
joliza WROTE:The problem is at your PWM pin control.
int E1 = 9;
int M1 = 8;
int E2 = 10;
int M2 = 12;

On your DC motor driver shield, PWM pin used is E1=5, M1=4, E2=6, M2=7. Try to change your PWM control and reload the code.


thx joliza it working i change it to 5,6,7 and 8 tqvm.. appreciate your advice :D

Re: DC motor driver shield newbiew help plizz :(

PostPosted: Thu Apr 18, 2013 8:04 pm
by armienz30
can any one help me how to build program code for below picture.

iam try to change the motor rotation when the pushbutton is push once. the push button is act as like a sensor.
and the detail for the pushbutton is it on when is push and release it will off. the condition is only push the button once and not hold it. plizz cannot find any solution.


iam understand that if want to change direction of motor direction just change high or low on digitalwrite.
my problem is how to write/ give instruction to arduino mega.

the initial program

int E1 = 5;
int M1 = 4;
int E2 = 6;
int M2 = 7;
void setup()
{
pinMode(M1, OUTPUT);
pinMode(M2, OUTPUT);
}
void loop()
{
int value;
for(value = 0 ; value <= 255; value+=5)
{
digitalWrite(M1,LOW);
digitalWrite(M2, HIGH);
analogWrite(E1, 255); //PWM Speed control
analogWrite(E2, 255); // PWM Speed control
delay(30);
}
}


the above run normally, credited to jollax

Re: DC motor driver shield newbiew help plizz :(

PostPosted: Fri May 03, 2013 11:28 am
by armienz30
armienz30 WROTE:can any one help me how to build program code for below picture.

iam try to change the motor rotation when the pushbutton is push once. the push button is act as like a sensor.
and the detail for the pushbutton is it on when is push and release it will off. the condition is only push the button once and not hold it. plizz cannot find any solution.


iam understand that if want to change direction of motor direction just change high or low on digitalwrite.
my problem is how to write/ give instruction to arduino mega.

the initial program

int E1 = 5;
int M1 = 4;
int E2 = 6;
int M2 = 7;
void setup()
{
pinMode(M1, OUTPUT);
pinMode(M2, OUTPUT);
}
void loop()
{
int value;
for(value = 0 ; value <= 255; value+=5)
{
digitalWrite(M1,LOW);
digitalWrite(M2, HIGH);
analogWrite(E1, 255); //PWM Speed control
analogWrite(E2, 255); // PWM Speed control
delay(30);
}
}


the above run normally, credited to jollax

i have solve the problem.. i just using swap command later i post it