Welcome! Log In Create A New Profile

Advanced

Arduino & KL23H251

Posted by Pradeep Tumati 
Arduino & KL23H251
February 23, 2008 10:05PM
Hi Everyone,

This is my very first electronics project and so please bare with me on this na
Re: Arduino & KL23H251
February 23, 2008 10:09PM
Pardon me for a small typo:

Blue goes to OUTA2
Its not "Blue goes to INA2" as indicated above
Re: Arduino & KL23H251
February 24, 2008 07:22PM
hello,

without knowing exactly how you have the circuit setup, i cant tell you *exactly* what your problem is.

however, there is one thing that sticks out: in order to drive a stepper motor you need to send a specific sequence of step signals. for the most straightforward mode, 'full step' there is a 4-signal sequence that is repeated.

see this page for more info: [www.piclist.com]

good luck!
Re: Arduino & KL23H251
February 25, 2008 01:31PM
Thanks for the link. I guess I understand whats going on here. The program that I came up with does not following the sequence that you had mentioned. Let me try this today and see how things go...
Re: Arduino & KL23H251
February 25, 2008 06:56PM
basically your program was making the stepper go forward and backward one step over and over (and not moving).

let us know how it goes!
Re: Arduino & KL23H251
February 25, 2008 10:33PM
Yes, now I get the problem. Thanks so much for your time.

My program is wrong in the first place. Here's the updated Arduino program.

I used the following program to interface Arduino with NJM2670

int enablePin = 4; // select the input pin for the potentiometer
int intA1 = 3;
int intA2 = 4;
int enA = 5;
int intB1 = 6;
int intB2 = 7;
int enB = 8;
int delayTime=20;
int slow = 0;

void setup() {
pinMode(enA, OUTPUT); // declare the ledPin as an OUTPUT
pinMode(intA1, OUTPUT); // declare the ledPin as an OUTPUT
pinMode(intA2, OUTPUT); // declare the ledPin as an OUTPUT
pinMode(enB, OUTPUT); // declare the ledPin as an OUTPUT
pinMode(intB1, OUTPUT); // declare the ledPin as an OUTPUT
pinMode(intB2, OUTPUT); // declare the ledPin as an OUTPUT
shutdown();
}
void shutdown()
{
digitalWrite(intA1, LOW); // sets the LED off
digitalWrite(intA2, LOW); // sets the LED off
digitalWrite(intB1, LOW); // sets the LED off
digitalWrite(intB2, LOW); // sets the LED off
digitalWrite(enA, LOW); // sets the LED off
digitalWrite(enB, LOW); // sets the LED off

}

void loop() {
//Step 1 Coil A +
digitalWrite(intA1, LOW); // sets the LED off
digitalWrite(intA2, HIGH); // sets the LED off
digitalWrite(intB1, LOW); // sets the LED off
digitalWrite(intB2, LOW); // sets the LED off
digitalWrite(enA, HIGH); // sets the LED off
digitalWrite(enB, LOW); // sets the LED off
delay(delayTime);
shutdown();
delay(slow);

//Step 2 Coil B +
digitalWrite(intA1, LOW); // sets the LED off
digitalWrite(intA2, LOW); // sets the LED off
digitalWrite(intB1, LOW); // sets the LED off
digitalWrite(intB2, HIGH); // sets the LED off
digitalWrite(enA, LOW); // sets the LED off
digitalWrite(enB, HIGH); // sets the LED off
delay(delayTime);
shutdown();
delay(slow);
//Step 3 Coil A -
digitalWrite(intA1, HIGH); // sets the LED off
digitalWrite(intA2, LOW); // sets the LED off
digitalWrite(intB1, LOW); // sets the LED off
digitalWrite(intB2, LOW); // sets the LED off
digitalWrite(enA, HIGH); // sets the LED off
digitalWrite(enB, LOW); // sets the LED off
delay(delayTime);
shutdown();
delay(slow);

//Step 4 Coil B -
digitalWrite(intA1, LOW); // sets the LED off
digitalWrite(intA2, LOW); // sets the LED off
digitalWrite(intB1, HIGH); // sets the LED off
digitalWrite(intB2, LOW); // sets the LED off
digitalWrite(enA, LOW); // sets the LED off
digitalWrite(enB, HIGH); // sets the LED off
delay(delayTime);
shutdown();
delay(slow);
}
Re: Arduino & KL23H251
February 26, 2008 11:27AM
cool, good luck with your program!
Sorry, only registered users may post in this forum.

Click here to login