two stepper motor and big easy driver

I am working on dual axis. I want to compare each sensor ( I have four sensor) the highest sensor to make the motor to move to that direction.
but after map the reading and run the program, my program stall at 360 and shutdown.

I want to move motor to a certain degree as well but I don’t know how to implement it, any idea will be great

I don’t know how to resolve it. I am new to arduino

see attachment

original notepad senior design.txt (4.09 KB)

enginetech:
I am working on dual axis. I want to compare each sensor ( I have four sensor) the highest sensor to make the motor to move to that direction.
but after map the reading and run the program, my program stall at 360 and shutdown.

I want to move motor to a certain degree as well but I don’t know how to implement it, any idea will be great

I don’t know how to resolve it. I am new to arduino

see attachment

OK a couple of things

  1. When you post code - use the code button above rather than in notepad to put the code on the screen and format it correctly

  2. I think you need to take a look at your code and tidy it a little - you have sensors called Top and Bottom - but really wouldnt they be front and back with your others ones being left and right ?

  3. You should look at the easy driver samples on this page to getting a better idea how to drive it

http://www.schmalzhaus.com/EasyDriver/Examples/EasyDriverExamples.html

  1. You need to do a couple of things such as keeping a cumulative total of the number of steps taken by each motor so that you can work out where you are at at any point in time.

I can not really understand the logic you are using in terms of calculating the direction to turn - i would suggest more comments in your code to allow us to understand what you are trying to achieve.

Craig

thanks for reply Craig

I am new to arduino forum and this is my first post. I am learning as I go as far as post the code

Not only I wanted to move specific direction, I have others but I know the rest once I get the motor to move to the direction of light intensity. since I have four sensor (think they lay on flat surface box square in 4 dimension).

I wanted to read all of them and make one motor to move to specific sensor. May be the way I code is terribly and there is a way around it, pls let me kow.

I checked the links you sent to me. I looked at it before I post the code.

the only problem I have that I can't use that link, the link just move the motor back and front. While I am try to compare sensor values and move to the most one that has most maximum intensity of light.

enginetech:
thanks for reply Craig

I am new to arduino forum and this is my first post. I am learning as I go as far as post the code

Not only I wanted to move specific direction, I have others but I know the rest once I get the motor to move to the direction of light intensity. since I have four sensor (think they lay on flat surface box square in 4 dimension).

I wanted to read all of them and make one motor to move to specific sensor. May be the way I code is terribly and there is a way around it, pls let me kow.

Post all of your code using the CODE tags above

What criteria are you using for choosing what direction to move in ? i.e. the sensor with the most light showing ?

Before you do any of that you need to break this down into manageable chunks

  1. Get the motors working - forwards, backwards, left, right etc etc
  2. Get the light sensors working and giving reproducible readings and then flash an LED or output to serial the values you are seeing

Once you have this you can then start making decisions on what to do with those values

Craig

thanks
I am working on that.

I have another quick question. how will you know the setting for maxspeed and setAcceleration ? I am using stepper motor 0.9 degree per phase

void setup()
{
Serial.begin(9600);
stepper.setMaxSpeed(3000);
stepper.setAcceleration(1000)
}

I want to change this number, but what is the idea behind setting the acceleration so I know what number to put on. I know what It means in physics but as far as the motor and programming the arduino I don't know.

what is the idea behind setting the acceleration

Acceleration is the rate of change of speed. How fast do you want to go from stopped to N rpm?

Acceleration is the rate of change of speed. How fast do you want to go from stopped to N rpm?

I know what it mean, I don't know how much you have to set in reference to maxSpeed.

I don't know how much you have to set in reference to maxSpeed.

You didn't answer the question, or you'd know the answer. If you want to take 1 second to go from stopped to maxSpeed, you'd use one value. If you want to take three weeks to go from stopped to maxSpeed, you'd use another value.

enginetech:

Acceleration is the rate of change of speed. How fast do you want to go from stopped to N rpm?

I know what it mean, I don't know how much you have to set in reference to maxSpeed.

Post your code as previously requested and let us know what libraries you are using - i assume you have bothered to read the doco with the Accelerstepper library as it appears that is what you are using (and if not - should be)

Craig