Community
cancel
Showing results for 
Search instead for 
Did you mean: 
AGUIM2
New Contributor I
1,146 Views

Stepper motor control with intel edison kit for arduino

Hello everybody,

I'm a beginner in the use of intel edison platform. I've a problem in control a step motor with the arduino board intel edison. I've an arduino motor shield which is supposed to help me to control a stepper motor. But when I upload the following program, the moteur does not work. Can't anyone have a solution for me please? This is my program:

# include

//Define output

# define enA 3 // Enable (PWM)A on Motor Control Shield

# define enB 11 // Enable (PWM)B on Motor Control Shield

# define dirA 12 // Direction pin dirA on Motor Control Shield

# define dirB 13 // Direction pin dirB on Motor Control Shield

const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution

// for your motor

// initialize the stepper library on pins 8 through 11:

Stepper myStepper(stepsPerRevolution, dirA, dirB);

void setup() {

//Initialisation des sorties

pinMode(enA, OUTPUT);

pinMode(enB, OUTPUT);

//Définition de l'état initial (Stepper)

digitalWrite (enA, HIGH);

digitalWrite (enB, HIGH);

// set the speed at 60 rpm:

myStepper.setSpeed(60);

// initialize the serial port:

Serial.begin(9600);

}

void loop() {

// step one revolution in one direction:

Serial.println("clockwise");

myStepper.step(stepsPerRevolution);

delay(500);

// step one revolution in the other direction:

Serial.println("counterclockwise");

myStepper.step(-stepsPerRevolution);

delay(500);

}

7 Replies
Sergio_A_Intel
Employee
170 Views

Hi,

Specifically, what motor shield are you using? What image version and Arduino IDE version do you have?

Does the code upload successfully? Is there any log shown in the Arduino IDE related to the error? There is a section in the Edison shield testing report about the motor shield. Make sure you have already reviewed this document http://www.intel.com/content/www/us/en/support/boards-and-kits/000005913.html Intel® Galileo and Intel® Edison Board Shield Testing Report for... .

Sergio

AGUIM2
New Contributor I
170 Views

Hi Sergio,

First thanks for your response. I'm using the arduino motor shield V3 describe on this link. I also use the 1.6.7 version of arduino. I confirm that the code uploads very well. That's why I can see the serial.println message on the arduino serial monitor. I'm hearing noice on the motor like if it wanted to work but it doesn't even if there is light on the four driving connnectors of the motor.

After reading the document on the link you sent me, i've added the line "setPwmSwizzler(3, 5, 10, 11);" in my program and also set the jumpers used for Arduino motor shield V3. I've also hear about pin function multiplexing control. Should I have to set the internal GPIO pins o(on linux terminal) before use them?

Here, a picture of my installation.

Please, I'm really stuck on. Thanks you in advance for your answer.

Sergio_A_Intel
Employee
170 Views

Make sure the motor is receiving enough current. If you hear a noise of the motor as if it's trying to move, but it doesn't, it might be related to lack of power. Also since you've set the setPwmSwizzler(3, 5, 10, 11); function take a look at http://www.instructables.com/id/PWMSwizzling-an-Edison-Arduino-Breakout-to-work-wi/?ALLSTEPS PWMSwizzling an Edison Arduino Breakout to work with Grove Seeed Motor Shields - All .This link is for the Grove shield but some of the topics described in the guide also apply for your case.

Hopefully you can find this useful.

Sergio

AGUIM2
New Contributor I
170 Views

Hi Sergio, *$

I want to thank you for your help. You were right about the lack of power of the motor. I've seen that some pins I was using gave 1.8V instead of 3.3V to command the motor. I'm thinking to buy another motor whitch can be control by 1.8Volts.

But I've another question: Do you think it's better to program the intel Edison card with the Arduino IDE or another IDE and with one to maje an application with wifi, bluetooth, motor, SD card?

It'll be usefull for me to have your view on this. Thanks in advance for your answer.

Sergio_A_Intel
Employee
170 Views

The IDE you use depends very much on the application you want to make and the programming language you feel most comfortable with. The Arduino IDE is the most beginner oriented IDE. It contains lots of code examples for different applications such as, Wi-Fi, servos, steppers, SD cards, etc. Other IDEs such as the XDK and Eclipse are also powerful tools that have features of their own. You can see more information on some of these features and the programming languages you can use in each one here https://software.intel.com/en-us/iot/software/ide IoT - IDEs | Intel® Developer Zone

Sergio

AGUIM2
New Contributor I
170 Views

ok, I hope to stay on arduino. It's the one I'm accustom.

But I've another question: I want to communicate with a touch screen by the serial port on prins0 and 1. But because of the multiplexor, I've difficulties on configuring those pins as UART in the arduino sketch. I've seen that it's possible in the linux terminal by doing some command like "system("echo 251 > /sys/class/gpio/export");". But is it not possible to do this configuration in arduino sketch?

Sergio_A_Intel
Employee
170 Views

Yes, actually if you want to perform Linux commands inside of Arduino sketches you should look at the system() function, just like the one you described in your previous post.

In your example, you wrote "system("echo 251 > /sys/class/gpio/export");" which is the same as typing echo 251 > /sys/class/gpio/export in the Linux terminal.

You can see more information of system here http://linux.die.net/man/3/system system(3): execute shell command - Linux man page

Sergio

Reply