Potentiometers powered from controller’s 5 V output can be connected to its analog inputs to drive the motor. The connection diagram can be seen below:
Some precautions to take when choosing a potetiometer value are:
- The potentiometer current should not exceed 5 mA, otherwise the input will be distorted from the internal 53 KOhm resistance to ground.
- The maximum current of 5V output is 200 mA
- The controller analog input can read 0…5 V. Voltages beyond 5 V will be clipped.
By taking the beyond precautions, we can use a potentiometer from 1 to 10 KOhm powered from controllers 5V output.
The configurations need to be done on Roborun+ can be seen below:
- Configure the conversion type.
By choosing “Absolute”, the input voltage will be calculated directly from the ADC. By choosing “Relative” the input will be regulated depending on the actual 5V output of the controller (might be 4.935V instead of 5 V)
- Set the action to “motor command” and choose the channel to be used for
- Configure the input range
By default the controller will use as lower value the 250mV, middle value the 2500 mV and maximum value the 4750 mV. If the potentiometer center is not exactly at 2.5V, this can be calibrated manually by changing the beyond parameters or automatically by clicking the “Calibrate button”
Then the controller will map the -1000 motor command to minimum value, 0 motor command to the center value and +1000 command to the max value.
Please note that out of range values (in the beyond example <250 and >4750) will give a zero motor command. This is a safety feature that can be disabled by disabling the “Keep withingGuard Bands” parameter.
- Configure the input deadband
Input deadband is the percentage of the analog input range that will be considered as zero motor command. For example, with the beyond settings, 5% input deadband implies that voltages between ( 5*4700/100) mV to -(5*4700/100) mV will be considered as 0 motor command.
- Configure the Min/Max action
Additionally, an action can be configured to be triggered if the input voltage exceeds a configured range. This can be useful for example to detect failures in the input circuitry.
- Don’t forget about the command priorities
The controller will choose the motor command source by following the command priorities. In the beyond example, the controller will first seek for a serial command and if it doesn’t receive one, after a configured amount of time (that can be configured by the watchdor timer parameter) will check for the second source of command.
This in the current example is the pulse input. If this is also not available, the controller will make the motor command 0 after the watchdog timer has once again expired. Since the analog input is not configured in the command priorities, the controller will never use it as an input, even if it is configured in I/Os tree.
One last thing to notice is that when the Roborun+ Utility is connected and the slidebar is not muted, the Utility will send periodically serial commands to the controller. This might go in conflict with the given analog command, if the serial commands have higher priority.
- Test the given command
Now you should be able to see the given motor command changing from the potentiometer input!