|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
limiting voltage to the speed controller
Is there a location (file) in EasyC that we can change the ratio between the tellioperated input signal into the robot controller, and the pwm output signal to the speed controllers For ex. when i push a joystick 50% of its motion forward, can i have the controller only send out 10% of the pwm output signal. (to say it more simply the voltage to the speed controller)
|
|
#2
|
||||
|
||||
|
Re: limiting voltage to the speed controller
you can set up a look up table.
ie: an array with 256 elements where each element has a value from 0-255 so if it were 50% push on a joy stick that would look like array[192] = 147ish you can also run the joystick value through a math function to get your answer left = ((left -127) /2 ) + 127 btw thats our "half the displacement" algorithm |
|
#3
|
||||
|
||||
|
Re: limiting voltage to the speed controller
The enclosed zip file is a Graphing Calculator file that demonstrates how you can have a linear translation from the joystick to the motor.
Graphing Calculator including a viewer is available from Pacific Tech at http://www.pacifict.com/Products.html |
|
#4
|
||||
|
||||
|
Re: limiting voltage to the speed controller
When you say left = .... are you using a variable for that?? Because i'm not quite sure on how to do that. And also do you add a user function block to put that task in or is it under assignment that you put that in or what. it's all quite confusing to me...Could you explain more simply how do you run the joystick value through a math function??? This if my first year working on this program and i am still becoming familiar with the software and help would be greatly appreciated
Last edited by team877 : 01-02-2007 at 11:05. |
|
#5
|
|||
|
|||
|
Re: limiting voltage to the speed controller
Can you explain how to ": array with 256 elements where each element has a value from 0-255" in easycpro for us newbies. Maybe a quick step by step. Thanks
|
|
#6
|
|||||
|
|||||
|
Re: limiting voltage to the speed controller
If it was me, I don't think I'd use a lookup table. I have no idea how to set that up in easyC (which is part of why I don't use it all the time). In any case, here's my solution.
If you take the joystick input and subtract 127, you get a -127 to 127 value. Divide that by 127 to get a -1 to 1 value. Then, you multiply that by the range you want the output to be--if you want it to be half what it is, the range would be 127 / 2 = 64ish. So you'd multiply by 64. That will give you a -64 to 64 value. Then, add 127 to center it around 127 again, for the PWM output, and output it. I've attached a screen shot of the code I use. I multiplied the value first, then divided, but that shouldn't change the answer. JBot |
|
#7
|
|||
|
|||
|
Re: limiting voltage to the speed controller
I'm pretty sure you cannot use lookup tables with easyC. The solutions posted will work.
You could even do something like a cubic regression. If you do it right, it will let you move the motor very slowly, but you will still be able to use the full range if you need to. |
|
#8
|
||||
|
||||
|
Re: limiting voltage to the speed controller
Quote:
left = (( (int)left - 127) /2 ) + 127 you can replace 2 with any value that you want to in order to further dampen the speed. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Battery Voltage variable on EDU controller | bear24rw | Programming | 2 | 02-07-2006 23:05 |
| speed controller max speed | Team 668 | Programming | 15 | 13-02-2005 14:05 |
| voltage regulators vs. speed controlers | Greg Needel | Electrical | 8 | 06-08-2004 23:31 |
| Speed limiting code from last year in C? | Josh Siegel | Programming | 6 | 01-04-2004 22:27 |
| How do you connect the speed controller fans? | Iain | Electrical | 7 | 31-01-2003 07:05 |