[simpits-tech] Switchs, Rotary and pot

Mark Doran simpits-tech@simpits.org
Mon, 5 Aug 2002 23:20:50 -0700


I've been thinking about this some lately too as I plow through the epic
(sic) task of EPL programming for a complete set of F-16 panels.  Left
side console and half the center console all done now, but I digress.

Encoders seem to get used (from a human factors-ish sort of view) where
you have knobs that turn without an end stop and where the knob fitted
doesn't need to line up with any particular markings on the panel that
it's mounted on.  Losing any one click 'cos you go by too fast isn't a
problem because you can always click on one more time in the same
direction to adjust...same for overshooting if you were really going
fast just go back a click or two...

For encoders, there's no real problem in syncing a physical mark on the
knob, like a stripe say, with an orientation versus the panel the knob
is on.  But if you need to sync in orientation or you need end stops on
travel of the knob in either direction, well then you definitely want a
rotary switch, not an encoder.

FWIW, I wonder about using pots in places where the real jet has
encoders (like HSI heading and course controls for example).  How do you
get around the fact that a pot has an end stop??  Ralph's default
keystroke to analog axis mapping technique gives you only 32 steps in
both up and down directions...not enough resolution steps if you are
doing compass headings, say.  Yes, you can hand code something to read
the pots absolute value to get more resolution in each of the 32 "slots"
but that's a lot of code, I think you are still limited to ~256 steps of
resolution, and you still don't really have the right "feel" equivalent
given that an encoder just doesn't bump into an end stop.

Plus of course, there are already near enough more things that need
analog axes than you have to play with in the first place with a single
EPIC: 2 for stick, 5 for TQS, 1 for rudder, 1 for HUD brightness, 2 for
radio volumes, 2 for threat and sidewinder volume...that's 13 out of 16
possible max right there just for the controls I actually use a lot when
flying.  You certainly won't be using pots to replace all the rotary
knobs anyway ;-)  [Mmm, presuming you use EPIC for flight control axes
that is.]

Back to encoders though...

Electrically after all the complex circuitry is boiled down what you get
is on of two switch make pulses that mean either "clockwise" (CW) one or
"counter clockwise" (CCW) one.  A bit over simplified perhaps but
looking at this as a programmer that's what I see.

Now, I can't see why if you have a rotary mechanical switch that has no
end stop CW or CCW why you can't do a "software encoder" in EPL and save
lots of painful circuitry and wiring...not to mention cash.

How about this:

A three pole rotary switch with no end stops.  Wire each pole for a
separate EPIC mod/row/bit number for this example with bits in
"increasing" order clockwise:

--BEGIN EPL EXCERPT

// I haven't actually compiled and tried this but it's similar to the
code I
// have put together for positional rotary knobs that is working.
// this uses the newer "device" and function call syntax but translating
// back to EPICenter pre-v47 should also work well enough for this.

byte vLastPos = 0;

device(dFakeEncoder)
{
  connector(FirstExpansionModule);
  button(0, 0, bBit0);
  button(0, 1, bBit1);
  button(0, 2, bBit2);
};

void dFakeEncoder.bBit0.On(void)
{
  if(vLastPos == 2) {
    call(pulse_cw_keystroke);
  } else if (vLastPos == 1) {
    call(pulse_ccw_keystroke);
  } // else we're confused so don't send key presses :-)
  vLastPos = 0;
}

void dFakeEncoder.bBit1.On(void)
{
  if(vLastPos == 0) {
    call(pulse_cw_keystroke);
  } else if (vLastPos == 2) {
    call(pulse_ccw_keystroke);
  } // else we're confused so don't send key presses :-)
  vLastPos = 1;
}

void dFakeEncoder.bBit2.On(void)
{
  if(vLastPos == 1) {
    call(pulse_cw_keystroke);
  } else if (vLastPos == 0) {
    call(pulse_ccw_keystroke);
  } // else we're confused so don't send key presses :-)
  vLastPos = 2;
}

--END EPL EXCERPT

Ok, so the switch has only three positions but if you put a round knob
on it with no markings, who's to know??  It'll feel like an encoder
(ish).  In my testing with EPL code for rotary knobs that do have
positional line up requirements, EPL execution is plenty fast enough to
keep up with you even if you spin the knob pretty fast as you would with
an actual encoder.

The EPIC encoder module is quite spendy.  If this works it might save a
little that way.  Of course we may end up using some encoders in our
project since Falcon4 uses so many switches now the hardware may be on a
"switch count diet" to fit onto a single EPIC and encoders do seem to
use 1/3 less EPIC MRB namespace up when coding :-)

Cheers,

Mark.


> -----Original Message-----
> From: simpits-tech-admin@simpits.org [mailto:simpits-tech-
> admin@simpits.org] On Behalf Of Marv De Beque
> Sent: Monday, August 05, 2002 3:32 PM
> To: simpits-tech@simpits.org
> Subject: Re: [simpits-tech] Switchs, Rotary and pot
> 
> That is an open question.
> 
> The answer is, it depends.
> 
> However, you have not qualified the exact application, so it is hard
to
> give
> you a good answer.
> 
> However, since I am constructing a F-16 cockpit, I can tell you what I
> plan
> to use.  I will use a potentiometer for almost all of my applications
> where
> there is a knob.  Except....
> 
> ... the caveat is there are many knobs that use a rotary switch and I
will
> use a rotary switch where it is required.  I think you know what a
rotary
> switch is, but if not, it is a mechanical switch that rotates to
preset
> positions.
> 
> There are not too many places where an encoder will be applicable in
my
> sim.
> I may possibly use them for the ICP panel that sticks in the pilots
face.
> There are 4 thumb wheels that control contrast, brightness, and other
> functions on the HUD.  An encoder may be physically easier to mount
than a
> pot in those instances.
> 
> Encoders require more expensive circuitry to operate than a pot.
General
> rule of thumb is that there should be a good reason for using an
encoder
> where normally a pot will not do.
> 
> I would recommend a pot.
> 
> That being said, from the scope of the questions you are asking, I
wonder
> where you are at in your project and what your project goals are?  I
ask
> because I get a sense that you might be putting the cart before the
horse.
> 
> What is your goal and what is your plan to get there?
> 
> I am sure that you can get all the help you need right here, but it is
> good
> to get the basics first, outline your goals, and then we can help you
> execute your plan (or at least help you get a plan together).
> 
> Marv
> --
> 
> 
> > From: "Frank Riedel" <frank@rezultat.dk>
> > Reply-To: simpits-tech@simpits.org
> > Date: Tue, 6 Aug 2002 00:09:33 +0200
> > To: <simpits-tech@simpits.org>
> > Subject: Re: [simpits-tech] Switchs, Rotary and pot
> >
> > Great exampels ;o)
> > GOT IT ;o)
> > BUT - can i use POT instead of ENCODERS in my pit ???
> >
> > Frank
> >
> > ----- Original Message -----
> > From: "Marv De Beque" <mdebeque@woh.rr.com>
> > To: <simpits-tech@simpits.org>
> > Sent: Monday, August 05, 2002 11:57 PM
> > Subject: Re: [simpits-tech] Switchs, Rotary and pot
> >
> >
> >> No.
> >>
> >> A pot (short for potentiometer) is a device that rotates over a
given
> >> portion of a circle.  This is usually about 270 degrees, but there
are
> >> multi-turn pots that rotate 5, 10, or 20 turns from lock to lock.
> >>
> >> A pot is nothing more than a resistor that can be changed from zero
> >> (usually) to its maximum value.  100,000 Ohms is typical for
simulator
> > use.
> >>
> >> A pot, theoretically, has an infinite adjustment between its two
> extreme
> >> values (i.e., 0 to 100,000 Ohms).  So, like a faucet (in good
working
> >> order), you can adjust the flow to any value in between.
> >>
> >> A rotary encoder is different.  It is a device that rotates like a
pot,
> > but
> >> instead of acting like a variable resistor, it sends out a set of
> pulses
> > as
> >> the knob turns.  It is sort of like putting playing cards on the
forks
> of
> > a
> >> bicycle and turning the wheel.  As each spoke passes, an audible
click
> is
> >> heard (a pulse).  You can count the pulses and then determine how
far
> the
> >> wheel has rotated.  You need two two playing cards slightly offset
in
> an
> >> angular fashion to tell which direction the wheel is rotating.  By
> looking
> >> at which card clicks first you can tell direction of spin.
> >>
> >> The thing about encoders is that they have a "granularity".  Unlike
a
> pot
> >> which is infinite, there are finite steps to an encoder.  There may
be
> any
> >> number of steps you can get from a few to several hundred steps per
> >> revolution.  You can resolve the rotation only down to the step,
but
> you
> > can
> >> not tell how much an encoder rotates between step steps (i.e., a
half
> > step).
> >>
> >> Most encoders do not remember their positions when power to the
system
> is
> >> turned off.  So, the system must somehow save the last known
position
> if
> > it
> >> is to pick up where it left off at power down.  A pot has the same
> >> resistance whether the system has power or not.
> >>
> >> A pot almost always has a mechanical stop.  Resistance can only go
so
> far.
> >> An encoder does not necessarily have a mechanical stop and can be
> rotated
> >> continuously without stopping.
> >>
> >> An example of an encoder is a computer mouse (at least the old
ones).
> > Some
> >> new car stereos have them too.
> >>
> >> Two different animals that can be used in similar ways and each has
its
> >> advantages.
> >>
> >> Sorry for the long message, but I am short on time.
> >>
> >> Marv
> >> --
> >>
> >>
> >>> From: "Frank Riedel" <frank@rezultat.dk>
> >>> Reply-To: simpits-tech@simpits.org
> >>> Date: Mon, 5 Aug 2002 23:35:45 +0200
> >>> To: <simpits-tech@simpits.org>
> >>> Subject: Re: [simpits-tech] Switchs, Rotary and pot
> >>>
> >>> Thanks alot for the explanation ;o)
> >>>
> >>> I found the F16 panels at simpits.org...
> >>>
> >>> Did i get it right - rotary encoders = potentiometers ??
> >>>
> >>> Thanks
> >>> Frank !
> >>>
> >>> ----- Original Message -----
> >>> From: "Andreas Fransson" <andreas.fransson@post.utfors.se>
> >>> To: <simpits-tech@simpits.org>
> >>> Sent: Monday, August 05, 2002 9:09 PM
> >>> Subject: Re: [simpits-tech] Switchs, Rotary and pot
> >>>
> >>>
> >>>> Frank,
> >>>>
> >>>> 3-way switches are (usually) on-off-on. With or without automatic
> > return
> >>> to
> >>>> center position (not sure what the english expression for this
would
> > be).
> >>>>
> >>>> Rotaries, if you mean rotary switches and not rotary encoders,
may or
> > may
> >>>> not have limits. A couple I have here for example do not. They go
all
> > the
> >>>> way around. What they do is just rotate a common ground around a
> number
> > of
> >>>> connections. Like a "normal" switch but with many more positions.
> Mine
> >>> have
> >>>> 12 I think. You could say that they are "all-on" in the sense
that
> one
> >>> lead
> >>>> is always active. Encoders are a different breed altogether. They
are
> >>>> commonly used to sense motion (rotation) rather than indicate
switch
> >>>> positions.
> >>>>
> >>>> "Pots", or potentiometers, are basically variable resistors. I
you
> use
> > one
> >>>> with EPIC, or as a replacement for a joystick pot, it is 100 ohm
> linear
> >>> pots
> >>>> you want.
> >>>>
> >>>> If you use the EPIC, the kind of switches you use are almost
> > unimportant.
> >>>> EPL (the EPIC programming language) is very flexible. It's not at
all
> > like
> >>>> the standard joystick momentary on/off pushbuttons.
> >>>>
> >>>> What aircraft (or whatever) panels are you looking for?
> >>>>
> >>>> Andreas
> >>>> http://valhallainc.d2g.com
> >>>>
> >>>>
> >>>> From: "Frank Riedel" <frank@rezultat.dk>
> >>>>> Hi All !
> >>>>>
> >>>>> 3 way switchs - is that off-on-off  or ????
> >>>>> Rotary - is that 360 dg. or ???
> >>>>> 2 way switchs - is that on-on  or ???
> >>>>> Pot - is that a normal potmeter 100 ohm or  ???
> >>>>> Is EPIC control all those switchs nomatter if it is on-of or
on-on
> ???
> >>>>>
> >>>>> Do anyone of you guys have a link to a page where i can read
about
> it
> >>> ???
> >>>>>
> >>>>> and do anyone have a set of drawings of panels without knobs on
????
> >>>>>
> >>>>> thanks for all your help... i'm on the road for my first real
pit
> ;o)
> >>>>>
> >>>>> Frank
> >>>>
> >>>>
> >>>>
> >>>> _______________________________________________
> >>>> Simpits-tech mailing list
> >>>> Simpits-tech@simpits.org
> >>>> http://www.simpits.org/mailman/listinfo/simpits-tech
> >>>> To unsubscribe, please see the instructions at the bottom of the
> above
> >>> page.  Thanks!
> >>>
> >>>
> >>> _______________________________________________
> >>> Simpits-tech mailing list
> >>> Simpits-tech@simpits.org
> >>> http://www.simpits.org/mailman/listinfo/simpits-tech
> >>> To unsubscribe, please see the instructions at the bottom of the
above
> > page.
> >>> Thanks!
> >>
> >> _______________________________________________
> >> Simpits-tech mailing list
> >> Simpits-tech@simpits.org
> >> http://www.simpits.org/mailman/listinfo/simpits-tech
> >> To unsubscribe, please see the instructions at the bottom of the
above
> > page.  Thanks!
> >
> >
> > _______________________________________________
> > Simpits-tech mailing list
> > Simpits-tech@simpits.org
> > http://www.simpits.org/mailman/listinfo/simpits-tech
> > To unsubscribe, please see the instructions at the bottom of the
above
> page.
> > Thanks!
> 
> _______________________________________________
> Simpits-tech mailing list
> Simpits-tech@simpits.org
> http://www.simpits.org/mailman/listinfo/simpits-tech
> To unsubscribe, please see the instructions at the bottom of the above
> page.  Thanks!