PDA

View Full Version : RC circuit drift correct



jcferguson
04-14-2007, 02:01 AM
Hi All,

I have three joysticks controlling three servos. The center values for the joystick RC circuits drift a tiny bit with changes in temperature. I would like to set up a subroutine in my code to adjust for this.


My thinking:

1 - monitor the joysticks - when they haven't changed for a while, assume they are not being touched and run an "idletime" subroutine

2 - in the "idletime" subroutine check the rctime value and set a constant with the difference between this actual reading and what the centered joystick "should be"

3 - then use this constant when "back in play" as an adjustment to the code that scales the joystick rctime value for the servos



1 - done, I just check the value each time through the loop and when they haven't changed for about 30 times I send to the subroutine

2 - not sure. my problem is the math - say I want a value of 750 for the end output. I could do something like:
driveservodriftconstant = idletimedrivejoystickreading - 750. But then I don't know how to deal with the negative numbers (or lack of...). the ideltimedrivejoystickreading is likely 754 - 746 or so... so I get a funny value is the end result should be negative.

how do I deal with the negative numbers?

3 - think I can figure this out if I get a way to deal with the negative values.

Is there a different/better way?

Thanks for any thoughts! let me know if I need to clarify!

Carlos

Beau Schwabe
04-14-2007, 10:15 AM
Why not design your circuit so that it automatically compensates for temperature?

What kind of resolution do you need for your Joysticks?

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

Beau Schwabe
04-14-2007, 12:04 PM
Here is an example of a temperature compensated design approach...

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.

Post Edited (Beau Schwabe (Parallax)) : 4/14/2007 4:09:04 AM GMT

jcferguson
04-14-2007, 11:31 PM
Hi Beau,

That looks like a great solution for one joystick, but I have three and when I tried using a similar approach found that it took too long to read the equivalent of 6 rctime commands with requisite high and input, pauses... - my rf signal didn't work right. So I went back to a single side of the joystick pot being read with a disparate rc circuit for each.

Do you have any sense of how I might use the approach outlined above?


Thanks,
Carlos

HEKS
04-15-2007, 01:24 AM
Hello
i ve got a question about the usb paralaxx servo controller.i want to control the servos with a usb joystick.is it possible?do i need a bs or other hardware?is it possible to control them from a pc over the internet(on a website)?rc surveillance camera or s.th.l.th?thanks!!!
-HEKS-

Mike Green
04-15-2007, 01:33 AM
HEKS,
Please start your own thread if you have a posting on a different topic.

Carlos,
How about using Beau's circuit, but only reading both sides of the pot occasionally. If you have some idle time every few minutes, you could go through a calibration cycle. Reading both sides of the pot would get you an adjustment factor for the whole pot that you could continue to use for several minutes. You might experiment with just reading one pot ratiometrically and applying the adjustment factor to all 3 pots. Perhaps the temperature (and temperature sensitivity) is close enough among the 3 pots that you only need to calibrate with one.

Beau Schwabe
04-15-2007, 05:00 AM
jcferguson,

"That looks like a great solution for one joystick, but I have three and when I tried using a similar approach found that it took too long to read the equivalent of 6 rctime commands" - What are the values of the Capacitor, and Joystick pot that you are using? Also, what kind of resolution are you hoping to obtain? ...Sacrificing resolution will increase your speed, by lowering the Capacitor value.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Beau Schwabe (mailto:bschwabe@parallax.com)

IC Layout Engineer
Parallax, Inc.