# Help with programming (Step Motor)

Hi everybody,
I have a problem I wish if you can help me with it.

I have a Stepper Motor connected with Arduino Uno which is connected as well with Voltage Sensor.
The sensor is connected to Electrical Generator.

The sensor is going to read the voltage of the generator (that changes from time to time) and according to this changes is going to turn the step motor.

The sensor will sense the voltage of the generator when the stepper at specific position (let us say now position1) then at certain limit of low voltage of the generator (let us say 2.4/5 V) will decide to turn the stepper motor to move a step, then sense the voltage of the generator at that step. (the generator voltage will change if we turn the stepper motor)

The motor has to move 12 steps totally (180 degree since the stepper motor can do 7.5 degree and I am moving 15 degree every time) .. at each step the Arduino reads the voltage and record it then finally decide at which step was the highest voltage then return back to that step.

My problem here is how to let the Arduino remember the steps position?
or how can I define that this is the step one, two .. until 12, so when I want it to return to a step directly I can do so.
and how to record the reading of each step then choose the highest value that is associated with specific angle (step) then return back to that angle.

Actually this project is for wind turbine the step motor is connected with the blades by small gear mechanism.
I am going to change the angle of the blades when the generator produces low electricity because of the low wind speed .. this way I can keep the production of electricity as high as possible even if the wind speed changes.

I have done some programming but I do not think it works.

Please inform me if you need any additional details to understand the issue.
and thank you very much.

could anybody give even a hint please

What sort of generator are you using?
What is powering it?
If the stepper motor can control the generator in some way, explain how.

Post a link to the datasheet for the stepper you are using
Post a link to the datasheet for the stepper motor driver you are using

...R

My problem here is how to let the Arduino remember the steps position?

Use a variable.

or how can I define that this is the step one, two .. until 12, so when I want it to return to a step directly I can do so.

You seem to have some fundamental misunderstanding of what a stepper motor actually does. It steps - one tiny rotation. You need to determine how many steps you need to take to accomplish a task. Or, you step until the result is what you want, and you count, if needed, the number of steps it took to achieve that result.

It sounds as if your stepper motor is giving mechanical feedback to the generator (or whatever drives it).
But why do that, as the faster the generator turns, the higher the voltage it will produce?

Thank you very much for reply

Robin2
I have generator produce 1000W, 6A, 166V DC,
stepper motor MITSUMI M35SP-7NP,
ARDUINO Uno,
H-bridge L298N
and I will use voltage sensor

I have done the connection between this components except for generator because i do not have the sensor that can handle 170V .. and if i use voltage divider I have to handle the 6A.

the power of the generator is form the wind

my project is (Wind Turbine work with Pitch Control Mechanism)

the wind rotate the generator, the generator produce certain voltage, when the wind speed is low the voltage decreases, I change the angle of the blades (by the stepper motor) trying to keep the left force over the blades as best as possible so the rotation stays at the optimum speed ( I am trying to reduce the effect of the change of the wind over the electricity production by changing the angle of the blades according to the voltage readings)

my problem is how to do a code start working when the voltage of generator drops to half for instance .. and to start moving 15 degrees and to read the voltage at the that degree then another 15 degrees and so on.. 12 times ( 12*15 =180) .. and record all the readings

then decide where was the highest voltage at which step then return back to that step

PaulS

I have the stepper motor connected with small gear mechanism inside the hub of the wind turbine so i can rotate the blades all together by the stepper motor.

my stepper motor can do 7.5 degree .. i am actually moving 15 degrees at time .. then I read the voltage of generator and record it then move another 15 degrees .. i do that 12 time .. until i finish 180 degrees
then i choose the highest voltage that i record then i return back to that angle (or step) associated with that voltage ( for example if it was step 5 form the 12 that gives me the highest volt .. i have to made the Arduino return to step 5 after finishing 12 steps)

I am trying to do this code

I do not know how to order the Arduino to return back after finishing the 12 readings
this is my problem

Henry_Best

In wind energy production you do not want the wind turbine to rotate as fast as possible ..there is an optimum angle that gives the highest efficiency.. you need to be near that point ..
also there is limit of rotation if you exceed it you burn the generate.

HumamARDUINO:
I have generator produce 1000W, 6A, 166V DC,
stepper motor MITSUMI M35SP-7NP,
ARDUINO Uno,
H-bridge L298N
and I will use voltage sensor

Please provide a link to the datasheet for the motor so we can view its specifications.

An L298 is a poor choice for driving a stepper motor. If it is a bipolar motor it would be much better to control it with a proper stepper motor driver such as a Pololu A4988 (but I don't know what current your motor requires). This would also greatly simplify the programming because a proper driver just needs step and direction signals from the Arduino.

I would be seriously concerned that a stepper motor will consume too much of the wind-turbine's output. They are very inefficient and need full current even when stationary.

...R