[simpits-tech] Arduino victory!
geneb
geneb at deltasoft.com
Tue Aug 7 06:17:00 PDT 2012
On Mon, 6 Aug 2012, dabigboy at cox.net wrote:
>> An easy way to improve the accuracy of the gauge would be to find out what
>> the min/max drive values are and then use the map() function to map
>> temperature values coming from the simulator to the gauge position. I
>> used the scaling algorithym(sp?) that map() uses when I did my airspeed
>> indicator demo a few years ago.
>>
>> g.
>
> Hmmm I had not heard of map() before....I just looked it up. If I
> understand this correctly, it would provide a handy way for me to define
> a function that matches the curve and units of my temp scale, and then
> apply it to whatever temp reading is coming from the sim, no? I already
> found the min/max PWM values for the gauge, what I'm doing now is adding
> a fixed number to my temp value (since the gauge reads temps down to
> -50, and obviously I need to send values greater than 0 to the PWM pin).
> I figured, based on the min and max values only, the ratio of temp units
> to PWM units (my PWM range is still a bit less than the temp
> range....about 140 steps over a 170*F gauge). But this does not give me
> perfect results, and it appears to be for two reasons:
>
> 1: The gauge's scale is slightly non-linear....for example, -50 to 0 is
> finer than 0 to +50, and anything over 100 gets a slightly different
> scale also.
> 2: Response of the needle doesn't seem to be perfectly
> linear with PWM duty cycle; I'm guessing the resistance of whatever
> element was in the original temp probe on the aircraft is non-linear,
> and the gauge was just designed to match this.
>
What I did was to use a series of translation functions depending on where
I needed the needle to be. For example, if you look at the gauge face in
the video, you can see that the tick marks aren't spaced evenly round the
face. I just coded it such that it would use the right translation range
given the input value. That guaranteed that no matter what I fed it, the
needle would be in the right position.
g.
--
Proud owner of F-15C 80-0007
http://www.f15sim.com - The only one of its kind.
http://www.diy-cockpits.org/coll - Go Collimated or Go Home.
Some people collect things for a hobby. Geeks collect hobbies.
ScarletDME - The red hot Data Management Environment
A Multi-Value database for the masses, not the classes.
http://www.scarletdme.org - Get it _today_!
Buying desktop hardware and installing a server OS doesn't make a
server-class system any more than sitting in a puddle makes you a duck.
[Cipher in a.s.r]
More information about the Simpits-tech
mailing list