PWM and 4-wire stepper motor.

How to use one PWM for 4-wire stepper motor ?

Regards from Qwseyvnd.

Why would you want to use PWM for any stepper motor?

Stepper motors need steps.

What stepper motor driver are you using? Most of them just need a step and direction connection to the Arduino and these two lines of code should produce a single step

digitalWrite(stepPin, HIGH);
digitalWrite(stepPin, LOW);

…R

Brushless stepper motor same as floppy disc motor. I want to use PWM to give an amount of electric to let it run fast as the airplane in X-plane runs; so easier if high PWM = fast, low PWM = slow. It is about to measure km distance and speed to the waypoint; it is about count miles decreasing to the waypoint so fast the airplane running.

My point is that I want a smooth motor that does not stop each increment. It is brushless if I am correct.

If I control a gear DC electric motor with PWM which necessary to provide speed. But I need to count steps it has passed first with each miles, then each 10x miles, then each 100x miles with analog input. Is that a better idea ?

You need to do some reading - wikipedia has useful stuff about stepper motors.

It is correct that stepper motors are brushless motors but they have almost nothing in common with brushless DC motors such as are used to power model airplanes.

PWM has nothing to do with stepper motors.

Maybe if you describe what you want the motor to do we could help.

My point is that I want a smooth motor that does not stop each increment.

Stepper motors don't stop after each step but at slow speeds the steps will be noticeable and they cannot run at very high speeds. Also they are very inefficient.

Stepper motors are normally used where it is important for the Arduino to be able to command them to move an exact number of steps.

...R

Steppers can be made to move more smoothly by micro-stepping. Micro-stepping is basically two sine waves out of phase, which can be synthesized by varying the PWM duty cycle.

http://softsolder.com/2011/05/05/thing-o-matic-mbi-stepper-motor-analysis/

One revolution = 10 km Max 22.5 km each minute / 1350km per hour. There must be something that can run the motor smooth without steps.

tylernt: Steppers can be made to move more smoothly by micro-stepping. Micro-stepping is basically two sine waves out of phase, which can be synthesized by varying the PWM duty cycle.

http://softsolder.com/2011/05/05/thing-o-matic-mbi-stepper-motor-analysis/

Do you mean use 1-3 outputs with PWM to control smooth ?

Qwseyvnd: Do you mean use 1-3 outputs with PWM to control smooth ?

Read my lips --- no Arduino PWM, anywhere.

Most stepper motor driver boards can be set to use different levels of microstepping - for example 1/2, 1/4, 1/8 and 1/16. The stepper driver board figures out how to make that happen. The Arduino just sends step pulses.

When you use microstepping the torque of the motor is reduced because the microstepping is achieved by using the coils to pull against each other.

1350 km/h is not slow - I think it is close to the speed of sound. Are you sure you have your units correct?

I can't figure how one revolution can be 10 km. That implies a wheel that is over 3 km in diameter.

Tell us what you are actually trying to do

...R

Qwseyvnd: Do you mean use 1-3 outputs with PWM to control smooth ?

If you're building your own stepper driver with discrete transistors, you'd need either 4 PWM outputs, or, two PWM outputs plus another couple of pins to control polarity (stepper windings have to be driven both directions).

But as Robin2 points out, most people use a stepper driver and so you don't have to worry about PWM -- the driver does that for you.

Robin2:

Qwseyvnd:
Do you mean use 1-3 outputs with PWM to control smooth ?

Read my lips — no Arduino PWM, anywhere.

Most stepper motor driver boards can be set to use different levels of microstepping - for example 1/2, 1/4, 1/8 and 1/16. The stepper driver board figures out how to make that happen. The Arduino just sends step pulses.

When you use microstepping the torque of the motor is reduced because the microstepping is achieved by using the coils to pull against each other.

1350 km/h is not slow - I think it is close to the speed of sound. Are you sure you have your units correct?

I can’t figure how one revolution can be 10 km. That implies a wheel that is over 3 km in diameter.

Tell us what you are actually trying to do

…R

I can’t read your lips because I am deaf. It’s truth.
10 km is a measure of each revolution. I am trying to building a km counter decreasing to the waypoint or ahead while increasing.

Let me explain in detail.
I am trying to building, actually origin is electromechanical method, a navigation system NV-PB of Il-62 as it should be.

This, you might see eight big counters.
#1 is heading position while the airplane moving
#2 is Y coordinate position
#3 is X position
#4-6 same but the next waypoint then moves to #1-3, then #4-6 and so on.
#7-8 is to store the next waypoint in X and Y coordinate.
#1 and 4 heading positions must be set manual.
The dark grey four boxes is for VOR or RSBN correction.

The very big black box upper panel is to store both SID and STAR or just SID or STAR, or some waypoints ahead a thunderstorm.

etc.

Qwseyvnd: I can't read your lips because I am deaf. It's truth.

Perhaps you would like to reconsider the logic of this sentence

10 km is a measure of each revolution. I am trying to building a km counter decreasing to the waypoint or ahead while increasing.

The information you are giving us as been very misleading. Nothing is moving 10 km per revolution. It is a simulation of an analog instrument. It doesn't matter what units are printed on the dial - they could be mm or light-years. All that matters to the Arduino (and the stepper motor) is how many steps it needs to take.

Now that we know you are trying to simulate an instrument can you please describe what your project needs to do.

...R

OK.

I am building one home cockpit; Ilyushin Il-62 (not M model but maybe M anyway). Maybe it is better I am making one blog homepage that describes everything I am doing while I am doing this.

Qwseyvnd: I am building one home cockpit; Ilyushin Il-62 (not M model but maybe M anyway).

This hasn't advanced our understanding very far so I don't know what help you want.

Maybe it is better I am making one blog homepage that describes everything I am doing while I am doing this.

Feel free to write a blog but be aware that I am lazy and I am only going to give advice here and I am not going to read a blog to get information that should be posted here.

However if you post specific questions here I will try to help.

...R

OK, I will now trying to draw something in GIMP.

Qwseyvnd: OK, I will now trying to draw something in GIMP.

A photo of a pencil drawing will be fine, if it is easier.

Keep the size of whatever picture you post at or below 1280 x 960

...R

Here’s picture; I hoping that you understanding.

Qwseyvnd:
Here’s picture; I hoping that you understanding.

Sorry, no - I can’t make any sense of the picture.

What has it got to do with how you control a stepper motor - which is the title of this Thread.

I can’t help if you don’t ask a question.

…R

I am trying to find a solution to not use several bytes and read/write memory; which would require: 16-bit 65536 increment on heading 16-bit 65536 increment om 7000 km X 16-bit 65536 increment on 700km Y and same with #2 and many bytes to other calculation such as compass, magnetic, etc.

Here's a solution: arduino card sends output to #1 heading, X and Y coordinate position to/from airplane

2 heading and X Y position read from #1 with logic, arduino reads input from #2 heading position, then arduino reads angle between heading #1 and #2 then send to the autopilot so it turn to the angle that I have set input instead calculate each realtime of heading #1 and #2 and don't use logic.

I know that there is easier way to use stepper motor, it would require a lot of processing power if I am using microstepping which are a lot better because of precision.

Qwseyvnd: I am trying to find a solution to not use several bytes and read/write memory;

Why? 10/10 for being efficient, but you'll drive yourself nuts trying to save RAM if you don't need to save RAM. You've got 2KB of RAM, and you can use 1,000-1,500 of those bytes leaving room for the stack and heap.

Don't optimize prematurely. :)

I know that there is easier way to use stepper motor, it would require a lot of processing power if I am using microstepping which are a lot better because of precision.

Yes, there is an easier way. Use a stepper motor driver board. No extra processing power for microstepping.