PDA

View Full Version : Arduino uno R3 stepper motor control



neksmerj
8th November 2014, 04:13 PM
What I need is a tutorial on writing code to control an Arduino + Adarfruit stepper motor controller to drive a nema17 stepper motor.

Simple controls such as a 3 position switch to select forward, stop and reverse plus a potentiometer to control speed.

I know absolutely nothing about programming so would appreciate with each line of code, an explanation of what's occurring together with the meanings of each character.

I've seen many lines of code and as far as I'm concerned, I might as well be trying to read Greek.

I reckon I've got the physical wiring down pat from Google, just need the code.

If you can spare the time to explain things, I would be extremely grateful

Ken

Edit

Once I have the code, how do I get it into my computer, and then into the Arduino?

neksmerj
9th November 2014, 05:25 PM
This is unbelievable, 101 views and not one comment.

Surely one of our members has some experience with programming Arduino boards.

I'm getting more support from the metalwork forum, and this is an electronics topic.

Ken

Malibu
9th November 2014, 06:32 PM
Sorry Ken, I can't help...

I might be able to resurrect my MCS51 memories if I tried hard (it's been 15 years since I used that particular family of chips, so my machine code brain cells have probably rusted away), or maybe I could help with some code for PIC Micro's - mainly the 16F series which I used a couple of years ago. Not the Arduino stuff though, sorry.
For what you're trying to do (re - the camera slider), I'd probably use a simple pulse generator with a dedicated stepper drive. Even a 555 chip would do it simply enough, but you might have some variations in the time base for reliable duplication.
For me, I'd go with a 16Fxx micro and generate a pulse stream from that.

Maybe ask here - http://forum.arduino.cc/. I'm sure someone there will know how to do it...

RustyArc
9th November 2014, 07:13 PM
I think you've got no responses because you've asked a hell of a lot. It's like saying I've got zero experience with metalworking, but I've bought a lathe and I want to make this part, can you give me step-by-step instructions how to do it. By the way, how do you get the lathe to hold the work?

The normal approach to getting up to speed on an Arduino is to read a few of the many tutorials on how to get started - this will cover how to connect it to your PC, how to write, compile and upload sketches and make it do basic things like flash an LED.

Then you'd hunt down some sample code for the stepper shield you have, try it out and see what it does. Then you'd start to modify it bit-by-bit until it does what you want it to.

neksmerj
9th November 2014, 07:42 PM
Hi RustyArc,

I've ploughed through many programs, but without knowing what each step does and what each character means, I might as well be trying to read Greek.

I was just hoping one of our members had a program for controlling a stepper motor, forward, stop reverse and speed using Arduino.

Don't reckon I'm asking too much.

Ken

Driftabout
10th November 2014, 06:56 AM
http://www.youtube.com/user/makecourse/videos

Ken

YouTube has some detailed tutorials
for example the ones linked above. These run from Arduino basics through to programming steppers

Pearo
17th November 2014, 11:07 PM
I have looked at some ardunio code and it looks very c like to me. I dont do much c anymore outside of windows drivers, but the go to book is kernaghan and ritchies book "the c programming language".

Understand that with c and everything microcontrollers, you need some basic understanding of the processor architecture, so you will need to back up the programming book with the data sheet for the particular processor.