Arduino uno R3 stepper motor control

Not long ago, Robin2 wrote a terrific article entitled:-

Planning & implementing an Arduino program, see here http://forum.arduino.cc/index.php?topic=261445.0

I would be extremely grateful if a similar tutorial could be written to drive a nema 17 stepper motor utilizing an Arduino uno R3 board,and an Adafruit stepper motor board.

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

What I would like to see is how each line of code is developed with an explanation of what each piece of code means along with the meaning of each character.

Once I have a piece of code, how do I get it into my computer and transfer it to the Arduino?

As you can tell, I know absolutely nothing about Aduino's or programming.

Hoping someone can throw some light on my short comings.

Ken

Have you looked at ada's own tutorial here?

It looks straightforward: if you haven't looked at it, why not try now and see if it makes sense. Then ask specific questions about things that don't make sense to you.

Thanks Kimbo,

Yes I have looked at the tutorial, but it doesn't describe what each program step does, nor how to get the program into my computer then into the Arduino.

Many thanks anyway.

Ken

That's Jimbo with a "J".... 8)

Getting it into your Arduino's a matter of ctrl-c copying off the screen and ctrl-v pasting into the IDE, then upload.

Seems like you've not yet worked through the examples in the ide, which are also available here. I'm pretty sure that if you worked through some of those, the ada code would make a fair amount of sense and the forum will help with the missing bits.

You would then most likely be able to answer your own questions about switches for direction and a pot for speed.

Jimbo, sorry for misspelling your name.

You are talking to an absolute, total, novice. Reading other sketches means nothing to me. I need an example sketch to control a stepper motor with a line by line description of what each line/character means. I won't know what I'm doing otherwise.

Ken

Yep I get the novice bit, but I think the best way to become a not-a-novice, is to work through the examples that I linked to and which are in the ide in File > Examples.

Then, when you try to understand other code you'll have a fighting chance of figuring it out for yourself. Granted, right now a stepper sketch might make no sense, but it will make sense when you get your mind round some basic concepts.

Don't get me wrong: not refusing to assist, it's just that forum experience is that it's better to go it alone first, then ask for help on specifics. And going it alone, implies working through at least some of those examples.

I am being polite when I say I am confused.

You sent me a PM earlier today with a link to your other Thread - to which I replied that I was waiting for your response to advice I had given on 1 Nov - the same day you started the other Thread.

Now I find you have started a new Thread (quite unnecessarily) asking for advice which I had already given in the other Thread. I still don't know if you read it.

OK - that advice may not cover all of your present question but it covers at least 50% of it - and the rest (detecting buttons) is well covered in my article and in the sticky several things at a time

...R

Hi Robin2

It seems we have crossed paths. The only response I thought I had from you was that you don't respond to PM's, and you suggested that I start a new thread, so that's what I did.

I am new to this forum and am still feeling my way around.

Ken

neksmerj:
I am new to this forum and am still feeling my way around.

Precisely because you are new to the Forum I would assume you are doing a lot of reading - especially in Threads that you have started yourself.

You may be interested in the code in this new Thread

...R

Hi Robin2, you are correct, I am reading as much as time allows.

Can you recommend some books that will give me an insight into the Ardinuo world.

Thanks for your assistance.

Ken

neksmerj:
Hi Robin2, you are correct, I am reading as much as time allows.

Can you recommend some books that will give me an insight into the Ardinuo world.

I haven't got the impression you are reading the stuff I have taken the time to write !

Sorry, I don't have any book recommendations as I have got all my info from the web. There are plenty of Arduino books but I have not read any of them. In a bookshop recently I did glance through one large book about Arduino Robots and the code was very poorly structured - i.e. it seemed to have no structure.

...R

Hi Robin2

I admire your knowledge, and of the few of your threads I have read so far, have learned from you.

I am a little disappointed you are having a go at me, you probably have many hundreds of threads, and obviously, I've not read them all.

Ken

neksmerj:
and obviously, I've not read them all.

I was only referring to the replies I have written specially for you.

Perhaps you did read them as I wrote them but as you have never commented on them I have no way of knowing.

...R

Robin2, fair enough.

I am progressing a little further with my camera slider project. Two weeks ago I had never heard of Arduino or Adafruit products.

I came across an Arduino tutorial called MotorKnob describing how to control the stepper motor speed using a potentiometer.

This I will use. All I need to find out now is where to wire in a 3 position switch for forward, stop and reverse,
and some lines of code.

Just out of curiosity, does it make any difference which order the lines of code are in?

Lots more reading to do.

Ken

neksmerj:
Just out of curiosity, does it make any difference which order the lines of code are in?

The order of the code is one of the most important things.

Computers are stupid. They do things that you tell them in the order you tell them - even if what you tell them is wrong.

Two weeks ago I had never heard of Arduino

If the stuff I have written is too complex for your current level of knowledge you need to tell me and I will be happy to try to explain. But don't just ignore it.

...R

Imagine you were driving your car down the road and were about to make a turn- you have to do two things: judge if it's time to turn, and if it is, turn. (Ok three things- if it's not time to turn, don't.) Rinse and repeat that sequence of look/decide; look/decide.

The sequence is important, since it would be crazy to decide to turn before you had looked to see if you were at the crossing. Well the Arduino is dumber than soup until you give it some instructions, and it will decide then look if that's the order you code the instructions.

You may find it beneficial to look up flowcharting to help you model the program conceptually.... it's a bit old school and there are newer ways to model things, but nevertheless it's a good way of getting the sequence of steps, the algorithm, clear in your mind.

JimboZA, thanks for your advice.

Robin2, you put the words in my mouth, I am not ignoring your input, just having trouble understanding all of it.

If you had the time to look at my project and write a tutorial for dummies, I'm sure a lot of readers would benefit greatly from your knowledge. I still can't find where to place switches and write code for them to control direction of the stepper motor.

I'm over 70 and venturing into the Arduino world is totally new for me, always up for a challenge.

I am a retired product designer and have always had an interest in mechanical and electronic things.

My first Arduino uno R3 board arrived today, my godfather, it's so small, I did not realise.

Time to start playing with some very easy examples from the Arduino library starting with "blink"

Ken

I don't seem to be able to get past first base.

As mentioned earlier, my Arduino board arrived today, so decided to try the "blink" example.

I reckon I've done everything correctly, but it's not doing what it's supposed to do. The green led is on all the time and the orange led is blinking at a constant rate of two blinks per second.

Windows reports all the drivers are installed and working correctly.

I have selected com3 port.

I've tried changing the time delay and it makes no difference.

Any clues?

Ken

Ugggghhhh.

What message do you get when you hit the Upload button?- it should say "done uploading" and give you a message about the sketch size.

upload.PNG

Hi JimboZA,

Yes I get the message that the sketch has uploaded telling me that 1,082 bytes have been uploaded.

Should I try different ports, any other suggestions?

Definitely have the correct board selected, uno.

Ken