Hey guys, I thought that programmers control the voltages going into each motor. What is the job of the motor controllers then? Sorry if this is a dumb question. I am a beginner and I am a bit overwhelmed
The motor controller allows you to set a motor to 0-100% of the battery voltage. If you connect a battery directly to a motor it’ll just spin at max speed forever. Motor controllers allow you to vary the throttle. You need this on FRC robots to be legal (and make sure you can actually command your mechanisms). Brushless motor controllers are required to get the motor spinning at all, as they “commutate” the motor to get it to spin.
Ohhh I see! Wait so does the programmer program the motor controller then or the motor themselves (in terms of allocating voltage)?
You program the motor controllers, regardless of which motor is connected to it. Technically the code wouldn’t know a difference between a Neo or a Neo 550 attached to a spark max.
I’m honestly surprised that REV doesn’t make you define what motor you have hooked up to your Spark MAX when initializing the device in code (or wherever would be the most appropriate place to do so). Seems like an easy and appropriate added extra step to help ensure less experienced folks aren’t frying their Neo550’s.
If a NEO is selected in code, the current limit can still default to the current limit of 80A like REV currently has it, but if you select a Neo550, the default current is set to something like 20A (or less even). This could also be an additional and interesting data point collected in FIRST’s anual Usage Report.
Brushed DC motors only (Anything but Kraken, Falcon, Nidec or Neos), brushless will stall because they need to commutate between pole pairs, not stay continuously on in one direction.
Just to be complete, your program gives the motor controller a parameter anywhere between -1.0 and 1.0, inclusive, using the variable type “double." -1.0 says to run at full speed one direction, 0.0 says stop, and 1.0 means full speed the other direction.
Whether this means up or down, left or right, forward or backwards, etc. depends on how the motor is mechanically connected to the robot’s wheels/arms/claw/mechanism.
Also how the motor is internally wired up. Some brushed motors go “backwards”…
ohh ok. Wait so it’s like a percentage. 0.65 would be 65% in the positive direction. And the voltage output depends on the motor right? Not the motor controller? So the parameter (-1 to 1) would be fine-tuned for different kinds of motors?
The voltage output depends on the battery. The motor controller is performing a “duty cycle.”
A digital control signal like the ones you can get out of a Rio PWM port can typically provide only small amounts of current, and these will be at 5V. You will rarely see a digital signal that can provide more than 1/10 of an amp on a good day, running downhill with the wind at its back.
A motor controller takes that tiny whisper of a control signal and turns it into a firehose of power. Tens or even hundreds of amps at 12V. This provides the energy needed to move your robot or mechanism.
The Rio is smart, fast, and weak. The motor controller is a big burly friend who can follow orders and move heavy stuff.
The basic magic of a motor controller is the field effect transistor . Where a small current to one point on the transistor change the current that can flow through the transistor.
Modern motor controllers do more than this of course. Smart controllers can implement Feed forward and feed back controls based on velocity or position and can handle the variation is signal needed for the commutation of brushless motors.
There is some really good info on motors at https://motors.vex.com/.
It doesn’t really talk about the controllers that much, but gives some background on what the motor is doing.
It is helpful to know what happens to the motor when you change voltage for a given load. At some point the motor will stall. Bad stuff may happen depending on the voltage and the motor. For a given mechanical load on the motor, dropping voltage will drop the speed of the motor unless you are not giving it enough voltage to spin (… that is stall condition.)
The software team can help protect the motors for some cases with current limits and/or voltage limits.
It would be beneficial for you to get a simple setup where you can write small programs to vary the commands sent to the motor controllers you are using (percentage, current limit, etc.) so that you can observe the effect in the physical world.
Love that analogy!
The motor is connected to a motor controller. Technically the programmer writes commands to the motor controller not the motor. Some motors have an integrated motor controller, but you are still commanding the motor controller. Two ways to control a motor controller. PWM: which can only send one command to the motor controller that roughly relates to output voltage as a percent of battery voltage. It is one way and the motor controller cannot send feed back. CANBUS: Motor controllers that use canbus can send feedback and potentially can use lots more control strategies that live in the motor controller. I.E. current control, PID (velocity and position). Some settings have to set in the motor controller via a interface or via commands sent over the canbus.
Wait I just realized that I have a quick question. If a motor controller is not connected, does that mean a motor would try to use 100% of the battery voltage? So if I have a 12V battery for my robot, does that mean it would try to use 12V?
Wait so if I set it to 0.65, then it would use 65% of the battery voltage? If I am using a 12V battery for the robot, then it would use 7.8V?
First, that’s not a legal way of wiring a motor. Second. That will only work for some motors. Brushed motors can be spun by directly feeding a voltage to the two leads. Brushless motors require a more complex pattern of feeding voltage (the motor controller will handle this and I don’t understand it well enough to explain so I’m not going to) so just feeding in a constant voltage won’t cause the motor to rotate. If you want to quickly test a mechanism using a brushed motor you can connect it directly too a battery, although you have to be careful about stalling this motor as you have no breakers/fuses to regulate current.
Funny thing about motor controllers. They actually tend to try to feed a constant voltage (in this case, 12V), at least for brushed motors. (I’m not sure about brushless controllers.)
For the battery: Yes, it would use 12V, and it would try to pull as much current as it could. So, uh, let’s NOT connect motors directly to batteries. Great way to release the magic smoke.
The homework term for tonight is “duty cycle”. What they do is they turn it on for some percentage of time.
Example:
I need to run a CIM at 2250 RPM forwards (half speed, 50%). The CIM is connected to a motor controller. I tell the motor controller “0.5”. For any given second, the motor controller will be feeding full power for 0.5 seconds, and 0 power for 0.5 seconds. Because the control system runs several times per second, it’ll actually be 0.5*(cycle time) on, and 0.5*(cycle time) off, repeat.
Now I need to run at half-speed reverse. Controller gets “-0.5”, outputs on the same duty cycle, but reverses the polarity on its outputs.
Now I want to run at 3/4 speed forwards. Controller gets “0.75”. We run forwards polarity, 0.75*(cycle time) on then 0.25*(cycle time) off.
That said: A LOT of this will be handled for you. Pretty much all you have to do is tell the speed controller the direction and speed. The controller does pretty much everything else.