Go Down

Topic: Arduino uno R3 stepper motor control (Read 12422 times) previous topic - next topic

JimboZA

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.
Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

neksmerj

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

neksmerj

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

JimboZA

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.
Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

neksmerj

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

neksmerj

Eureka, it works.

I don't know what I did, but it just started to blink slowly. I changed the delay time, and it responded.

Now onto the next exercises, this is going to be fun. I feel like a kid in the candy shop.

Ken


JimboZA

If the IDE says it uploaded I'd be inclined to believe it, but did the Tx and Rx lights flicker during the upload?

You could edit these lines into setup() and view the output in the serial monitor. Open the serial monitor with Tools > Serial Monitor, or Ctrl-Shift-M, or hit the icon top right. Opening the monitor resets the board so setup runs again.

Code: [Select]

Serial.begin(9600);
Serial.println("Hello, World");


If you get this output then you would know it uploaded and is running.
Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

JimboZA

Johannesburg hams call me: ZS6JMB on Highveld rep 145.7875 (-600 & 88.5 tone)
Dr Perry Cox: "Help me to help you, help me to help you...."
Your answer may already be here: https://forum.arduino.cc/index.php?topic=384198.0

neksmerj

This may be a dumb question, but.....

Looking through some of the Arduino examples, I see there is a facility to copy the code (sketch)

When I hit this dialogue box, nothing seems to happen. I'm using Windows7 and as far as I know, the clipboard function has been dropped, so where do I recover the sketch file from?

Ken

Robin2

I feel like a kid in the candy shop
That's great. Now you should spend a bit of time working through some of the Arduino examples so that you learn how code is constructed.

Sorry - I don't use Windows so I don't know exactly where your programs (sketches) are stored. If you click the preferences button in the Arduino IDE I think it tells you.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Robin2

If you had the time to look at my project and write a tutorial for dummies,
If you can write an outline of what the tutorial should cover I will think about it.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

neksmerj

Hi Robin2,

Thank you for thinking of writing up a tutorial re control of stepper motors, and in particular, a camera slider. As soon as I have time, I will outline how I think the project should work.

I am working through the Arduino worked examples, firstly "blink" that tests the board, so far so good.

Many thanks in advance,

Ken

Robin2

control of stepper motors, and in particular, a camera slider
This is a common subject on the Forum. Have you searched for other Threads on the subject. Use Google - for example camera slider site:arduino.cc

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

neksmerj

#28
Nov 12, 2014, 11:10 am Last Edit: Nov 12, 2014, 11:31 am by neksmerj
Hi Robyn2,

I have searched for other camera slider projects, and to me, they seem quite complex. They probably aren't that complicated, just to my inexperienced brain.

I'm going to use the same hardware as this one  http://computers.tutsplus.com/tutorials/motion-control-with-arduino-motorising-a-camera-slider--cms-21539

HARDWARE

For me I just want a track fitted with a carriage, all openbuild stuff. At one end a nema17 stepper motor, the other, an idler pulley. The carriage will be driven forwards and backwards with a toothed belt.

ELECTRONICS

I would like to use an Arduino uno R3 board fitted with an Adafruit stepper motor controller.
A 3-position switch, or two pushbuttons, will drive the carriage in one direction or the other until a limit switch is triggered. A potentiometer will control speed.

With the 3-position switch midway, no power will be sent to the motor and the carriage can be pushed to one end or the other.

That's about it unless someone can suggest some improvements.

The whole kit and caboodle will be used in the field, and hence, be powered by a decent 12v battery.

AFTER THOUGHT

I'm just wondering whether the carriage should stop when a shot is being taken.

I have no idea how this could be done.

Ken


Robin2

I have no idea how this could be done.
This is the problem. I can try to help you sort out how to do things but you have to have something that forms the basis for a question.

What you have described seems eminently feasible. Are you confident that you can do the mechanical construction?

One of the links I gave you earlier has code to make a stepper move back and forth in response to push buttons.

Most stepper drivers have ENABLE pins which you can activate to de-power the motor to allow it to freewheel.

Stepper motors are inefficient. I hope you are planning for a big 12v battery.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up