Go Down

Topic: Driving Steppers vs. Servos vs. DC Motors (Read 382 times) previous topic - next topic

MacLaddy

I'm preparing to order some parts for a few different projects that I am planning, and I am trying to learn the nuances between the different types of motor drivers and shields for the Arduino. I understand the fundamentals between these three different types of motor systems, but I don't understand the drivers/motor shields.

I would appreciate it if someone could shine some light into this corner. Can I drive a 12V DC motor with a stepper driver, or vice-versa? If that is true, how does the DC motor work with stepped pulses?
Does a servo require its own shield that has a feedback loop? Can I use any motor shield with any of these types of motors? Etc...

Lot's of questions. I'm likely over-complicating it, and I would probably learn it easier just by doing. Unfortunately, I don't have the time or money to experiment and purchase a bunch of components that don't work.

Thanks,
Mac

Robin2

A stepper motor needs a specialised stepper motor driver. Stepper motors work in a very different way to DC motors. Stepper motors move one step for every pulse. The pulses are usually very short and the speed is controlled by varying the interval between pulses.
These links may help
Stepper Motor Basics
Simple Stepper Code


DC motors need a h-bridge motor driver (assuming you need to be able to control the direction). The h-bridge by itself just acts as a switch that is controlled by the Arduino. If you want to control the motor speed you do that using PWM (analogWrite() ) which generates a series of pulses with the width varying to control how much energy is passed to the motor. When the pulses are narrow the motor is only getting power for a small part of the PWM cycle. and the average energy passed to the motor is low. The pulse frequency is completely unrelated to the speed of the motor.

A servo (meaning a hobby servo) has its electronic control inside the box so the Arduino just needs to send it a signal that indicates the position the servo arm should move to. Unfortunately the term PWM is also used for the signal that controls a servo although the way it is used is very different from the PWM that controls a DC motor. In the case of a servo the width of the pulse (between about 400 and 2400 microsecs) define the angle of the servo arm - roughly between 0 and 180 degrees, but that varies a bit with different servos.

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

MacLaddy

#2
Dec 09, 2018, 08:54 pm Last Edit: Dec 09, 2018, 10:03 pm by MacLaddy
A stepper motor needs a specialised stepper motor driver. Stepper motors work in a very different way to DC motors. Stepper motors move one step for every pulse. The pulses are usually very short and the speed is controlled by varying the interval between pulses.
These links may help
Stepper Motor Basics
Simple Stepper Code


DC motors need a h-bridge motor driver (assuming you need to be able to control the direction). The h-bridge by itself just acts as a switch that is controlled by the Arduino. If you want to control the motor speed you do that using PWM (analogWrite() ) which generates a series of pulses with the width varying to control how much energy is passed to the motor. When the pulses are narrow the motor is only getting power for a small part of the PWM cycle. and the average energy passed to the motor is low. The pulse frequency is completely unrelated to the speed of the motor.

A servo (meaning a hobby servo) has its electronic control inside the box so the Arduino just needs to send it a signal that indicates the position the servo arm should move to. Unfortunately the term PWM is also used for the signal that controls a servo although the way it is used is very different from the PWM that controls a DC motor. In the case of a servo the width of the pulse (between about 400 and 2400 microsecs) define the angle of the servo arm - roughly between 0 and 180 degrees, but that varies a bit with different servos.

...R
Thank you, Robin. I appreciate you taking the time to spell that out. The coding link will be especially useful, as I plan to purchase a set of A4988 Stepper drivers on a CNC shield (eventually).

Part of my confusion comes from the wide variety of components available on the market. Take, for example, the "Qunqi L298N Motor Drive Controller Board Module Dual H Bridge DC Stepper For Arduino" (from Amazon). This little board says that it can drive either a Stepper Motor or a DC Motor. This was the reason for my question, as it led me to believe that they may be the same thing. I'm guessing that this specific board just has more capability.

Your paragraph of PWM also begs more questions. I'm familiar with PWM and duty-cycle, but I thought it was a digital signal....not analog. I use the Fast_LED library for a string of addressable lights, and I believe that is a digital PWM signal? That may be a topic for a different section, however.

*EDIT* I just finished reading through your tutorial that you posted above, and it was very helpful. If you have tutorials on any related topic, I would like to read it. Please let me know if there is a link to your tutorials. 

Thanks again.
Mac

Robin2

An L298 is a very poor choice for driving a stepper motor. Don't believe all the marketing waffle.

It is unfortunate that the Arduino folks decided to use analogWrite() as the name of the function that creates the PWM signal. It is a digital signal - on or off.

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

MacLaddy

Ah, that makes more sense. Thank you for clarifying. I also added an edit to my post above regarding your tutorial(s). I would like to see more if they are available.

Robin2

#5
Dec 10, 2018, 12:31 am Last Edit: Dec 10, 2018, 12:34 am by Robin2
Ah, that makes more sense. Thank you for clarifying. I also added an edit to my post above regarding your tutorial(s). I would like to see more if they are available.
Don't add new stuff to existing Posts it just confuses the flow of the conversation. Nobody expects to see new stuff there.

I have contributed a few other things - these are probably the most significant
Several Things at a Time
Serial Input Basics - simple reliable ways to receive data.
Python - Arduino demo
Planning and Implementing a Program
Simple nRF24L01+ Tutorial

Have you seen the Useful Links Thread.


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

MacLaddy

Thank you again. If I have any questions, I'll bring it back to this post for clarification.

Go Up