5.1. Input settings
The “Input settings” tab of the Simple Motor Control Center G2 allows you to quickly specify how you want to control the speed of the motor, and also allows you to set up limit and kill switches.
As a first step, we recommend that you click “Quick input setup…”. This will launch the Quick Input Setup Wizard, which will let you specify how you want to control of the motor, and (if you are using analog or RC) lets you quickly calibrate your inputs. When you finish the Quick Input Setup Wizard, your new settings will get saved in the “Input settings” tab and will (optionally) be applied to the device so you can start using your new settings right away. After you are done running the wizard, you should be able to successfully control your motor, as long as you have made all the necessary electrical connections as described in Section 4.
The rest of this section documents all of the input settings in detail. If you are able to control the motor the way you want to after running the Quick Input Setup Wizard, then you probably don’t need to read this section.
The serial and I²C settings in the “Input settings” tab are not documented here. If you want to use serial or I²C, please see Section 6.
Input settings tab in the Pololu Simple Motor Control Center G2.
The Input mode specifies what kind of input the controller will use to calculate the target speed of the motor. The available options are:
- Serial/USB: In this input mode, the target speed is specified by serial, I²C, or USB commands, and the target speed is reset to zero whenever there is an error. This is the default input mode.
- Analog: In this input mode, the target speed is determined by the voltages measured on the analog signal lines (A1 and optionally A2 if you want to use mixing).
- RC: In this input mode, the target speed is determined by the pulse widths measured on the RC signal lines (RC1 and optionally RC2 if you want to use mixing).
Regardless of which input mode you choose, the analog and RC input channels will always be measured; those channels can be used as limit or kill switches if they are not controlling the speed of the motor and their values can be retrieved using serial, I²C, or USB.
If you have chosen analog or RC as the input mode, the Mixing mode setting specifies whether to use mixing and what type of mixing to use.
The primary use of mixing is for controlling a motor on a differential drive robot. You can use one G2 Simple Motor Controller for each motor on the robot, and feed the same inputs into both of them. We recommend connecting the throttle (forward/reverse) input to channel 1, and the steering (left/right) input to channel 2.
- None: In this mixing mode, the target speed is calculated as a function of the scaled value of the first channel only (analog Channel 1 or RC Channel 1).
- Left (+): In this mixing mode, the target speed is calculated as a function of the sum of the scaled values of both channels.
- Right (−): In this mixing mode, the target speed is calculated as a function of the difference of the scaled value of both channels (channel 1 minus channel 2).
Note that in RC and analog mode, the target speed depends not only on the scaled values of the channels, but also on the starting speed and max speed parameters, as explained in Section 5.2.
The table below summarizes all the input and mixing modes you can choose:
|Input mode||Mixing mode||Motor speed is calculated from…||Example Applications|
|Serial/USB||N/A||Serial, I²C, and/or USB commands||Motor controlled by microcontroller or PC.|
|Analog||None||Analog channel 1||Motor controlled by joystick.|
|Analog||Left (+)||Analog channel 1 plus analog channel 2||Differential drive vehicle controlled by joystick.|
|Analog||Right (-)||Analog channel 1 minus analog channel 2||Differential drive vehicle controlled by joystick.|
|RC||None||RC channel 1||Electronic Speed Controller (ESC).|
|RC||Left (+)||RC channel 1 plus RC channel 2||Differential drive RC vehicle.|
|RC||Right (-)||RC channel 1 minus RC channel 2||Differential drive RC vehicle.|
The settings on the bottom half of the “Input settings” tab are all channel-specific settings. To view or edit them, you must first select the desired channel using the list box in the bottom left corner.
The Alternate use setting allows you to configure any channel that is not used to control the speed of the motor as a limit or kill switch. The available options are:
- None: This channel will not be used for anything special, but its raw and scaled values can be read using serial or USB.
- Forward limit switch: When the scaled value of the channel is above 1600 (50%), the limit switch will be considered active and the motor will not be allowed to move forward. If the target speed is positive, a “Limit/kill switch” error will occur.
- Reverse limit switch: When the scaled value of the channel is above 1600 (50%), the limit switch will be considered active and the motor will not be allowed to move in reverse. If the target speed is negative, a “Limit/kill switch” error will occur.
- Kill switch: When the scaled value of the channel is above 1600 (50%), the kill switch will be considered active and the “Limit/kill switch” error will occur, preventing the motor from moving. For example, you could use the kill switch feature and the Serial/USB input mode to make an autonomous robot that you can conveniently immobilize from a distance using an RC transmitter and receiver.
The forward and reverse limit switch options allow you to set up limits that prevent your actuator from moving out of its allowed range. You will probably want to avoid setting a motor deceleration limit if you are using a limit switch, because the deceleration limit will prevent the motor from stopping immediately: when the switch is triggered, the motor will gradually decelerate from its current speed to zero, which might be bad for your system depending on how it is set up. See Section 4.4 and Section 4.5 for information about connecting limit switches. See Section 5.1.1 for more information about configuring a limit or kill switch.
Any channel configured as a limit or kill switch is considered a required channel. This means that the motor will stop if that channel becomes disconnected (the Required channel invalid error will occur).
The Learn… button launches the Channel Setup Wizard, which lets you quickly calibrate your input channel or limit switch. Before using this wizard, you should select your desired alternate use, and if you are configuring an analog channel then you should first enable the pull-up resistor and/or check “Ignore pot disconnect” in the “Advanced settings” tab if necessary.
Enable pull-up resistor (analog channels only)
When checked, the Enable pull-up resistor option enables a pull-up resistor on the selected analog input line. The value of the resistor is approximately 40 kΩ and it pulls the line up to 3.3 V.
The rest of channel-specific settings are all scaling parameters, which means they specify how the scaled value of the input channel is calculated from its raw value. They also specify the normal range of the input channel. All of these parameters except scaling degree can be easily set using the Learn… button.
The raw value of a channel is measured directly from the input pin. For RC channels, the raw value is the width of received pulses in units of 1/4 μs; typical RC receivers will generate signals between 4000 (1000 μs) and 8000 (2000 μs). For analog channels, the raw value is a 12-bit measurement of the voltage on the input line: 0 is 0 V and 4095 is 3.3 V. You can see the raw value of the selected channel by looking at the “Current channel value” label or by looking at the Status tab.
If the raw value is less than “Error min.” or greater than “Error max.”, then the channel is considered invalid and the scaled value is not computed. Otherwise, the scaled value of a channel is calculated from the raw value using the scaling parameters. Specifically:
- Raw values between Error min. and Minimum map to a scaled value of −3200 (or 3200 if “Invert input direction” is checked).
- Raw values between Minimum and Neutral minimum map to a scaled value between −3200 (or 3200 if “Invert input direction” is checked) and 0.
- Raw values between Neutral minimum and Neutral maximum map to a scaled value of 0.
- Raw values between Neutral maximum and Maximum map to a scaled value between 0 and 3200 (or −3200 if “Invert input direction” is checked).
- Raw values between Maximum and Error max. map to a scaled value of 3200 (or −3200 if “Invert input direction” is checked).
By default, the scaling is linear, but you can change the Scaling degree to use a higher-degree polynomial function, which gives you better control for low speeds.
The Error min. and Error max. parameters should be set so that the input channel’s raw value is always within that range whenever the input is operating properly. One way to do this is to move your input to the minimum position, and set Error min. to be 10 to 200 counts lower than the current channel value. Similarly, move your input to its maximum position, and set Error max. to be 10 to 200 counts higher than the current channel value.
The Minimum and Maximum parameters should be as far apart as possible to maximize the accuracy of your speed control, but they should still be close enough that you can reliably reach scaled values of ±3200 (±100 %). One way to do this is to move your input to its minimum position, and set Minimum to be 10 to 200 counts higher than the current channel value. Similarly, move your input to its maximum position, and set Maximum to be 10 to 200 counts lower than the current channel value.
The Neutral minimum and Neutral maximum parameters should be as close as possible to maximize the accuracy of your speed control, but they should still be far enough from each other so that you can reliably reach a scaled value of 0 when you put your input in the neutral position (e.g. release your finger from the joystick). Some joysticks can settle at different positions depending on where you release the from, so you should experiment with releasing your joystick from different positions and see what raw values you get (you can see them using “Current channel value” label or in the Status tab). Then set Neutral minimum and Neutral maximum so that their range includes all of the values you saw, and has a reasonable margin. This guarantees that you will not waste any power driving your motor when your stick is in the neutral position.
If you want to restrict the scaled value of the channel to always be negative or always be positive, you can set the Minimum equal Neutral Minimum or you can set Maximum equal to Neutral Maximum. This could be useful for one-directional control of a motor but typical applications will not need this.