LCD keypad shield+Arduino Motor Shield (L298N)+stepper motor with SD02B driver

hi,,,can anyone help me how to interface arduino uno rev3 with unipolar stepper motor by using motor shield l298n and controlled by lcd keypad shield.im new for this programming..i just heard that arduino is more better than other microcontroller. :D.

i just heard that arduino is more better than other microcontroller.

That's hardly breaking news. We've known that for a while.

can anyone help me how to interface arduino uno rev3 with unipolar stepper motor by using motor shield l298n and controlled by lcd keypad shield.

Sure. How much are you willing to pay?

im new for this programming.

Then why did you take on this assignment?

Having gotten that out of the way, have you any links to the hardware that you have? There are dozens of motor shields based on the L298N chip. Each is subtly different.

Have you got a link to the LCD keypad shield you are using?

Have you got any idea how to connect the stepper motor to the motor shield? Which motor is it?

Finally, what, exactly does "interface arduino uno rev3 with unipolar stepper motor by using motor shield l298n and controlled by lcd keypad shield." mean?

The interface between the motor shield and the Arduino is pretty much defined by the idiot proof arrangement of the pins. That is, it only fits one way.

The interface between the motor shield and the motor is pretty straightforward. What it is, though, is not a programming issue.

The interface between the LCD keypad shield and the Arduino is the same as that for the motor shield. One way that it fits.

So, that leaves control as the remaining issue. What, exactly, do you want to make the motor do when the 3rd switch on the keypad shield is pressed? When it is released? What about the 4th switch?

You need to start with defining your software requirements. Until you do that, there is no programming to be done. And, of course, you need to work out your hardware issues before tackling the software issue.

this is link for my motor shield:

this is link for my lcd keypad shield:
http://www.dfrobot.com/wiki/index.php?title=Arduino_LCD_KeyPad_Shield_(SKU:_DFR0009)

this is link for my stepper motor:

this is link for my Enhanced 2A Stepper Motor Driver:

actually i don't no how to connect Enhanced 2A Stepper Motor Driver with my arduino rev3, what i konw is Enhanced 2A Stepper can connect with arduino rev3 by using UART. below is my sample programming by using dc geared motor.

this is my sample of programming:
#include <LiquidCrystal.h>

/*
The circuit:

  • LCD RS pin to digital pin 8
  • LCD Enable pin to digital pin 9
  • LCD D4 pin to digital pin 4
  • LCD D5 pin to digital pin 5
  • LCD D6 pin to digital pin 6
  • LCD D7 pin to digital pin 7
  • LCD R/W pin to ground
    */

LiquidCrystal lcd(8, 9, 4, 5, 6, 7);

//Keypad Button Numbering
#define RG 0
#define UP 1
#define DW 2
#define LF 3
#define SEL 4

//constant variable
const int mtr1_In1 = 5;
const int mtr1_In2 = 6;
const int mtr2_In1 = 4;
const int mtr2_In2 = 7;

int analogPin = A0;
int adc_key_old;
int adc_key_in;
int NUM_KEYS = 5;
int adc_key_val[5] ={30, 150, 360, 535, 760};

/*******************************************************************************

  • PRIVATE FUNCTION: setup()
  • PARAMETERS:
  • ~ void
  • RETURN:
  • ~ void
  • DESCRIPTIONS:
  • Define of I/O pin as Input or Output

*******************************************************************************/
// The setup() method runs once, when the sketch starts
void setup ()
{
//Set the mode for each digital pins whether input or output
pinMode(mtr1_In1, OUTPUT);
pinMode(mtr1_In2, OUTPUT);
pinMode(mtr2_In1, OUTPUT);
pinMode(mtr2_In2, OUTPUT);

lcd.begin(16, 2); // set the lcd dimension
lcd.clear(); // LCD screen clear
lcd.setCursor(0,0);

adc_key_old = analogRead(analogPin); // store the unpress key value
}

/*******************************************************************************

  • PRIVATE FUNCTION: loop()
  • PARAMETERS:
  • ~ void
  • RETURN:
  • ~ void
  • DESCRIPTIONS:
  • Non-Stop looping

*******************************************************************************/
void loop()
{
adc_key_in = analogRead(analogPin); // read ADC value
adc_key_in = get_key(adc_key_in);
lcd.clear();

if(adc_key_in == UP) // Check whether Up button pressed
{ // Move forward
analogWrite(mtr1_In1, 220);
digitalWrite(mtr1_In2, HIGH);
analogWrite(mtr2_In1, 220);
digitalWrite(mtr2_In2, LOW);
lcd.setCursor(0, 1);
lcd.print("Move Forward");
delay(200);
}

else if(adc_key_in == DW) // Check whether Down button pressed
{ // Move backward
analogWrite(mtr1_In1, 220);
digitalWrite(mtr1_In2, LOW);
analogWrite(mtr2_In1, 220);
digitalWrite(mtr2_In2, HIGH);
lcd.setCursor(0, 1);
lcd.print("Move Backward");
delay(200);
}

else if(adc_key_in == LF) // Check whether Left button pressed
{ // Rotate to left
analogWrite(mtr1_In1, 150);
digitalWrite(mtr1_In2, LOW);
analogWrite(mtr2_In1, 220);
digitalWrite(mtr2_In2, LOW);
lcd.setCursor(0, 1);
lcd.print("Rotate to Left");
delay(200);
}
else if(adc_key_in == RG) // Check whether Right button pressed
{ // Rotate to right
analogWrite(mtr1_In1, 220);
digitalWrite(mtr1_In2, HIGH);
analogWrite(mtr2_In1, 150);
digitalWrite(mtr2_In2, HIGH);
lcd.setCursor(0, 1);
lcd.print("Rotate to Right");
delay(200);
}

else
{ // Display button navigation for each movement
lcd.setCursor(0,0);
lcd.print("UP=FW DW=BW");
lcd.setCursor(0,1);
lcd.print("LF=LF RG=RG");
delay(200);
analogWrite(mtr1_In1, 0);
analogWrite(mtr2_In1, 0);
}
}

/*******************************************************************************

  • PRIVATE FUNCTION: get_key
  • PARAMETERS:
  • ~ integer
  • RETURN:
  • ~ unsigned int input
  • DESCRIPTIONS:
  • convert the ADC value to number between 0 to 4

*******************************************************************************/
int get_key(unsigned int input)
{
int k;

for (k = 0; k < NUM_KEYS; k++)
{
if (input < adc_key_val[k])
{
return k;
}
}

if (k >= NUM_KEYS)
k = -1; // No valid key pressed

return k;
}

but it doesnt work.... =(

this is link for my motor shield:

Which says:

There is currently no text in this page.

this is link for my lcd keypad shield:

Which says:

There is currently no text in this page.

this is link for my Enhanced 2A Stepper Motor Driver:

Are you using the Enhanced 2A Stepper Motor Driver or the motor shield? They serve the same purpose.

but it doesnt work.

Well, since I don't know what hardware you are actually using, or what "doesn't work", I can't help you.

If you explained what that does, what it doesn't do, which hardware you are actually using, and how it is connected, then maybe.

sorry forgot the bracket :sweat_smile:,
for arduino motor shield:

for lcd keypad shield:
http://www.dfrobot.com/wiki/index.php?title=Arduino_LCD_KeyPad_Shield_(SKU:_DFR0009)

im planning to use both of motor shield and enhanced 2A stepper because maybe i will use another servo motor.enhance 2A stepper motor will drive stepper motor while motor driver will drive servo motor.

for the programming that i have been post earlier.. my problem is when i push button on lcd keypad shield my dc motor is not moving. :frowning:

please put end bracket at the end of link...i dont know why the bracket dissaperad...

Arduino_Motor_Shield__L298N___SKU_DRI0009_-DFRobot)
Arduino_LCD_KeyPad_Shield__SKU__DFR0009_-DFRobot)

Both shields require pins 4, 5, 6 and 7.

im planning to use both of motor shield and enhanced 2A stepper because maybe i will use another servo motor.

You don't need a motor shield to drive a servo. Just an alternate power source, connected to the servo, with ground connected to the Arduino, too.

please put end bracket at the end of link...i dont know why the bracket dissaperad...

Because you aren't putting the parens inside the url tags.

actually i don't no how to connect Enhanced 2A Stepper Motor Driver with my arduino rev3

You don't have the stepper motor driver connected to the Arduino, and the motor won't move when you run that code. Small wonder.

as i know the Enhanced 2A Stepper Motor Driver have Vmotor,GND,PULSE,DIR,EN,*Vin...so how i connect this pin to my arduino board?? which pin should i choose to make my stepper motor move? should i define first in programming??.

as i know the Enhanced 2A Stepper Motor Driver have Vmotor,GND,PULSE,DIR,EN,*Vin...so how i connect this pin to my arduino board??

The page you linked to has several downloads available. I'd think that #3 and #5 might prove especially useful.

PaulS:

as i know the Enhanced 2A Stepper Motor Driver have Vmotor,GND,PULSE,DIR,EN,*Vin...so how i connect this pin to my arduino board??

The page you linked to has several downloads available. I'd think that #3 and #5 might prove especially useful.

i have already run the sample source code and it works well. but tutorial given only using UART connection is using serial monitor to move the stepper motor. my project have to use the lcd keypad shield to control the stepper motor speed. any other method how to connect arduino with enhanced 2A stepper motor driver?. XD

but tutorial given only using UART connection is using serial monitor to move the stepper motor.

The sample sketch is using the serial port to control the motor. No Serial Monitor is involved in the process.

If you don't want to use the hardware serial port (pins 0 and 1), use some other pins and SoftwareSerial (or NewSoftSerial for 0023 and earlier).

my project have to use the lcd keypad shield to control the stepper motor speed.

So, the keypad will be used to collect the speed data, and the serial port (hardware or software) will be used to convey that information to the motor controller.

any other method how to connect arduino with enhanced 2A stepper motor driver?

Duct tape? Twine? Hot melt glue?