Output voltage regulation by SetMotor functions
Forums:
Hi,
do the SetMotor functions set the voltage of the output or is the motor power pwm regulated?
If my power source provides higher voltage than the outputs accepts, would it be best practice to drop the difference at input or on each output? (assuming both consumers a equal)
Thanks for any comments on the matter
piborg
Fri, 09/29/2017 - 10:38
Permalink
Power setting
The power values given to the
SetMotor
functions are indeed a PWM level to the motor.Generally speaking you should not need to drop the voltage for the motor unless your power source is drastically larger then the motor voltage. This is because the motor will naturally smooth out the input power quite a lot on its own.
For example if you have a 12 V power source and a 6 V motor it should work completely fine just by limiting the maximum power value given to
0.5
. No additional hardware or smoothing would be needed :)Most of our code examples already have code for limiting the output:
This code calculates the maximum value to set the motors to (
maxPower
) from the two voltages. The example will then use this to reduce the values sent to theSetMotor
commands, e.g:In this case the
driveLeft
anddriveRight
values can be anything from-1.0
to+1.0
and the output to the motors will not exceed the specified limits.mamue
Fri, 09/29/2017 - 14:57
Permalink
Thank you piborg for that
Thank you piborg for that helpful and explaining comment. I'm quite astounded that the voltage level can be treated that liberally. I thought it ought to be correct within 0.1 Volt! Less work for me - fine.