Forum Rule: Always post complete source code & details to reproduce any issue!

# Thread: Four DC Motors (with Encoders) and Stepper Motor Control on Single Teensy 3.5?

1. ## Four DC Motors (with Encoders) and Stepper Motor Control on Single Teensy 3.5?

I've got an application that needs to control four brushed DC motors with encoders and a single stepper motor and am wondering if this could be accomplished on a Teensy 3.5. I know I can do the four motors and encoders with no problem using the encoder library (encoders operate at around 8000 ppr with motors running ~20 rpm) but my concern is whether or not I can add in a stepper motor. My understanding that stepper motors require really precise timing and I'm wondering if the interrupts used for monitoring the encoders would interfere with the Teensy's ability to handle the stepper motor output. Is the Teensy just so fast I don't need to worry about it?

2. It of course depends on what "control four brushed DC motors" actually means, at what speed (step frequency) you need to move your stepper and what else you plan to do with the Teensy. But, I'm quite sure that this will not challenge a T3.5 at all.

The 4 DC motors will generate pulses at 20 / 60 * 8000 =~ 2.7kHz per motor which is not really fast. If you use TeensyStep to drive the stepper with say 20kHz it'll generate a load of less than 5% on a T3.5. The interrupts used for TeensyStep will not interfere with those from the encoder library.

3. Originally Posted by luni
It of course depends on what "control four brushed DC motors" actually means, at what speed (step frequency) you need to move your stepper and what else you plan to do with the Teensy. But, I'm quite sure that this will not challenge a T3.5 at all.

The 4 DC motors will generate pulses at 20 / 60 * 8000 =~ 2.7kHz per motor which is not really fast. If you use TeensyStep to drive the stepper with say 20kHz it'll generate a load of less than 5% on a T3.5. The interrupts used for TeensyStep will not interfere with those from the encoder library.
Thanks, it's for a variant of a CNC machine and I want to replace the z-axis that currently uses a brushed DC motor with a stepper motor since they are more readily available as an assembly. I'm fairly confident the Teensy has the horsepower to do everything, I was just concerned that the interrupts could interfere because I know very little about stepper motors. Thanks again.

4. Take a look at the STI L6470. I am using two in a project right now. These are amazing devices. They remove all the hassle and CPU overhead required for generating pulses according to the ramp profile that also has to be calculated. You talk to it via SPI and with the library commands, just tell it what you want your motor to do. Set your accel, decel values, your max velocity, and then tell it to move to an absolute position, a relative position, whatever. Tons of commands. Very low overhead on the controller.

Now for the downside. The libraries available are AWFUL! Even the one from STI. I have managed to find one that was ~ok~ but not great. If you go down this road, I'll be glad to help you avoid the headaches that I had to endure. At some point, I would like to rewrite a new library. If that is something that you are comfortable with, let's talk.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•