-
Stepper motors: simple & discrete components
11/08/2015 at 21:48 • 2 commentsI must admit I have a hard time figuring out a use case for controlling stepper motors with discrete components. You might want want something simple for educational purposes, but that's about it. The challenge is you need to excite each coil of a stepper motor (2 or more) in succession and that requires digital logic. At the very least you need a flip-flop and a PWM, which puts us in the "common ICs" territory.
I realized I may want to slightly re-jigger the talk but more on that later.
-
Stepper motors: overview
11/08/2015 at 18:52 • 0 commentsStepper motors are the most precise type of motor we will look at because of their ability to move in accurate steps. They can be found in everything from blue-ray player lens rigs to nd printers to industrial robot arms. They have multiple coils you need to excite, which is more complicated to control but is pragmatically equivalent to multiple DC motors.
PROS
- $$ - you pay for the accuracy but the consumerization of printers has brought the price down significantly
- Can rotate to very accurate positions, sometime called "microsteps."
- Lots of great controllers on the market but almost always needs an MCU
- Comes in standard sizes defined by NEMA
CONS
- Can be $$$ - high-precision, high-torque models can be uber-expensive, especially as they add sensors and gearing
- Heavy-ish; don't plan on using these in light drones
- More power-hungry than an equivalent DC motor
-
Brushed DC Motors: microcontrollers & drivers
11/08/2015 at 07:30 • 0 commentsAvid readers of Hackaday are the kind of folk who would build a fan with an RTOS, or at the very least use an MCU. Utilizing a MCU for motor control makes a lot of sense since it allows for advanced control logic, integration with peripheral components and even more precise control over the output with techniques like Binary Code Modulation.
Fundamentally we use the hardware PWM generator found on many common MCUs. That means we could easily use the H-bridge we mentioned before. H-bridges will work great for many MCU integrations. If we are limited on I/O pins or processing overhead, we need to switch to specialized motor drivers.
Before you object, you should know that H-bridge ICs are considered drivers too. However, we need to differentiate parts that provide additional logic and/or communicate over I2C/serial.
These drivers generate their own PWM based off serial instructions, saving hardware interrupts, a few pins and general overhead. Plus, if they're the I2C flavor, we can chain multiple controllers together. Examples of both serial and I2C-controlled include the DRV8823 & DRV8830, respectfully.
Need more power? You can use our old friend the megaphone (Mosfets) or find chips that can handle more power. But what if you need more motors? Like 16? Or 992? Parts like the PCA9685 are general-purpose multichannel PWM controllers, usually used for LEDs or Servo, but make great BDC controllers when paired with the right H-bridge.
Protip: If you need to control a BDC on a existing product like a scooter but don't want to significantly modify it, you can use a Digital Potentiometer in lieu of the throttle. Pair that with an MCU and you got a great ride for Burning Man that can return to your train commuter when you get home (true story.)
-
Brushed DC Motors: common ICs
11/07/2015 at 01:16 • 0 commentsIf you need more precision than you get from switches and pots, you'll need to move to common ICs. Fortunately, we can use parts readily available at the store formally known as Radio Shack (too soon?) Parts like transistors and 555s will allow us to control the speed & direction of BDC motors with decent accuracy + reliability.
The key concept here is the humble h-bridge: an arrangement of transistor pairs that can toggle the flow of power in both directions of a motor. Oh, and it looks like an H in diagrams.
What type of transistor you use depends on the current draw of your motor (look at stall current.) Small hobby motors with light loads can use common BJT PNP/NPN-type transistor (NPNs are cheaper and active-high.) But for anything remotely power-hungry, you'll want to use Power Mosfets. P-channels are a go-to for high-side switching and something like a FQP27P06 can handle 27A with proper heatsinks. That's a hefty motor.
There's also readily available H-Bridge ICs. Some have nicer features like dual H-Bridges for 2 motors, built-in diodes & overheat protection but they're effectively the same as rolling your H-bridge. Pick from the following depending on your load requirements, but note there are tons of other options from an array of vendors:
If you're using an H-Bridge part and need more power, you can actually use them in conjunction with a Power Mosfet. I like to think of them as motor control megaphones.
So what about speed control? Recall that we said BDC motors are voltage-senstive devices. A PWM signal should be a familiar representation of voltage and are easy to generate and vary. An astable 555 can be our generator. And like the discrete solution, we can use a fixed resistance for fixed speed, rotary switch for finite gradients and a pot variable speed. We could just use a pot here but a PWM signals is more power-efficient since it off part of the time.
What about free-running & braking? Like speed control, we can coast by removing power, ie opening all transistors, and braking by enabling either the upper or lower part of the "h" - but never both!
-
Brushed DC Motors: controller basics
11/05/2015 at 01:38 • 0 commentsBDC's are voltage-sensitive devices. That's good for us because we understand voltage. If you apply enough voltage across a BDC, it moves. If you apply more voltage, the motor moves faster. Reverse the voltage and...you guessed it, the motor moves in the reverse direction. Remove the power and motor moves freely, aka. "freewheeling." And you can stop the motor quickly like a car "brake" by...let's hold off on that for now.
There are about 3 ways to control a motor:
- Simple & discrete components
- Common ICs
- Microcontrollers & drivers
For the talk I'll likely go over the 3 ways for each type of motor. Let's get to it!
Simple & discrete components
While we all would like to have a cooling fan that runs an RTOS, a simple potentiometer is all one really needs to control the speed of a DC motor. Add a DPDT switch and now you can also change directions. If you're going this route, you'll almost always want a pot with a switch to make it easy to turn off the motor.
Protip: always use a flyback diode. It will prevent your controller from going boom when stored energy in the motor needs a place to go. Also, many App Notes add filter caps as optional but they're a good thing to use if you're in an embedded context where RF noise can mess you up (as opposed to say, an industrial HVAC.)
What if you want stepped speeds like slow and fast? A rotary switch with a resistor at each step makes a nice collection of voltage dividers. Values of each resistor per step will depend on the motor, voltage and desired speed.
Now for the last open question: how do you stop quickly using only simple components? You're not going to like the answer...basically you disconnect the power and replace it with a resistive load so any stored energy dissipates as heat. Don't forget a heatsink on the load if you're working with large motors.
You may wonder why I don't have any schematics. Those will come when I start the actual presentation deck and will be shared here as well.
-
Brushed DC Motors: overview
10/25/2015 at 17:15 • 0 commentsI'm sure we've all seen Brushed DC (BDC) motors at some point - those little silver stumps with a blunt needle on one and and two wires on the other. These are by far the most common type of motor you'll come across because they're cheap, easy to control and readily-available. They're often called toy or hobby motors because both their cost and ease of use make them great for toys.
PROS
- $ - Cheapest relative to others in the talk
- Simple control is easy, sophisticated control relatively easy
- Wide-range of form factors
- Low to high torque/voltage options
- Add-on options like gear boxes & encoders readily available
CON
- Brushes can go bad (but those with replaceable brushes are a PRO)
- Not good for very precise motion
- Fairly-good speed control requires controllers and closed-loop systems
- Internal magnets can be too heavy for some applications
-
Type
10/20/2015 at 14:54 • 0 commentsMotors are generally segmented by how they are actuated. A brushed motor is physically different from a stepper and thus is actuated differently. The difference, however, is actually how the actuation is initiated & controlled. But there is far more that differentiates motors and the differences matter when choosing the appropriate motor for an application:
- Physical dimensions of body & shaft
- Weight
- Mounting options
- Shaft shape
- Shaft options like double ended, extended & threaded
- Output attachments like gears, pulleys & vibrating weights
- Cost
- Availability, sourceability
- Operating Voltage (max, starting)
- Speed (no load/loaded), Current (no load/loaded/stall), Torque (starting/stalled)
- Sometimes datasheets will include a load to give you a better real-world estimate
- Operating temp
- Output modifier like gears and the gearing scheme (spur, planetary)
- Non-standard output layouts, like right-angle. These are my favorite and I've never had a use for them.
- Sensing option for closed-loop systems (encoders, pots)
- Built-in controllers if you wanna get all fancy
- Motor type-specific attributes like number of coils or magnet type
- Robustness (better term?) like bearing type, gearing material & type of encoder
That's a lot of differences to consider! Am I missing any?
-
Scope
10/19/2015 at 15:45 • 0 commentsMotor control is a very broad topic. It touches on traditional electronic design, power design, signals, physical properties, math, embedded systems...I actually can't think of an area it doesn't touch. There are experts in the field who spend their entire life improving the discipline. As a non-expert, I just want to make robots walk. As such, I want to know the "how" and fill in the "why" when it matters or when curiosity strikes. I hope that this talk to be similarly pragmatic and practical. You should take away what you need to make the majority of motorized projects.
I'm grouping the discussion of motor control into 3 buckets:
- Motors (well, actuators) and their properties
- Systems (power and silicon)
- Software (1's and 0's)
For the sake of brevity, here are topics that I think should be in and those that should be out:
In
- Brushed, AC & DC
- Servo , Hobby & Industrial
- Stepper, uni/bi polar (touch on n-pole)
- Brushless, hobby bldc (touch on high-output like e-bikes)
- Using discrete components
- Motor drivers/controllers
- Picking a controller
- Interfacing with an embedded controller
Out
- Exotic actuators (linear, piezo, "smart servos", wax)
- Pneumatics
- Less interesting actuators like solenoids (on the fence)
- Mechanical control via cams, gears and leprechaun magic
- Protocols like CAN & RS-485
- Closed-loop (ignore servos, k?)
- Motor Control Theory like PID (whole other talk)
- Kinematics
I plan on mentioning and linking to resources on the topics I'm leaving out.
Anyone reading this - what do you think? Anything else you'd like to see covered? Something thought really out to be in?
Let me know!
./jonathanberi